# HG changeset patch # User Chris Cannam # Date 1237825752 0 # Node ID e51152b7ee062333f9253b30a1e1df42e755fa09 # Parent f46864eba7fdadbe33a770e75a101170218b4336 * Fixes to problems shown by vamp-plugin-tester diff -r f46864eba7fd -r e51152b7ee06 libmain.cpp --- a/libmain.cpp Tue Mar 17 15:20:40 2009 +0000 +++ b/libmain.cpp Mon Mar 23 16:29:12 2009 +0000 @@ -50,7 +50,7 @@ case 7: return similarityPluginAdapter.getDescriptor(); case 8: return mfccPluginAdapter.getDescriptor(); case 9: return barBeatTrackPluginAdapter.getDescriptor(); - case 10: return adaptiveSpectrogramAdapter.getDescriptor(); +// case 10: return adaptiveSpectrogramAdapter.getDescriptor(); default: return 0; } } diff -r f46864eba7fd -r e51152b7ee06 plugins/BarBeatTrack.cpp --- a/plugins/BarBeatTrack.cpp Tue Mar 17 15:20:40 2009 +0000 +++ b/plugins/BarBeatTrack.cpp Mon Mar 23 16:29:12 2009 +0000 @@ -29,7 +29,7 @@ df = new DetectionFunction(config); // decimation factor aims at resampling to c. 3KHz; must be power of 2 int factor = MathUtilities::nextPowerOfTwo(rate / 3000); - std::cerr << "BarBeatTrackerData: factor = " << factor << std::endl; +// std::cerr << "BarBeatTrackerData: factor = " << factor << std::endl; downBeat = new DownBeat(rate, factor, config.stepSize); } ~BarBeatTrackerData() { @@ -184,6 +184,7 @@ BarBeatTracker::getPreferredStepSize() const { size_t step = size_t(m_inputSampleRate * m_stepSecs + 0.0001); + if (step < 1) step = 1; // std::cerr << "BarBeatTracker::getPreferredStepSize: input sample rate is " << m_inputSampleRate << ", step size is " << step << std::endl; return step; } diff -r f46864eba7fd -r e51152b7ee06 plugins/ChromagramPlugin.cpp --- a/plugins/ChromagramPlugin.cpp Tue Mar 17 15:20:40 2009 +0000 +++ b/plugins/ChromagramPlugin.cpp Mon Mar 23 16:29:12 2009 +0000 @@ -222,6 +222,7 @@ m_step = m_chromagram->getHopSize(); m_block = m_chromagram->getFrameSize(); + if (m_step < 1) m_step = 1; if (blockSize != m_block) { std::cerr << "ChromagramPlugin::initialise: ERROR: supplied block size " << blockSize << " differs from required block size " << m_block << ", initialise failing" << std::endl; @@ -257,6 +258,7 @@ Chromagram chroma(m_config); m_step = chroma.getHopSize(); m_block = chroma.getFrameSize(); + if (m_step < 1) m_step = 1; } return m_step; @@ -269,6 +271,7 @@ Chromagram chroma(m_config); m_step = chroma.getHopSize(); m_block = chroma.getFrameSize(); + if (m_step < 1) m_step = 1; } return m_block; diff -r f46864eba7fd -r e51152b7ee06 plugins/ConstantQSpectrogram.cpp --- a/plugins/ConstantQSpectrogram.cpp Tue Mar 17 15:20:40 2009 +0000 +++ b/plugins/ConstantQSpectrogram.cpp Mon Mar 23 16:29:12 2009 +0000 @@ -280,7 +280,7 @@ d.hasFixedBinCount = true; d.binCount = m_bins; - std::cerr << "Bin count " << d.binCount << std::endl; +// std::cerr << "Bin count " << d.binCount << std::endl; const char *names[] = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" }; diff -r f46864eba7fd -r e51152b7ee06 plugins/KeyDetect.cpp --- a/plugins/KeyDetect.cpp Tue Mar 17 15:20:40 2009 +0000 +++ b/plugins/KeyDetect.cpp Mon Mar 23 16:29:12 2009 +0000 @@ -166,7 +166,8 @@ m_inputFrame = new double[m_blockSize]; m_prevKey = -1; - + m_first = true; + return true; } @@ -187,6 +188,7 @@ } m_prevKey = -1; + m_first = true; } @@ -290,7 +292,7 @@ int prevTonic = m_prevKey; if (prevTonic > 12) prevTonic -= 12; - if (tonic != prevTonic) { + if (m_first || (tonic != prevTonic)) { Feature feature; feature.hasTimestamp = true; feature.timestamp = now; @@ -300,7 +302,7 @@ returnFeatures[0].push_back(feature); // tonic } - if (minor != (m_getKeyMode->isModeMinor(m_prevKey))) { + if (m_first || (minor != (m_getKeyMode->isModeMinor(m_prevKey)))) { Feature feature; feature.hasTimestamp = true; feature.timestamp = now; @@ -309,7 +311,7 @@ returnFeatures[1].push_back(feature); // mode } - if (key != m_prevKey) { + if (m_first || (key != m_prevKey)) { Feature feature; feature.hasTimestamp = true; feature.timestamp = now; @@ -319,6 +321,7 @@ } m_prevKey = key; + m_first = false; Feature ksf; ksf.values.reserve(25); diff -r f46864eba7fd -r e51152b7ee06 plugins/KeyDetect.h --- a/plugins/KeyDetect.h Tue Mar 17 15:20:40 2009 +0000 +++ b/plugins/KeyDetect.h Mon Mar 23 16:29:12 2009 +0000 @@ -57,6 +57,7 @@ GetKeyMode* m_getKeyMode; double* m_inputFrame; int m_prevKey; + bool m_first; }; diff -r f46864eba7fd -r e51152b7ee06 plugins/MFCCPlugin.cpp --- a/plugins/MFCCPlugin.cpp Tue Mar 17 15:20:40 2009 +0000 +++ b/plugins/MFCCPlugin.cpp Mon Mar 23 16:29:12 2009 +0000 @@ -173,8 +173,8 @@ if (channels < getMinChannelCount() || channels > getMaxChannelCount()) return false; - std::cerr << "MFCCPlugin::initialise: step " << stepSize << ", block " - << blockSize << std::endl; +// std::cerr << "MFCCPlugin::initialise: step " << stepSize << ", block " +// << blockSize << std::endl; m_step = stepSize; m_block = blockSize; @@ -281,6 +281,8 @@ feature.label = ""; ++m_count; + delete[] output; + FeatureSet returnFeatures; returnFeatures[0].push_back(feature); return returnFeatures; diff -r f46864eba7fd -r e51152b7ee06 plugins/OnsetDetect.cpp --- a/plugins/OnsetDetect.cpp Tue Mar 17 15:20:40 2009 +0000 +++ b/plugins/OnsetDetect.cpp Mon Mar 23 16:29:12 2009 +0000 @@ -272,6 +272,7 @@ OnsetDetector::getPreferredStepSize() const { size_t step = size_t(m_inputSampleRate * m_preferredStepSecs + 0.0001); + if (step < 1) step = 1; // std::cerr << "OnsetDetector::getPreferredStepSize: input sample rate is " << m_inputSampleRate << ", step size is " << step << std::endl; return step; }