Ensure plugin CC does not Reset all controllers
This commit is contained in:
parent
9d8e184d05
commit
13dfddae64
2 changed files with 27 additions and 12 deletions
|
|
@ -645,7 +645,7 @@ sfizz_lv2_handle_atom_object(sfizz_plugin_t *self, int delay, const LV2_Atom_Obj
|
||||||
if (cc != -1) {
|
if (cc != -1) {
|
||||||
if (atom->type == self->atom_float_uri && atom->size == sizeof(float)) {
|
if (atom->type == self->atom_float_uri && atom->size == sizeof(float)) {
|
||||||
float value = *(const float *)LV2_ATOM_BODY_CONST(atom);
|
float value = *(const float *)LV2_ATOM_BODY_CONST(atom);
|
||||||
sfizz_send_hdcc(self->synth, delay, cc, value);
|
sfizz_automate_hdcc(self->synth, delay, cc, value);
|
||||||
self->cc_current[cc] = value;
|
self->cc_current[cc] = value;
|
||||||
self->ccauto[cc] = absl::nullopt;
|
self->ccauto[cc] = absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
@ -711,13 +711,28 @@ sfizz_lv2_process_midi_event(sfizz_plugin_t *self, const LV2_Atom_Event *ev)
|
||||||
{
|
{
|
||||||
unsigned cc = msg[1];
|
unsigned cc = msg[1];
|
||||||
float value = float(msg[2]) * (1.0f / 127.0f);
|
float value = float(msg[2]) * (1.0f / 127.0f);
|
||||||
sfizz_send_hdcc(self->synth,
|
|
||||||
(int)ev->time.frames,
|
switch (cc)
|
||||||
(int)cc,
|
{
|
||||||
value);
|
default:
|
||||||
self->cc_current[cc] = value;
|
{
|
||||||
self->ccauto[cc] = value;
|
sfizz_automate_hdcc(self->synth,
|
||||||
self->have_ccauto = true;
|
(int)ev->time.frames,
|
||||||
|
(int)cc,
|
||||||
|
value);
|
||||||
|
self->cc_current[cc] = value;
|
||||||
|
self->ccauto[cc] = value;
|
||||||
|
self->have_ccauto = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LV2_MIDI_CTL_ALL_NOTES_OFF:
|
||||||
|
// TODO implemented as all-sound-off
|
||||||
|
sfizz_all_sound_off(self->synth);
|
||||||
|
break;
|
||||||
|
case LV2_MIDI_CTL_ALL_SOUNDS_OFF:
|
||||||
|
sfizz_all_sound_off(self->synth);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1416,7 +1431,7 @@ restore(LV2_Handle instance,
|
||||||
absl::optional<float> value = cc_values[cc];
|
absl::optional<float> value = cc_values[cc];
|
||||||
if (value) {
|
if (value) {
|
||||||
// Set CC in the synth
|
// Set CC in the synth
|
||||||
sfizz_send_hdcc(self->synth, 0, int(cc), *value);
|
sfizz_automate_hdcc(self->synth, 0, int(cc), *value);
|
||||||
// Mark CCs for automation with state values
|
// Mark CCs for automation with state values
|
||||||
self->ccauto[cc] = *value;
|
self->ccauto[cc] = *value;
|
||||||
self->have_ccauto = true;
|
self->have_ccauto = true;
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,7 @@ void SfizzVstProcessor::playOrderedParameter(int32 sampleOffset, Vst::ParamID id
|
||||||
default:
|
default:
|
||||||
if (id >= kPidCC0 && id <= kPidCCLast) {
|
if (id >= kPidCC0 && id <= kPidCCLast) {
|
||||||
int32 ccNumber = static_cast<int32>(id - kPidCC0);
|
int32 ccNumber = static_cast<int32>(id - kPidCC0);
|
||||||
synth.hdcc(sampleOffset, ccNumber, value);
|
synth.automateHdcc(sampleOffset, ccNumber, value);
|
||||||
_state.controllers[ccNumber] = value;
|
_state.controllers[ccNumber] = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -518,7 +518,7 @@ void SfizzVstProcessor::processMessagesFromUi()
|
||||||
synth.noteOn(0, data[1] & 0x7f, data[2] & 0x7f);
|
synth.noteOn(0, data[1] & 0x7f, data[2] & 0x7f);
|
||||||
break;
|
break;
|
||||||
case 0xb0:
|
case 0xb0:
|
||||||
synth.cc(0, data[1] & 0x7f, data[2] & 0x7f);
|
synth.automateHdcc(0, data[1] & 0x7f, (data[2] & 0x7f) / 127.0f);
|
||||||
break;
|
break;
|
||||||
case 0xe0:
|
case 0xe0:
|
||||||
synth.pitchWheel(0, (data[2] << 7) + data[1] - 8192);
|
synth.pitchWheel(0, (data[2] << 7) + data[1] - 8192);
|
||||||
|
|
@ -713,7 +713,7 @@ void SfizzVstProcessor::loadSfzFileOrDefault(const std::string& filePath, bool i
|
||||||
for (uint32 cc = 0; cc < sfz::config::numCCs; ++cc) {
|
for (uint32 cc = 0; cc < sfz::config::numCCs; ++cc) {
|
||||||
if (absl::optional<float> value = oldControllers[cc]) {
|
if (absl::optional<float> value = oldControllers[cc]) {
|
||||||
newControllers[cc] = *value;
|
newControllers[cc] = *value;
|
||||||
synth.hdcc(0, int(cc), *value);
|
synth.automateHdcc(0, int(cc), *value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue