X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fvamp-plugins%2FOnset.cpp;h=03e35ba3fe8f3e41836f843013146d39e968c1fe;hb=b32ca9e9d94affba4cb194d57267e185cc6d5553;hp=b8a97170240cb3e23ba2808aa25207a8e473ef7d;hpb=9aacefc17010a889222425f97b99050171165038;p=ardour.git diff --git a/libs/vamp-plugins/Onset.cpp b/libs/vamp-plugins/Onset.cpp index b8a9717024..03e35ba3fe 100644 --- a/libs/vamp-plugins/Onset.cpp +++ b/libs/vamp-plugins/Onset.cpp @@ -5,7 +5,7 @@ Centre for Digital Music, Queen Mary, University of London. This file copyright 2006 Chris Cannam. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the @@ -136,7 +136,7 @@ Onset::initialise(size_t channels, size_t stepSize, size_t blockSize) m_peakpick = new_aubio_peakpicker(m_threshold); m_onsetdet = new_aubio_onsetdetection(m_onsettype, blockSize, channels); - + m_delay = Vamp::RealTime::frame2RealTime(4 * stepSize, lrintf(m_inputSampleRate)); @@ -157,7 +157,7 @@ Onset::reset() m_blockSize, m_stepSize, lrintf(m_inputSampleRate)); - + aubio_onset_set_threshold(m_onsetdet, m_threshold); aubio_onset_set_silence(m_onsetdet, m_silence); aubio_onset_set_minioi(m_onsetdet, m_minioi); @@ -166,6 +166,12 @@ Onset::reset() lrintf(m_inputSampleRate)); m_lastOnset = Vamp::RealTime::zeroTime - m_delay - m_delay; +#else + if (m_onsetdet) aubio_onsetdetection_free(m_onsetdet); + if (m_peakpick) del_aubio_peakpicker(m_peakpick); + + m_peakpick = new_aubio_peakpicker(m_threshold); + m_onsetdet = new_aubio_onsetdetection(m_onsettype, m_blockSize, m_channelCount); #endif } @@ -185,7 +191,7 @@ Onset::ParameterList Onset::getParameterDescriptors() const { ParameterList list; - + ParameterDescriptor desc; desc.identifier = "onsettype"; desc.name = "Onset Detection Function Type";