Skip to content

Commit

Permalink
Apply modifier for pitch_cc and tune cc
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfd committed Mar 31, 2020
1 parent bf4bdad commit ddeecf4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/sfizz/Voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,14 @@ void sfz::Voice::fillWithData(AudioSpan<float> buffer) noexcept
multiplicativeEnvelope(events, *bends, bendLambda, bendStepFactor);
else
multiplicativeEnvelope(events, *bends, bendLambda);

applyGain<float>(*bends, *jumps);

for (const auto& mod : region->tuneCC) {
const auto events = resources.midiState.getCCEvents(mod.cc);
multiplicativeEnvelope(events, *bends, [&](float x) { return centsFactor(x * mod.value); });
applyGain<float>(*bends, *jumps);
}

jumps->front() += floatPositionOffset;
cumsum<float>(*jumps, *jumps);
sfzInterpolationCast<float>(*jumps, *indices, *leftCoeffs, *rightCoeffs);
Expand Down Expand Up @@ -562,9 +568,14 @@ void sfz::Voice::fillWithGenerator(AudioSpan<float> buffer) noexcept
multiplicativeEnvelope(events, *bends, bendLambda, bendStepFactor);
else
multiplicativeEnvelope(events, *bends, bendLambda);

applyGain<float>(*bends, *frequencies);

for (const auto& mod : region->tuneCC) {
const auto events = resources.midiState.getCCEvents(mod.cc);
multiplicativeEnvelope(events, *bends, [&](float x) { return centsFactor(x * mod.value); });
applyGain<float>(*bends, *frequencies);
}

waveOscillator.processModulated(frequencies->data(), leftSpan.data(), buffer.getNumFrames());
copy<float>(leftSpan, rightSpan);
}
Expand Down

0 comments on commit ddeecf4

Please sign in to comment.