guessing this should be your solution..
in psynth_generator2.cpp
Code: Select all
// in PS_CMD_SET_LOCAL_CONTROLLER the controlls are only set on data->ctl_channels rather then MAX_CHANNELS
// means it only applies to voices running, which in turn means controls are not set to voices which got reduced while playing
// which can lead to stuck settings per voice and together with sustain is a feature somehow: (intended or not - i dont know, you know )
// notice.. above this following line there seems to be a missing break; statement.. so GLOBAL CONTROLLERS are parsed when LOCALS are set..
case PS_CMD_SET_GLOBAL_CONTROLLER: {
gen2_options *opt = data->opt;
int v = event->controller.ctl_val;
switch (event->controller.ctl_num + 1) {
///added the following case
case 6: //SUSTAIN = 5+1
data->ctl_sustain = v; // store the new value
for (int c = 0; c < MAX_CHANNELS; c++) { //on all channels
data->channels[c].sustain = data->ctl_sustain; //apply new value
data->channels[c].f_sustain = data->ctl_sustain; //apply new value
}
retval = 1;
break;
// all other controllers.
Not sure if this is the proper solution as i did not fully read how your event loop works . But debug print, tells it is only triggered when i change the controller, which is what i was trying to solve.
have a nice saturday, cheers.