comparison data/model/FFTModel.cpp @ 533:55ad231c9db7

* try some qvectors
author Chris Cannam
date Thu, 22 Jan 2009 17:58:33 +0000
parents 6066bde1c126
children 408e56d30f58
comparison
equal deleted inserted replaced
532:59dd6d1bcfb0 533:55ad231c9db7
159 FFTModel::getSampleRate() const 159 FFTModel::getSampleRate() const
160 { 160 {
161 return isOK() ? m_server->getModel()->getSampleRate() : 0; 161 return isOK() ? m_server->getModel()->getSampleRate() : 0;
162 } 162 }
163 163
164 void 164 FFTModel::Column
165 FFTModel::getColumn(size_t x, Column &result) const 165 FFTModel::getColumn(size_t x) const
166 { 166 {
167 Profiler profiler("FFTModel::getColumn", false); 167 Profiler profiler("FFTModel::getColumn", false);
168
169 Column result;
168 170
169 result.clear(); 171 result.clear();
170 size_t h = getHeight(); 172 size_t h = getHeight();
171 result.reserve(h); 173 result.reserve(h);
172 174
179 } 181 }
180 182
181 } else { 183 } else {
182 for (size_t i = 0; i < h; ++i) result.push_back(0.f); 184 for (size_t i = 0; i < h; ++i) result.push_back(0.f);
183 } 185 }
186
187 return result;
184 } 188 }
185 189
186 QString 190 QString
187 FFTModel::getBinName(size_t n) const 191 FFTModel::getBinName(size_t n) const
188 { 192 {
259 ++i; 263 ++i;
260 } 264 }
261 return peaks; 265 return peaks;
262 } 266 }
263 267
264 getColumn(x, values); 268 values = getColumn(x);
265 269
266 float mean = 0.f; 270 float mean = 0.f;
267 for (int i =0; i < values.size(); ++i) mean += values[i]; 271 for (int i =0; i < values.size(); ++i) mean += values[i];
268 if (values.size() >0) mean /= values.size(); 272 if (values.size() >0) mean /= values.size();
269 273