comparison vamp/CQVamp.cpp @ 147:1060a19e2334

Report validity of CQKernel construction, and avoid NaN values for invalid parameters. Also documentation.
author Chris Cannam <c.cannam@qmul.ac.uk>
date Thu, 10 Jul 2014 12:19:39 +0100
parents 1e33f719dde1
children 459beada2635
comparison
equal deleted inserted replaced
146:0cbd9c904dbb 147:1060a19e2334
284 (m_minMIDIPitch, 0, m_tuningFrequency); 284 (m_minMIDIPitch, 0, m_tuningFrequency);
285 m_maxFrequency = Pitch::getFrequencyForPitch 285 m_maxFrequency = Pitch::getFrequencyForPitch
286 (m_maxMIDIPitch, 0, m_tuningFrequency); 286 (m_maxMIDIPitch, 0, m_tuningFrequency);
287 } 287 }
288 288
289 reset();
290
291 if (!m_cq || !m_cq->isValid()) {
292 cerr << "CQVamp::initialise: Constant-Q parameters not valid! Not initialising" << endl;
293 return false;
294 }
295
296 return true;
297 }
298
299 void
300 CQVamp::reset()
301 {
302 delete m_cq;
289 CQParameters p(m_inputSampleRate, m_minFrequency, m_maxFrequency, m_bpo); 303 CQParameters p(m_inputSampleRate, m_minFrequency, m_maxFrequency, m_bpo);
290 m_cq = new CQSpectrogram(p, m_interpolation); 304 m_cq = new CQSpectrogram(p, m_interpolation);
291
292 return true;
293 }
294
295 void
296 CQVamp::reset()
297 {
298 if (m_cq) {
299 delete m_cq;
300 CQParameters p(m_inputSampleRate, m_minFrequency, m_maxFrequency, m_bpo);
301 m_cq = new CQSpectrogram(p, m_interpolation);
302 }
303 m_haveStartTime = false; 305 m_haveStartTime = false;
304 m_columnCount = 0; 306 m_columnCount = 0;
305 } 307 }
306 308
307 size_t 309 size_t