X-Git-Url: https://git.aubio.org/?p=vamp-aubio-plugins.git;a=blobdiff_plain;f=plugins%2FNotes.cpp;h=c8688cd64d5f2b13b730206312a05dbf22f09c55;hp=e2cbfe5fbf615bbad6e90c6a84fa0526a72854e8;hb=c6252f75ebe67d506a37228c49cb0587228971f3;hpb=e26e2c00458ba55db7540403e59f1b308dc28120 diff --git a/plugins/Notes.cpp b/plugins/Notes.cpp index e2cbfe5..c8688cd 100644 --- a/plugins/Notes.cpp +++ b/plugins/Notes.cpp @@ -105,10 +105,21 @@ Notes::initialise(size_t channels, size_t stepSize, size_t blockSize) m_onset = new_fvec(1); m_pitch = new_fvec(1); + reset(); + + return true; +} + +void +Notes::reset() +{ + if (m_onsetdet) del_aubio_onset(m_onsetdet); + if (m_pitchdet) del_aubio_pitch(m_pitchdet); + m_onsetdet = new_aubio_onset (const_cast(getAubioNameForOnsetType(m_onsettype)), - blockSize, - stepSize, + m_blockSize, + m_stepSize, lrintf(m_inputSampleRate)); aubio_onset_set_threshold(m_onsetdet, m_threshold); @@ -117,8 +128,8 @@ Notes::initialise(size_t channels, size_t stepSize, size_t blockSize) m_pitchdet = new_aubio_pitch (const_cast(getAubioNameForPitchType(m_pitchtype)), - blockSize, - stepSize, + m_blockSize, + m_stepSize, lrintf(m_inputSampleRate)); aubio_pitch_set_unit(m_pitchdet, const_cast("freq")); @@ -129,13 +140,6 @@ Notes::initialise(size_t channels, size_t stepSize, size_t blockSize) m_currentOnset = Vamp::RealTime::zeroTime; m_haveCurrent = false; m_prevPitch = -1; - - return true; -} - -void -Notes::reset() -{ } size_t