Evaluate the curve in extended CCs
This commit is contained in:
parent
956b0c9c13
commit
4ec32024ce
1 changed files with 10 additions and 11 deletions
|
|
@ -93,12 +93,11 @@ void ControllerSource::generate(const ModKey& sourceKey, NumericId<Voice> voiceI
|
||||||
const MidiState& ms = res.getMidiState();
|
const MidiState& ms = res.getMidiState();
|
||||||
bool canShortcut = false;
|
bool canShortcut = false;
|
||||||
|
|
||||||
auto transformValue = [p, &curve](float x) {
|
auto transformValue = [&] (float x) {
|
||||||
return curve.evalNormalized(x);
|
return curve.evalNormalized(x);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ignore the eventual curve for the extended CCs
|
auto quantize = [&] (float x) {
|
||||||
auto quantize = [p](float x) {
|
|
||||||
if (p.step > 0.0f)
|
if (p.step > 0.0f)
|
||||||
return std::trunc(x / p.step) * p.step;
|
return std::trunc(x / p.step) * p.step;
|
||||||
|
|
||||||
|
|
@ -112,7 +111,7 @@ void ControllerSource::generate(const ModKey& sourceKey, NumericId<Voice> voiceI
|
||||||
voice && voice->getTriggerEvent().type == TriggerEventType::NoteOn ?
|
voice && voice->getTriggerEvent().type == TriggerEventType::NoteOn ?
|
||||||
impl_->res_->getMidiState().getPolyAftertouch(voice->getTriggerEvent().number) : 0.0f;
|
impl_->res_->getMidiState().getPolyAftertouch(voice->getTriggerEvent().number) : 0.0f;
|
||||||
|
|
||||||
sfz::fill(buffer, quantize(fillValue));
|
sfz::fill(buffer, quantize(transformValue(fillValue)));
|
||||||
canShortcut = true;
|
canShortcut = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +121,7 @@ void ControllerSource::generate(const ModKey& sourceKey, NumericId<Voice> voiceI
|
||||||
voice && voice->getTriggerEvent().type == TriggerEventType::NoteOn ?
|
voice && voice->getTriggerEvent().type == TriggerEventType::NoteOn ?
|
||||||
voice->getTriggerEvent().value : 0.0f;
|
voice->getTriggerEvent().value : 0.0f;
|
||||||
|
|
||||||
sfz::fill(buffer, quantize(fillValue));
|
sfz::fill(buffer, quantize(transformValue(fillValue)));
|
||||||
canShortcut = true;
|
canShortcut = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -132,42 +131,42 @@ void ControllerSource::generate(const ModKey& sourceKey, NumericId<Voice> voiceI
|
||||||
voice && voice->getTriggerEvent().type == TriggerEventType::NoteOff ?
|
voice && voice->getTriggerEvent().type == TriggerEventType::NoteOff ?
|
||||||
voice->getTriggerEvent().value : 0.0f;
|
voice->getTriggerEvent().value : 0.0f;
|
||||||
|
|
||||||
sfz::fill(buffer, quantize(fillValue));
|
sfz::fill(buffer, quantize(transformValue(fillValue)));
|
||||||
canShortcut = true;
|
canShortcut = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ExtendedCCs::keyboardNoteNumber: {
|
case ExtendedCCs::keyboardNoteNumber: {
|
||||||
const auto voice = impl_->voiceManager_->getVoiceById(voiceId);
|
const auto voice = impl_->voiceManager_->getVoiceById(voiceId);
|
||||||
const float fillValue = voice ? normalize7Bits(voice->getTriggerEvent().number) : 0.0f;
|
const float fillValue = voice ? normalize7Bits(voice->getTriggerEvent().number) : 0.0f;
|
||||||
sfz::fill(buffer, quantize(fillValue));
|
sfz::fill(buffer, quantize(transformValue(fillValue)));
|
||||||
canShortcut = true;
|
canShortcut = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ExtendedCCs::keyboardNoteGate: {
|
case ExtendedCCs::keyboardNoteGate: {
|
||||||
const auto voice = impl_->voiceManager_->getVoiceById(voiceId);
|
const auto voice = impl_->voiceManager_->getVoiceById(voiceId);
|
||||||
const float fillValue = voice ? voice->getExtendedCCValues().noteGate : 0.0f;
|
const float fillValue = voice ? voice->getExtendedCCValues().noteGate : 0.0f;
|
||||||
sfz::fill(buffer, quantize(fillValue));
|
sfz::fill(buffer, quantize(transformValue(fillValue)));
|
||||||
canShortcut = true;
|
canShortcut = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ExtendedCCs::unipolarRandom: {
|
case ExtendedCCs::unipolarRandom: {
|
||||||
const auto voice = impl_->voiceManager_->getVoiceById(voiceId);
|
const auto voice = impl_->voiceManager_->getVoiceById(voiceId);
|
||||||
const float fillValue = voice ? voice->getExtendedCCValues().unipolar : 0.0f;
|
const float fillValue = voice ? voice->getExtendedCCValues().unipolar : 0.0f;
|
||||||
sfz::fill(buffer, quantize(fillValue));
|
sfz::fill(buffer, quantize(transformValue(fillValue)));
|
||||||
canShortcut = true;
|
canShortcut = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ExtendedCCs::bipolarRandom: {
|
case ExtendedCCs::bipolarRandom: {
|
||||||
const auto voice = impl_->voiceManager_->getVoiceById(voiceId);
|
const auto voice = impl_->voiceManager_->getVoiceById(voiceId);
|
||||||
const float fillValue = voice ? voice->getExtendedCCValues().bipolar : 0.0f;
|
const float fillValue = voice ? voice->getExtendedCCValues().bipolar : 0.0f;
|
||||||
sfz::fill(buffer, quantize(fillValue));
|
sfz::fill(buffer, quantize(transformValue(fillValue)));
|
||||||
canShortcut = true;
|
canShortcut = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ExtendedCCs::alternate: {
|
case ExtendedCCs::alternate: {
|
||||||
const auto voice = impl_->voiceManager_->getVoiceById(voiceId);
|
const auto voice = impl_->voiceManager_->getVoiceById(voiceId);
|
||||||
const float fillValue = voice ? voice->getExtendedCCValues().alternate : 0.0f;
|
const float fillValue = voice ? voice->getExtendedCCValues().alternate : 0.0f;
|
||||||
sfz::fill(buffer, quantize(fillValue));
|
sfz::fill(buffer, quantize(transformValue(fillValue)));
|
||||||
canShortcut = true;
|
canShortcut = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue