Voice cleanups
This commit is contained in:
parent
97234177a1
commit
ca2ee8dc58
1 changed files with 6 additions and 10 deletions
|
|
@ -280,11 +280,9 @@ void sfz::Voice::processMono(AudioSpan<float> buffer) noexcept
|
||||||
auto rightBuffer = buffer.getSpan(1);
|
auto rightBuffer = buffer.getSpan(1);
|
||||||
|
|
||||||
auto modulationBuffer = resources.bufferPool.getBuffer(numSamples);
|
auto modulationBuffer = resources.bufferPool.getBuffer(numSamples);
|
||||||
auto tempBuffer = resources.bufferPool.getBuffer(numSamples);
|
if (!modulationBuffer)
|
||||||
if (!modulationBuffer || !tempBuffer)
|
|
||||||
return;
|
return;
|
||||||
auto modulationSpan = absl::MakeSpan(*modulationBuffer).first(numSamples);
|
auto modulationSpan = absl::MakeSpan(*modulationBuffer).first(numSamples);
|
||||||
auto tempSpan = absl::MakeSpan(*tempBuffer).first(numSamples);
|
|
||||||
|
|
||||||
{ // Amplitude processing
|
{ // Amplitude processing
|
||||||
ScopedTiming logger { amplitudeDuration };
|
ScopedTiming logger { amplitudeDuration };
|
||||||
|
|
@ -294,9 +292,9 @@ void sfz::Voice::processMono(AudioSpan<float> buffer) noexcept
|
||||||
getLinearEnvelope<float>(region->amplitudeCC, resources.midiState, modulationSpan, [](const float& modifier, float value){
|
getLinearEnvelope<float>(region->amplitudeCC, resources.midiState, modulationSpan, [](const float& modifier, float value){
|
||||||
return value * modifier;
|
return value * modifier;
|
||||||
});
|
});
|
||||||
DBG("Amplitude curve back: " << modulationSpan.back());
|
// DBG("Amplitude curve back: " << modulationSpan.back());
|
||||||
add<float>(baseGain, modulationSpan);
|
add<float>(baseGain, modulationSpan);
|
||||||
DBG("FInal gain: " << modulationSpan.back());
|
// DBG("Final gain: " << modulationSpan.back());
|
||||||
applyGain<float>(modulationSpan, leftBuffer);
|
applyGain<float>(modulationSpan, leftBuffer);
|
||||||
|
|
||||||
// Crossfade envelopes
|
// Crossfade envelopes
|
||||||
|
|
@ -306,14 +304,14 @@ void sfz::Voice::processMono(AudioSpan<float> buffer) noexcept
|
||||||
return crossfadeIn(range, value, region->crossfadeCCCurve);
|
return crossfadeIn(range, value, region->crossfadeCCCurve);
|
||||||
});
|
});
|
||||||
applyGain<float>(modulationSpan, leftBuffer);
|
applyGain<float>(modulationSpan, leftBuffer);
|
||||||
DBG("XFin: " << modulationSpan.back());
|
// DBG("XFin: " << modulationSpan.back());
|
||||||
|
|
||||||
fill<float>(modulationSpan, 1.0f);
|
fill<float>(modulationSpan, 1.0f);
|
||||||
getLinearEnvelope<Range<float>>(region->crossfadeCCOutRange, resources.midiState, modulationSpan, [this](const Range<float>& range, float value){
|
getLinearEnvelope<Range<float>>(region->crossfadeCCOutRange, resources.midiState, modulationSpan, [this](const Range<float>& range, float value){
|
||||||
return crossfadeOut(range, value, region->crossfadeCCCurve);
|
return crossfadeOut(range, value, region->crossfadeCCCurve);
|
||||||
});
|
});
|
||||||
applyGain<float>(modulationSpan, leftBuffer);
|
applyGain<float>(modulationSpan, leftBuffer);
|
||||||
DBG("XFout: " << modulationSpan.back());
|
// DBG("XFout: " << modulationSpan.back());
|
||||||
|
|
||||||
// Volume envelope
|
// Volume envelope
|
||||||
volumeEnvelope.getBlock(modulationSpan);
|
volumeEnvelope.getBlock(modulationSpan);
|
||||||
|
|
@ -359,11 +357,9 @@ void sfz::Voice::processStereo(AudioSpan<float> buffer) noexcept
|
||||||
auto rightBuffer = buffer.getSpan(1);
|
auto rightBuffer = buffer.getSpan(1);
|
||||||
|
|
||||||
auto modulationBuffer = resources.bufferPool.getBuffer(numSamples);
|
auto modulationBuffer = resources.bufferPool.getBuffer(numSamples);
|
||||||
auto tempBuffer = resources.bufferPool.getBuffer(numSamples);
|
if (!modulationBuffer)
|
||||||
if (!modulationBuffer || !tempBuffer)
|
|
||||||
return;
|
return;
|
||||||
auto modulationSpan = absl::MakeSpan(*modulationBuffer).first(numSamples);
|
auto modulationSpan = absl::MakeSpan(*modulationBuffer).first(numSamples);
|
||||||
auto tempSpan = absl::MakeSpan(*tempBuffer).first(numSamples);
|
|
||||||
|
|
||||||
{ // Amplitude processing
|
{ // Amplitude processing
|
||||||
ScopedTiming logger { amplitudeDuration };
|
ScopedTiming logger { amplitudeDuration };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue