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<char *>(getAubioNameForOnsetType(m_onsettype)),
- blockSize,
- stepSize,
+ m_blockSize,
+ m_stepSize,
lrintf(m_inputSampleRate));
aubio_onset_set_threshold(m_onsetdet, m_threshold);
m_pitchdet = new_aubio_pitch
(const_cast<char *>(getAubioNameForPitchType(m_pitchtype)),
- blockSize,
- stepSize,
+ m_blockSize,
+ m_stepSize,
lrintf(m_inputSampleRate));
aubio_pitch_set_unit(m_pitchdet, const_cast<char *>("freq"));
m_currentOnset = Vamp::RealTime::zeroTime;
m_haveCurrent = false;
m_prevPitch = -1;
-
- return true;
-}
-
-void
-Notes::reset()
-{
}
size_t
m_ibuf = new_fvec(stepSize);
m_onset = new_fvec(1);
+ reset();
+
+ return true;
+}
+
+void
+Onset::reset()
+{
+ if (m_onsetdet) del_aubio_onset(m_onsetdet);
+
m_onsetdet = new_aubio_onset
(const_cast<char *>(getAubioNameForOnsetType(m_onsettype)),
- blockSize,
- stepSize,
+ 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);
- m_delay = Vamp::RealTime::frame2RealTime(4 * stepSize,
+ m_delay = Vamp::RealTime::frame2RealTime(4 * m_stepSize,
lrintf(m_inputSampleRate));
m_lastOnset = Vamp::RealTime::zeroTime - m_delay - m_delay;
-
- return true;
-}
-
-void
-Onset::reset()
-{
}
size_t
m_ibuf = new_fvec(stepSize);
m_obuf = new_fvec(1);
- m_pitchdet = new_aubio_pitch
- (const_cast<char *>(getAubioNameForPitchType(m_pitchtype)),
- blockSize,
- stepSize,
- lrintf(m_inputSampleRate));
-
- aubio_pitch_set_unit(m_pitchdet, const_cast<char *>("freq"));
+ reset();
return true;
}
void
Pitch::reset()
{
+ if (m_pitchdet) del_aubio_pitch(m_pitchdet);
+
+ m_pitchdet = new_aubio_pitch
+ (const_cast<char *>(getAubioNameForPitchType(m_pitchtype)),
+ m_blockSize,
+ m_stepSize,
+ lrintf(m_inputSampleRate));
+
+ aubio_pitch_set_unit(m_pitchdet, const_cast<char *>("freq"));
}
size_t
m_delay = Vamp::RealTime::frame2RealTime(3 * stepSize,
lrintf(m_inputSampleRate));
+ reset();
+
+ return true;
+}
+
+void
+Tempo::reset()
+{
+ if (m_tempo) del_aubio_tempo(m_tempo);
+
m_lastBeat = Vamp::RealTime::zeroTime - m_delay - m_delay;
m_tempo = new_aubio_tempo
(const_cast<char *>(getAubioNameForOnsetType(m_onsettype)),
- blockSize,
- stepSize,
+ m_blockSize,
+ m_stepSize,
lrintf(m_inputSampleRate));
aubio_tempo_set_silence(m_tempo, m_silence);
aubio_tempo_set_threshold(m_tempo, m_threshold);
-
- return true;
-}
-
-void
-Tempo::reset()
-{
}
size_t