Corrected a bug where the value of the last event was not properly quantized after a call to getQuantizedBlock

This commit is contained in:
Paul Ferrand 2019-12-13 14:00:25 +01:00
parent c763e819bb
commit d60a851fc0

View file

@ -66,9 +66,6 @@ template <class Type>
void EventEnvelope<Type>::prepareEvents() void EventEnvelope<Type>::prepareEvents()
{ {
if (resetEvents) { if (resetEvents) {
if (!events.empty())
currentValue = events.back().second;
clear(); clear();
} else { } else {
absl::c_sort(events, [](const auto& lhs, const auto& rhs) { absl::c_sort(events, [](const auto& lhs, const auto& rhs) {
@ -152,7 +149,7 @@ void LinearEnvelope<Type>::getQuantizedBlock(absl::Span<Type> output, Type quant
fill<Type>(output.subspan(index), currentValue); fill<Type>(output.subspan(index), currentValue);
currentValue = newValue; currentValue = newValue;
index = outputSize; index = outputSize;
break; continue;
} }
const auto length = event.first - index - 1; const auto length = event.first - index - 1;
@ -241,7 +238,7 @@ void MultiplicativeEnvelope<Type>::getQuantizedBlock(absl::Span<Type> output, Ty
fill<Type>(output.subspan(index), currentValue); fill<Type>(output.subspan(index), currentValue);
currentValue = newValue; currentValue = newValue;
index = outputSize; index = outputSize;
break; continue;
} }
const auto length = event.first - index - 1; const auto length = event.first - index - 1;