zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 268911377d0feaed03ae199c9ba835d07f70407d
parent 1f7e0049042dafcf0dae7691b779585ccbd69ab5
Author: Johannes Lorenz <j.git@lorenz-ho.me>
Date:   Sun, 16 Apr 2023 14:43:46 +0200

Fix: Update Penvpoints on envdt/Penvval change

Diffstat:
Msrc/Params/EnvelopeParams.cpp | 64++++++++++++++++++++++++++++++++++------------------------------
1 file changed, 34 insertions(+), 30 deletions(-)

diff --git a/src/Params/EnvelopeParams.cpp b/src/Params/EnvelopeParams.cpp @@ -102,35 +102,6 @@ static const rtosc::Ports localPorts = { rDepends(Pfreemode), rDefault(2), "Location of the sustain point"), - rParamsDT(envdt, MAX_ENVELOPE_POINTS, rProp(alias), "Envelope Delay Times"), - rArrayF(envdt, MAX_ENVELOPE_POINTS, rProp(parameter), - rEnabledBy(Pfreemode), - rDefault([0.0 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rPreset(ad_voice_freq, [0.00 (0x0p+0) 0.13 (0x1.041894p-3) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rPreset(ad_voice_amp, [0.00 (0x0p+0) 0.00 (0x0p+0) 6.98 (0x1.be978ep+2) 6.98 (0x1.be978ep+2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rPreset(ad_voice_filter, [0.00 (0x0p+0) 0.97 (0x1.f0a3d8p-1) 0.97 (0x1.f0a3d8p-1) 0.01 (0x1.26e978p-7) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rPreset(ad_voice_fm_freq, [0.00 (0x0p+0) 3.62 (0x1.cf5c28p+1) 1.88 (0x1.e0418ap+0) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rPreset(ad_voice_fm_amp, [0.00 (0x0p+0) 1.88 (0x1.e0418ap+0) 3.62 (0x1.cf5c28p+1) 6.98 (0x1.be978ep+2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rPreset(ad_global_freq, [0.00 (0x0p+0) 0.25 (0x1.041894p-2) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rPreset(ad_global_amp, [0.00 (0x0p+0) 0.00 (0x0p+0) 0.13 (0x1.041894p-3) 0.04 (0x1.4fdf3cp-5) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rPreset(ad_global_filter, [0.00 (0x0p+0) 0.13 (0x1.041894p-3) 0.97 (0x1.f0a3d8p-1) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rPreset(sub_freq, [0.00 (0x0p+0) 0.25 (0x1.041894p-2) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rPreset(sub_bandwidth, [0.00 (0x0p+0) 0.97 (0x1.f0a3d8p-1) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rPreset(sub_filter, [0.00 (0x0p+0) 0.13 (0x1.041894p-3) 0.97 (0x1.f0a3d8p-1) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), - rDefaultDepends(loc), rDepends(Pfreemode,A_dt,D_dt,R_dt), - "Envelope Delay Times (ms)"), - rParams(Penvval, MAX_ENVELOPE_POINTS, - rEnabledBy(Pfreemode), - rDefault([64 64 ...]), - rPreset(ad_global_amp, [0 127 127 0 64 64 ...]), - rPreset(ad_voice_amp, [0 127 127 0 64 64 ...]), - rPreset(ad_voice_fm_amp, [0 127 127 0 64 64 ...]), - rPreset(ad_voice_fm_freq, [20 64 40 64 64 ...]), - rPreset(ad_voice_freq, [30 64 64 ...]), - rPreset(ad_voice_filter, [90 40 64 40 64 64 ...]), - rPreset(sub_bandwidth, [100 64 64 ...]), - rPreset(sub_freq, [30 64 64 ...]), - rDefaultDepends(loc) rDepends(Penvpoints,Pfreemode,PA_val,PD_val,PS_val,PR_val), "Envelope Values"), rParamZyn(Penvstretch, rShort("stretch"), rDefaultDepends(loc), rPresetAtMulti(0, ad_global_freq, ad_global_filter, ad_voice_freq, ad_voice_filter, ad_voice_fm_freq, @@ -197,6 +168,40 @@ static const rtosc::Ports localPorts = { rPresetAtMulti(40, ad_voice_filter, ad_voice_fm_freq), rDefault(64), "Release Value"), +#undef rChangeCb +#define rChangeCb if(!obj->Pfreemode) obj->converttofree(); \ + if(obj->time) { obj->last_update_timestamp = obj->time->time(); } \ + if(idx >= obj->Penvpoints) { obj->Penvpoints = idx + 1; } + rParamsDT(envdt, MAX_ENVELOPE_POINTS, rProp(alias), "Envelope Delay Times"), + rArrayF(envdt, MAX_ENVELOPE_POINTS, rProp(parameter), + rEnabledBy(Pfreemode), + rDefault([0.0 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rPreset(ad_voice_freq, [0.00 (0x0p+0) 0.13 (0x1.041894p-3) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rPreset(ad_voice_amp, [0.00 (0x0p+0) 0.00 (0x0p+0) 6.98 (0x1.be978ep+2) 6.98 (0x1.be978ep+2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rPreset(ad_voice_filter, [0.00 (0x0p+0) 0.97 (0x1.f0a3d8p-1) 0.97 (0x1.f0a3d8p-1) 0.01 (0x1.26e978p-7) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rPreset(ad_voice_fm_freq, [0.00 (0x0p+0) 3.62 (0x1.cf5c28p+1) 1.88 (0x1.e0418ap+0) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rPreset(ad_voice_fm_amp, [0.00 (0x0p+0) 1.88 (0x1.e0418ap+0) 3.62 (0x1.cf5c28p+1) 6.98 (0x1.be978ep+2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rPreset(ad_global_freq, [0.00 (0x0p+0) 0.25 (0x1.041894p-2) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rPreset(ad_global_amp, [0.00 (0x0p+0) 0.00 (0x0p+0) 0.13 (0x1.041894p-3) 0.04 (0x1.4fdf3cp-5) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rPreset(ad_global_filter, [0.00 (0x0p+0) 0.13 (0x1.041894p-3) 0.97 (0x1.f0a3d8p-1) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rPreset(sub_freq, [0.00 (0x0p+0) 0.25 (0x1.041894p-2) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rPreset(sub_bandwidth, [0.00 (0x0p+0) 0.97 (0x1.f0a3d8p-1) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rPreset(sub_filter, [0.00 (0x0p+0) 0.13 (0x1.041894p-3) 0.97 (0x1.f0a3d8p-1) 0.50 (0x1.fef9dcp-2) 0.07 (0x1.242124p-4) 0.07 (0x1.242124p-4) ...]), + rDefaultDepends(loc), rDepends(Pfreemode,A_dt,D_dt,R_dt), + "Envelope Delay Times (ms)"), + rParams(Penvval, MAX_ENVELOPE_POINTS, + rEnabledBy(Pfreemode), + rDefault([64 64 ...]), + rPreset(ad_global_amp, [0 127 127 0 64 64 ...]), + rPreset(ad_voice_amp, [0 127 127 0 64 64 ...]), + rPreset(ad_voice_fm_amp, [0 127 127 0 64 64 ...]), + rPreset(ad_voice_fm_freq, [20 64 40 64 64 ...]), + rPreset(ad_voice_freq, [30 64 64 ...]), + rPreset(ad_voice_filter, [90 40 64 40 64 64 ...]), + rPreset(sub_bandwidth, [100 64 64 ...]), + rPreset(sub_freq, [30 64 64 ...]), + rDefaultDepends(loc) rDepends(Penvpoints,Pfreemode,PA_val,PD_val,PS_val,PR_val), "Envelope Values"), +#undef rChangeCb {"Envmode:", rDoc("Envelope variant type"), NULL, rBegin; d.reply(d.loc, "i", env->Envmode); @@ -293,7 +298,6 @@ static const rtosc::Ports localPorts = { rEnd}, }; -#undef rChangeCb const rtosc::Ports &EnvelopeParams::ports = localPorts;