zynaddsubfx

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

commit 646501b6c6970c27880221a37b54a7702710ea04
parent 97b4f97c87782e3eeeda3b31b605a6a7d8c0d407
Author: Christopher A. Oliver <[email protected]>
Date:   Fri, 13 Nov 2015 00:08:02 -0500

Support the V.SnsA and V.Sns knobs in individual voices.
Default to zero V.SnsA to preserve the sound of old patches.

Diffstat:
Msrc/Params/ADnoteParameters.cpp | 13+++++++++++++
Msrc/Params/ADnoteParameters.h | 8+++++++-
Msrc/Synth/ADnote.cpp | 13+++++++++++--
Msrc/UI/ADnoteUI.fl | 2+-
Msrc/UI/Fl_Osc_Dial.cpp | 10++++++++--
5 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/src/Params/ADnoteParameters.cpp b/src/Params/ADnoteParameters.cpp @@ -111,6 +111,8 @@ static const Ports voicePorts = { rToggle(PFilterEnabled, "Filter Enable"), rToggle(PFilterEnvelopeEnabled, "Filter Envelope Enable"), rToggle(PFilterLfoEnabled, "Filter LFO Enable"), + rParamZyn(PFilterVelocityScale, "Filter Velocity Magnitude"), + rParamZyn(PFilterVelocityScaleFunction, "Filter Velocity Function Shape"), //Modulator Stuff @@ -428,6 +430,8 @@ void ADnoteVoiceParam::defaults() PFilterEnabled = 0; PFilterEnvelopeEnabled = 0; PFilterLfoEnabled = 0; + PFilterVelocityScale = 0; + PFilterVelocityScaleFunction = 64; PFMEnabled = 0; //I use the internal oscillator (-1) @@ -664,6 +668,8 @@ void ADnoteVoiceParam::add2XML(XMLwrapper *xml, bool fmoscilused) if((PFilterEnabled != 0) || (!xml->minimal)) { xml->beginbranch("FILTER_PARAMETERS"); + xml->addpar("velocity_sensing_amplitude", PFilterVelocityScale); + xml->addpar("velocity_sensing", PFilterVelocityScaleFunction); xml->beginbranch("FILTER"); VoiceFilter->add2XML(xml); xml->endbranch(); @@ -974,6 +980,8 @@ void ADnoteVoiceParam::paste(ADnoteVoiceParam &a) RCopy(FilterEnvelope); copy(PFilterLfoEnabled); + copy(PFilterVelocityScale); + copy(PFilterVelocityScaleFunction); RCopy(FilterLfo); @@ -1115,6 +1123,11 @@ void ADnoteVoiceParam::getfromXML(XMLwrapper *xml, unsigned nvoice) } if(xml->enterbranch("FILTER_PARAMETERS")) { + PFilterVelocityScale = xml->getpar127("velocity_sensing_amplitude", + PFilterVelocityScale); + PFilterVelocityScaleFunction = xml->getpar127( + "velocity_sensing", + PFilterVelocityScaleFunction); if(xml->enterbranch("FILTER")) { VoiceFilter->getfromXML(xml); xml->exitbranch(); diff --git a/src/Params/ADnoteParameters.h b/src/Params/ADnoteParameters.h @@ -240,10 +240,16 @@ struct ADnoteVoiceParam { unsigned char PFilterEnvelopeEnabled; EnvelopeParams *FilterEnvelope; - /* LFO Envelope */ + /* Filter LFO */ unsigned char PFilterLfoEnabled; LFOParams *FilterLfo; + // filter velocity sensing + unsigned char PFilterVelocityScale; + + // filter velocity sensing + unsigned char PFilterVelocityScaleFunction; + /**************************** * MODULLATOR PARAMETERS * ****************************/ diff --git a/src/Synth/ADnote.cpp b/src/Synth/ADnote.cpp @@ -317,7 +317,11 @@ ADnote::ADnote(ADnoteParameters *pars_, SynthParams &spars) NoteVoicePar[nvoice].FilterLfo = NULL; NoteVoicePar[nvoice].FilterCenterPitch = - pars.VoicePar[nvoice].VoiceFilter->getfreq(); + pars.VoicePar[nvoice].VoiceFilter->getfreq() + + pars.VoicePar[nvoice].PFilterVelocityScale + / 127.0f * 6.0f //velocity sensing + * (VelF(velocity, + pars.VoicePar[nvoice].PFilterVelocityScaleFunction) - 1); NoteVoicePar[nvoice].filterbypass = pars.VoicePar[nvoice].Pfilterbypass; @@ -511,7 +515,12 @@ void ADnote::legatonote(LegatoParams lpars) NoteVoicePar[nvoice].FilterCenterPitch = - pars.VoicePar[nvoice].VoiceFilter->getfreq(); + pars.VoicePar[nvoice].VoiceFilter->getfreq() + + pars.VoicePar[nvoice].PFilterVelocityScale + / 127.0f * 6.0f //velocity sensing + * (VelF(velocity, + pars.VoicePar[nvoice].PFilterVelocityScaleFunction) - 1); + NoteVoicePar[nvoice].filterbypass = pars.VoicePar[nvoice].Pfilterbypass; diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl @@ -764,7 +764,7 @@ o->redraw();} Fl_Group {} { label {ADsynth Voice - Filter} open xywh {250 30 275 75} box FLAT_BOX color 50 align 144 - code0 {o->init("", osc_i, loc, "VoiceFilter/");} + code0 {o->init(loc + "PFilter", osc_i, loc, "VoiceFilter/");} class FilterUI } {} Fl_Group voicefilterenvgroup { diff --git a/src/UI/Fl_Osc_Dial.cpp b/src/UI/Fl_Osc_Dial.cpp @@ -111,6 +111,8 @@ void Fl_Osc_Dial::mark_dead(void) dead = true; } +#define VEL_PFX "VelocityScale" + void Fl_Osc_Dial::rebase(std::string new_base) { if(dead || loc == "/") @@ -141,8 +143,12 @@ void Fl_Osc_Dial::rebase(std::string new_base) } std::string new_loc = new_base.substr(0, match_pos+1); - printf("Moving '%s' to\n", (loc+ext).c_str()); - printf(" '%s'\n", (new_loc+ext).c_str()); + if (!strncmp(ext.c_str(), VEL_PFX, sizeof(VEL_PFX)-1) && + strstr(loc.c_str(), "/VoicePar")) + new_loc = new_loc + "PFilter"; + // printf("Moving '%s' to\n", (loc+ext).c_str()); + // printf(" '%s'\n", (new_loc+ext).c_str()); + // printf("Ext: %s\n", ext.c_str()); oscMove(loc+ext, new_loc+ext); loc = new_loc; }