zynaddsubfx

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

commit 76f68a08f01d3a3cd4fd4bc0b75650ef4a9d4f99
parent 9507e7b4745af35312f980467031ff06633dd76b
Author: fundamental <[email protected]>
Date:   Tue, 22 Jun 2021 23:00:22 -0400

Revert "keep ENV knobs in sync in free mode"

This should revert:

commit c1f3eea3dc37bf8b226d00265e5b3b3c973a27b1
commit d0f92c122d3df827149c35e935edeaa6bf50335f

As written the two prior commits cause all sorts of visual
glitching in the fusion GUI.

Diffstat:
Msrc/Params/EnvelopeParams.cpp | 69++++-----------------------------------------------------------------
Msrc/Params/EnvelopeParams.h | 2--
2 files changed, 4 insertions(+), 67 deletions(-)

diff --git a/src/Params/EnvelopeParams.cpp b/src/Params/EnvelopeParams.cpp @@ -55,9 +55,7 @@ rArrayDT(name, length, __VA_ARGS__), \ #define rParamsDTCb(name, length) rBOIL_BEGIN \ char varS[length]; \ for (int i = 0; i < length; i++) {varS[i] = dT127(obj->name[i]);} \ - data.reply(loc, "b", length, varS); \ - rChangeCb \ - rBOIL_END + data.reply(loc, "b", length, varS); rBOIL_END #define rArrayDT(name, length, ...) \ {"P" STRINGIFY(name) "#" STRINGIFY(length) "::i", rProp(parameter) DOC(__VA_ARGS__), NULL, rArrayDTICb(name)} @@ -79,7 +77,7 @@ static const rtosc::Ports localPorts = { rPaste, #undef rChangeCb #define rChangeCb if(!obj->Pfreemode) obj->converttofree(); if (obj->time) { \ - obj->last_update_timestamp = obj->time->time(); } + obj->last_update_timestamp = obj->time->time(); } rOption(loc, rProp(internal), rOptions(ad_global_amp, ad_global_freq, ad_global_filter, ad_voice_amp, ad_voice_freq, ad_voice_filter, @@ -89,7 +87,6 @@ static const rtosc::Ports localPorts = { rToggle(Pfreemode, rDefault(false), "Complex Envelope Definitions"), #undef rChangeCb #define rChangeCb if(!obj->Pfreemode) obj->converttofree(); \ - else obj->updatenonfree(); \ if(obj->time) { obj->last_update_timestamp = obj->time->time(); } rParamZyn(Penvpoints, rProp(internal), rDefaultDepends(loc), rPresetAtMulti(3, ad_global_freq, ad_voice_freq, @@ -119,17 +116,6 @@ static const rtosc::Ports localPorts = { "Linear or Logarithmic Envelopes"), rToggle(Prepeating, rShort("repeat"), rDefault(false), "Repeat the Envelope"), -#undef rChangeCb -#define rChangeCb if(!obj->Pfreemode) obj->converttofree(); \ - else obj->updatefree(); \ - if(obj->time) { obj->last_update_timestamp = obj->time->time(); }\ - char part_loc[128]; \ - strncpy(part_loc, loc, sizeof(part_loc)); \ - part_loc[sizeof(part_loc) - 1] = '\0'; \ - char *end = strrchr(part_loc, '/'); \ - if(end) { \ - end[1] = '\0'; \ - data.broadcast("/damage", "s", part_loc);} rParamDT(A_dt , rShort("a.dt"), rLinear(0,127), "Attack Time"), rParamF(A_dt, rShort("a.dt"), rLog(0.0f,41.0f), rDefaultDepends(loc), rPreset(ad_global_freq, 0.254f), rPreset(ad_global_filter, 0.127f), @@ -138,6 +124,7 @@ static const rtosc::Ports localPorts = { rPreset(sub_freq, 0.254f), rPreset(sub_bandwidth, 0.970f), rDefault(0.0f), "Attack Time"), + rParamZyn(PA_val, rShort("a.val"), rDefaultDepends(loc), rPreset(ad_voice_freq, 30), rPreset(ad_voice_filter, 90), rPreset(ad_voice_fm_freq, 20), @@ -190,15 +177,6 @@ static const rtosc::Ports localPorts = { for(int i=0; i<N && i<M; ++i) { env->envdt[i] = (rtosc_argument(msg, i).f)/1000; //store as seconds in member variable } - env->updatenonfree(); - char part_loc[128]; - strncpy(part_loc, d.loc, sizeof(part_loc)); - part_loc[sizeof(part_loc) - 1] = '\0'; - char *end = strrchr(part_loc, '/'); - if(end) { - end[1] = '\0'; - d.broadcast("/damage", "s", part_loc); - } } rEnd}, {"dt", rDoc("Envelope Delay Times (sec)"), NULL, @@ -215,18 +193,8 @@ static const rtosc::Ports localPorts = { } d.replyArray(d.loc, arg_types, args); } else { - for(int i=0; i<N && i<M; ++i) { + for(int i=0; i<N && i<M; ++i) env->envdt[i] = (rtosc_argument(msg, i).f); - } - env->updatenonfree(); - char part_loc[128]; - strncpy(part_loc, d.loc, sizeof(part_loc)); - part_loc[sizeof(part_loc) - 1] = '\0'; - char *end = strrchr(part_loc, '/'); - if(end) { - end[1] = '\0'; - d.broadcast("/damage", "s", part_loc); - } } rEnd}, {"envval", rDoc("Envelope Values"), NULL, @@ -245,15 +213,6 @@ static const rtosc::Ports localPorts = { for(int i=0; i<N && i<M; ++i) { env->Penvval[i] = limit(roundf(rtosc_argument(msg,i).f*127.0f), 0.0f, 127.0f); } - env->updatenonfree(); - char part_loc[128]; - strncpy(part_loc, d.loc, sizeof(part_loc)); - part_loc[sizeof(part_loc) - 1] = '\0'; - char *end = strrchr(part_loc, '/'); - if(end) { - end[1] = '\0'; - d.broadcast("/damage", "s", part_loc); - } } rEnd}, @@ -505,27 +464,7 @@ void EnvelopeParams::converttofree() } } -void EnvelopeParams::updatefree() -{ - Penvval[0] = PA_val; - envdt[1] = A_dt; - envdt[Penvsustain] = D_dt; - Penvval[Penvsustain-1] = PD_val; - Penvval[Penvsustain] = PS_val; - envdt[Penvpoints-1] = R_dt; - Penvval[Penvpoints-1] = PR_val; -} -void EnvelopeParams::updatenonfree() -{ - PA_val = Penvval[0]; - A_dt = envdt[1]; - D_dt = envdt[Penvsustain]; - PD_val = Penvval[Penvsustain-1]; - PS_val = Penvval[Penvsustain]; - R_dt = envdt[Penvpoints-1]; - PR_val = Penvval[Penvpoints-1]; -} void EnvelopeParams::add2XML(XMLwrapper& xml) diff --git a/src/Params/EnvelopeParams.h b/src/Params/EnvelopeParams.h @@ -39,8 +39,6 @@ class EnvelopeParams:public Presets void init(consumer_location_t loc); void converttofree(); - void updatefree(); - void updatenonfree(); void add2XML(XMLwrapper& xml) override; void defaults();