Fix a problem of unwanted copy

This commit is contained in:
Jean Pierre Cimalando 2020-07-26 23:28:36 +02:00
parent ce43bb39ff
commit 45fe825bc0
2 changed files with 7 additions and 7 deletions

View file

@ -271,8 +271,8 @@ void pitchBendEnvelope(const EventVector& events, absl::Span<float> envelope, F&
template <class F>
void linearModifier(const sfz::Resources& resources, absl::Span<float> span, const sfz::CCData<sfz::Modifier>& ccData, F&& lambda)
{
const auto events = resources.midiState.getCCEvents(ccData.cc);
const auto curve = resources.curves.getCurve(ccData.data.curve);
const auto& events = resources.midiState.getCCEvents(ccData.cc);
const auto& curve = resources.curves.getCurve(ccData.data.curve);
if (ccData.data.step == 0.0f) {
linearEnvelope(events, span, [&ccData, &curve, &lambda](float x) {
return lambda(curve.evalNormalized(x) * ccData.data.value);
@ -301,8 +301,8 @@ void linearModifier(const sfz::Resources& resources, absl::Span<float> span, con
template <class F>
void multiplicativeModifier(const sfz::Resources& resources, absl::Span<float> span, const sfz::CCData<sfz::Modifier>& ccData, F&& lambda)
{
const auto events = resources.midiState.getCCEvents(ccData.cc);
const auto curve = resources.curves.getCurve(ccData.data.curve);
const auto& events = resources.midiState.getCCEvents(ccData.cc);
const auto& curve = resources.curves.getCurve(ccData.data.curve);
if (ccData.data.step == 0.0f) {
multiplicativeEnvelope(events, span, [&ccData, &curve, &lambda](float x) {
return lambda(curve.evalNormalized(x) * ccData.data.value);

View file

@ -142,7 +142,7 @@ void sfz::Voice::startVoice(Region* region, int delay, int number, float value,
ASSERT(modifierSmoothers[modId].size() >= region->modifiers[modId].size());
forEachWithSmoother(modId, [modId, this](const CCData<Modifier>& mod, Smoother& smoother) {
const auto ccValue = resources.midiState.getCCValue(mod.cc);
const auto curve = resources.curves.getCurve(mod.data.curve);
const auto& curve = resources.curves.getCurve(mod.data.curve);
const auto finalValue = curve.evalNormalized(ccValue) * mod.data.value;
switch (modId) {
case Mod::volume:
@ -347,7 +347,7 @@ void sfz::Voice::applyCrossfades(absl::Span<float> modulationSpan) noexcept
bool canShortcut = true;
for (const auto& mod : region->crossfadeCCInRange) {
const auto events = resources.midiState.getCCEvents(mod.cc);
const auto& events = resources.midiState.getCCEvents(mod.cc);
canShortcut &= (events.size() == 1);
linearEnvelope(events, *tempSpan, [&](float x) {
return crossfadeIn(mod.data, x, xfCurve);
@ -356,7 +356,7 @@ void sfz::Voice::applyCrossfades(absl::Span<float> modulationSpan) noexcept
}
for (const auto& mod : region->crossfadeCCOutRange) {
const auto events = resources.midiState.getCCEvents(mod.cc);
const auto& events = resources.midiState.getCCEvents(mod.cc);
canShortcut &= (events.size() == 1);
linearEnvelope(events, *tempSpan, [&](float x) {
return crossfadeOut(mod.data, x, xfCurve);