zynaddsubfx

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

commit 33c0dc8e8ac1017268e21eaece018dadf7d644ab
parent 59f75bda3a467bb6dfe9a5c6d8d8ae354573c15b
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Mon, 16 Jun 2014 14:21:15 -0400

Add Unison Derandomization Control

Minorly modified portion of patch by Christopher Oliver

Diffstat:
Msrc/Params/ADnoteParameters.cpp | 4++++
Msrc/Params/ADnoteParameters.h | 3+++
Msrc/Params/PADnoteParameters.cpp | 3+++
Msrc/Synth/ADnote.cpp | 5++++-
Msrc/UI/ADnoteUI.fl | 41++++++++++++++++++++++++-----------------
Msrc/UI/PADnoteUI.fl | 6+++++-
6 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/src/Params/ADnoteParameters.cpp b/src/Params/ADnoteParameters.cpp @@ -127,6 +127,7 @@ void ADnoteVoiceParam::defaults() Unison_vibratto = 64; Unison_vibratto_speed = 64; Unison_invert_phase = 0; + Unison_phase_randomness = 127; Type = 0; Pfixedfreq = 0; @@ -351,6 +352,7 @@ void ADnoteVoiceParam::add2XML(XMLwrapper *xml, bool fmoscilused) xml->addpar("unison_vibratto", Unison_vibratto); xml->addpar("unison_vibratto_speed", Unison_vibratto_speed); xml->addpar("unison_invert_phase", Unison_invert_phase); + xml->addpar("unison_phase_randomness", Unison_phase_randomness); xml->addpar("delay", PDelay); xml->addparbool("resonance", Presonance); @@ -664,6 +666,8 @@ void ADnoteVoiceParam::getfromXML(XMLwrapper *xml, unsigned nvoice) Unison_vibratto_speed); Unison_invert_phase = xml->getpar127("unison_invert_phase", Unison_invert_phase); + Unison_phase_randomness = xml->getpar127("unison_phase_randomness", + Unison_phase_randomness); Type = xml->getpar127("type", Type); PDelay = xml->getpar127("delay", PDelay); diff --git a/src/Params/ADnoteParameters.h b/src/Params/ADnoteParameters.h @@ -133,6 +133,9 @@ struct ADnoteVoiceParam { /** How subvoices are spread */ unsigned char Unison_frequency_spread; + /** How much phase randomization */ + unsigned char Unison_phase_randomness; + /** Stereo spread of the subvoices*/ unsigned char Unison_stereo_spread; diff --git a/src/Params/PADnoteParameters.cpp b/src/Params/PADnoteParameters.cpp @@ -364,6 +364,9 @@ float PADnoteParameters::getNhr(int n) tmp = powf(par2 * 2.0f, 2.0f) + 0.1f; result = n0 * powf(1.0f + par1 * powf(n0 * 0.8f, tmp), tmp) + 1.0f; break; + case 7: + result = (n + Phrpos.par1 / 255.0f) / (Phrpos.par1 / 255.0f + 1); + break; default: result = n; break; diff --git a/src/Synth/ADnote.cpp b/src/Synth/ADnote.cpp @@ -302,7 +302,10 @@ ADnote::ADnote(ADnoteParameters *pars, for(int k = 0; k < unison; ++k) { oscposhi[nvoice][k] = oscposhi_start; - oscposhi_start = (int)(RND * (synth->oscilsize - 1)); //put random starting point for other subvoices + //put random starting point for other subvoices + oscposhi_start = + (int)(RND * pars->VoicePar[nvoice].Unison_phase_randomness / + 127.0f * (synth->oscilsize - 1)); } NoteVoicePar[nvoice].FreqLfo = NULL; diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl @@ -178,15 +178,15 @@ class ADvoiceUI {open : {public Fl_Group} } { Fl_Window ADnoteVoiceParameters { label Voice open - xywh {84 305 765 590} type Double box NO_BOX + xywh {863 89 765 595} type Double box NO_BOX class Fl_Group visible } { Fl_Group voiceparametersgroup {open - xywh {0 0 765 595} color 48 + xywh {0 0 770 590} color 48 code0 {if (pars->VoicePar[nvoice].Enabled==0) o->deactivate();} } { Fl_Group voicemodegroup {open - xywh {0 5 765 590} color 64 + xywh {0 5 770 585} color 64 } { Fl_Group voiceFMparametersgroup { label MODULATOR open @@ -549,12 +549,12 @@ voiceonbutton->redraw();} open code3 {o->value(pars->VoicePar[nvoice].Pextoscil+1);} } {} Fl_Group {} {open - xywh {5 540 515 45} box UP_FRAME + xywh {5 540 520 50} box UP_FRAME } { Fl_Dial {} { label Stereo callback {pars->VoicePar[nvoice].Unison_stereo_spread=(int)o->value();} - tooltip {Stereo Spread} xywh {285 555 25 30} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 + tooltip {Stereo Spread} xywh {322 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 code0 {o->value(pars->VoicePar[nvoice].Unison_stereo_spread);} class WidgetPDial } @@ -568,7 +568,7 @@ voiceonbutton->redraw();} open Fl_Dial {} { label Vibrato callback {pars->VoicePar[nvoice].Unison_vibratto=(int)o->value();} - tooltip Vibrato xywh {340 555 25 30} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 + tooltip Vibrato xywh {364 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 code0 {o->value(pars->VoicePar[nvoice].Unison_vibratto);} class WidgetPDial } @@ -593,12 +593,19 @@ unisonspreadoutput->do_callback();} code0 {o->value(pars->getUnisonFrequencySpreadCents(nvoice));} } Fl_Dial {} { - label {Vib.speed} - callback {pars->VoicePar[nvoice].Unison_vibratto_speed=(int)o->value();} - tooltip {Vibrato Average Speed} xywh {390 555 25 30} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 + label {V.speed} + callback {pars->VoicePar[nvoice].Unison_vibratto_speed=(int)o->value();} selected + tooltip {Vibrato Average Speed} xywh {406 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 code0 {o->value(pars->VoicePar[nvoice].Unison_vibratto_speed);} class WidgetPDial } + Fl_Dial {} { + label {Ph.rand} + callback {pars->VoicePar[nvoice].Unison_phase_randomness=(int)o->value();} + tooltip {Phase randomness} xywh {280 555 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1 + code0 {o->value(pars->VoicePar[nvoice].Unison_phase_randomness);} + class WidgetPDial + } } } Fl_Group {} { @@ -1021,10 +1028,10 @@ resui->resonancewindow->show();} } Fl_Window ADnoteVoice { label {ADsynth Voice Parameters} open - xywh {512 361 765 620} type Double visible + xywh {1142 229 765 630} type Double visible } { - Fl_Group advoice { - xywh {0 0 765 585} + Fl_Group advoice {open + xywh {0 0 765 595} code0 {o->init(pars,nvoice,master);} code1 {o->show();} class ADvoiceUI @@ -1032,7 +1039,7 @@ resui->resonancewindow->show();} Fl_Button {} { label {Close Window} callback {ADnoteVoice->hide();} - xywh {305 590 195 25} box THIN_UP_BOX labelfont 1 + xywh {305 601 195 25} box THIN_UP_BOX labelfont 1 } Fl_Counter currentvoicecounter { label {Current Voice} @@ -1040,23 +1047,23 @@ resui->resonancewindow->show();} advoice->hide(); ADnoteVoice->remove(advoice); delete advoice; -advoice=new ADvoiceUI(0,0,765,585); +advoice=new ADvoiceUI(0,0,765,590); ADnoteVoice->add(advoice); advoice->init(pars,nvoice,master); advoice->show(); ADnoteVoice->redraw();} - xywh {10 590 130 25} type Simple labelfont 1 align 8 minimum 0 maximum 2 step 1 value 1 textfont 1 textsize 13 + xywh {10 601 130 25} type Simple labelfont 1 align 8 minimum 0 maximum 2 step 1 value 1 textfont 1 textsize 13 code0 {o->bounds(1,NUM_VOICES);} } Fl_Button {} { label C callback {presetsui->copy(pars,nvoice);} - xywh {705 595 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 + xywh {705 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 } Fl_Button {} { label P callback {presetsui->paste(pars,this,nvoice);} - xywh {735 595 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 + xywh {735 609 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7 } } Fl_Window ADnoteVoiceList { diff --git a/src/UI/PADnoteUI.fl b/src/UI/PADnoteUI.fl @@ -242,7 +242,7 @@ make_window();} {} } { Fl_Window padnotewindow { label {PAD synth Parameters} open - xywh {294 392 535 435} type Double visible + xywh {288 386 535 435} type Double visible } { Fl_Tabs {} { callback {if (o->value()!=harmonicstructuregroup) applybutton->hide(); @@ -503,6 +503,10 @@ cbwidget->do_callback();} label Power xywh {120 120 100 20} labelfont 1 labelsize 11 } + MenuItem {} { + label Shift selected + xywh {130 130 100 20} labelfont 1 labelsize 11 + } } Fl_Dial hrpospar1 { label Par1