Analog generator Sustain ctl does not turn off once turned on.

Found a bug? Post it here.
Post Reply
Ol sen
Posts: 20
Joined: Sat Feb 12, 2022 6:26 am

Analog generator Sustain ctl does not turn off once turned on.

Post by Ol sen »

When Sustain ctl in Analog generator is turned on it does of course play Sustain on its defined voices, turning it off again does never turn off such voice - leading to permanent sound. Guessing note off events could stop it, did not check, but if Sustain is turned off shall it not turn off then, no matter how many voices work? Would consider this a bug. Agree?

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.
this allows to set Sustain on and also off again.. no steady notes playing then unless you want it.

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.
Post Reply