Clear cc events on advanceTime

This commit is contained in:
Paul Ferrand 2020-03-29 13:27:47 +02:00
parent dbe544515f
commit 1d74968bf0
2 changed files with 8 additions and 1 deletions

View file

@ -51,6 +51,12 @@ void sfz::MidiState::setSampleRate(float sampleRate) noexcept
void sfz::MidiState::advanceTime(int numSamples) noexcept
{
internalClock += numSamples;
for (auto& ccEvents: cc) {
ASSERT(!ccEvents.empty()); // CC event vectors should never be empty
ccEvents.front().second = ccEvents.back().second;
ccEvents.front().first = 0;
ccEvents.resize(1);
}
}
void sfz::MidiState::setSamplesPerBlock(int samplesPerBlock) noexcept

View file

@ -96,7 +96,8 @@ public:
/**
* @brief Advances the internal clock of a given amount of samples.
* You should call this at each callback.
* You should call this at each callback. This will flush the events
* in the midistate memory.
*
* @param numSamples the number of samples of clock advance
*/