comparison data/model/FFTModel.cpp @ 1136:e94719f941ba tony-2.0-integration

Return maximum through getNormalizedMagnitudesAt to avoid having to make more than one call
author Chris Cannam
date Tue, 20 Oct 2015 12:54:06 +0100
parents e994747fb9dd
children 444d133b5ab7
comparison
equal deleted inserted replaced
1135:7fb1a7199e5b 1136:e94719f941ba
153 values[i] = abs(col[minbin + i]); 153 values[i] = abs(col[minbin + i]);
154 } 154 }
155 return true; 155 return true;
156 } 156 }
157 157
158 bool 158 float
159 FFTModel::getNormalizedMagnitudesAt(int x, float *values, int minbin, int count) const 159 FFTModel::getNormalizedMagnitudesAt(int x, float *values, int minbin, int count) const
160 { 160 {
161 if (!getMagnitudesAt(x, values, minbin, count)) return false; 161 if (!getMagnitudesAt(x, values, minbin, count)) return false;
162 if (count == 0) count = getHeight(); 162 if (count == 0) count = getHeight();
163 float max = 0.f; 163 float max = 0.f;
167 if (max > 0.f) { 167 if (max > 0.f) {
168 for (int i = 0; i < count; ++i) { 168 for (int i = 0; i < count; ++i) {
169 values[i] /= max; 169 values[i] /= max;
170 } 170 }
171 } 171 }
172 return true; 172 return max;
173 } 173 }
174 174
175 bool 175 bool
176 FFTModel::getPhasesAt(int x, float *values, int minbin, int count) const 176 FFTModel::getPhasesAt(int x, float *values, int minbin, int count) const
177 { 177 {