If an event is registered at some delay, shadow the previous value

This commit is contained in:
Paul Ferrand 2020-03-29 16:08:55 +02:00
parent 9263488882
commit 612265ebb5

View file

@ -105,7 +105,10 @@ void sfz::MidiState::ccEvent(int delay, int ccNumber, float ccValue) noexcept
{
ASSERT(ccValue >= 0.0 && ccValue <= 1.0);
const auto insertionPoint = absl::c_upper_bound(cc[ccNumber], delay, MidiEventDelayComparator{});
cc[ccNumber].insert(insertionPoint, { delay, ccValue });
if (insertionPoint == cc[ccNumber].end() || insertionPoint->delay != delay)
cc[ccNumber].insert(insertionPoint, { delay, ccValue });
else
insertionPoint->value = ccValue;
}
float sfz::MidiState::getCCValue(int ccNumber) const noexcept