Other improvements and bugfixes on Unison.
(cherry picked from commit 461cb023b98c17708a1bc605416b9bd5fec81224)
This commit is contained in:
@@ -902,5 +902,5 @@
|
||||
23 Sep 2009 (Paul Nasca)
|
||||
- Added unison invert phase
|
||||
- Made unison frequency spread to depend on Bandwidth controllers and parameters
|
||||
- bugfixes: Voice Amplitude Envelope and FM
|
||||
|
||||
- Added unison vibratto speed control and other improvements
|
||||
- bugfixes: Voice Amplitude Envelope and FM
|
||||
@@ -102,6 +102,7 @@ void ADnoteParameters::defaults(int n)
|
||||
VoicePar[nvoice].Unison_frequency_spread=30;
|
||||
VoicePar[nvoice].Unison_stereo_spread=64;
|
||||
VoicePar[nvoice].Unison_vibratto=64;
|
||||
VoicePar[nvoice].Unison_vibratto_speed=64;
|
||||
VoicePar[nvoice].Unison_invert_phase=0;
|
||||
|
||||
VoicePar[nvoice].Type=0;
|
||||
@@ -199,6 +200,16 @@ REALTYPE ADnoteParameters::getBandwidthDetuneMultiplier()
|
||||
return(bw);
|
||||
};
|
||||
|
||||
/*
|
||||
* Get the unison spread in cents for a voice
|
||||
*/
|
||||
|
||||
REALTYPE ADnoteParameters::getUnisonFrequencySpreadCents(int nvoice){
|
||||
REALTYPE unison_spread=VoicePar[nvoice].Unison_frequency_spread/127.0;
|
||||
unison_spread=pow(unison_spread*2.0,2.0)*100.0;//cents
|
||||
return unison_spread;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Kill the voice
|
||||
@@ -286,6 +297,7 @@ void ADnoteParameters::add2XMLsection(XMLwrapper *xml,int n)
|
||||
xml->addpar("unison_frequency_spread",VoicePar[nvoice].Unison_frequency_spread);
|
||||
xml->addpar("unison_stereo_spread",VoicePar[nvoice].Unison_stereo_spread);
|
||||
xml->addpar("unison_vibratto",VoicePar[nvoice].Unison_vibratto);
|
||||
xml->addpar("unison_vibratto_speed",VoicePar[nvoice].Unison_vibratto_speed);
|
||||
xml->addpar("unison_invert_phase",VoicePar[nvoice].Unison_invert_phase);
|
||||
|
||||
xml->addpar("delay",VoicePar[nvoice].PDelay);
|
||||
@@ -568,6 +580,7 @@ void ADnoteParameters::getfromXMLsection(XMLwrapper *xml,int n)
|
||||
VoicePar[nvoice].Unison_frequency_spread=xml->getpar127("unison_frequency_spread",VoicePar[nvoice].Unison_frequency_spread);
|
||||
VoicePar[nvoice].Unison_stereo_spread=xml->getpar127("unison_stereo_spread",VoicePar[nvoice].Unison_stereo_spread);
|
||||
VoicePar[nvoice].Unison_vibratto=xml->getpar127("unison_vibratto",VoicePar[nvoice].Unison_vibratto);
|
||||
VoicePar[nvoice].Unison_vibratto_speed=xml->getpar127("unison_vibratto_speed",VoicePar[nvoice].Unison_vibratto_speed);
|
||||
VoicePar[nvoice].Unison_invert_phase=xml->getpar127("Unison_invert_phase",VoicePar[nvoice].Unison_invert_phase);
|
||||
|
||||
VoicePar[nvoice].Type=xml->getpar127("type",VoicePar[nvoice].Type);
|
||||
|
||||
@@ -128,6 +128,9 @@ struct ADnoteVoiceParam {
|
||||
/** Vibratto of the subvoices (which makes the unison more "natural")*/
|
||||
unsigned char Unison_vibratto;
|
||||
|
||||
/** Medium speed of the vibratto of the subvoices*/
|
||||
unsigned char Unison_vibratto_speed;
|
||||
|
||||
/** Unison invert phase */
|
||||
unsigned char Unison_invert_phase;//0=none,1=random,2=50%,3=33%,4=25%
|
||||
|
||||
@@ -285,6 +288,7 @@ public:
|
||||
void getfromXML(XMLwrapper *xml);
|
||||
|
||||
REALTYPE getBandwidthDetuneMultiplier();
|
||||
REALTYPE getUnisonFrequencySpreadCents(int nvoice);
|
||||
int get_unison_size_index(int nvoice);
|
||||
void set_unison_size_index(int nvoice,int index);
|
||||
private:
|
||||
|
||||
@@ -107,8 +107,7 @@ ADnote::ADnote(ADnoteParameters *pars,Controller *ctl_,REALTYPE freq,REALTYPE ve
|
||||
unison_base_freq_rap[nvoice]=new REALTYPE[unison];
|
||||
unison_freq_rap[nvoice]=new REALTYPE[unison];
|
||||
unison_invert_phase[nvoice]=new bool[unison];
|
||||
REALTYPE unison_spread=pars->VoicePar[nvoice].Unison_frequency_spread/127.0;
|
||||
unison_spread=pow(unison_spread*2.0,2.0)*100.0;//cents
|
||||
REALTYPE unison_spread=pars->getUnisonFrequencySpreadCents(nvoice);
|
||||
REALTYPE unison_real_spread=pow(2.0,(unison_spread*0.5)/1200.0);
|
||||
REALTYPE unison_vibratto_a=pars->VoicePar[nvoice].Unison_vibratto/127.0;//0.0 .. 1.0
|
||||
|
||||
@@ -151,10 +150,10 @@ ADnote::ADnote(ADnoteParameters *pars,Controller *ctl_,REALTYPE freq,REALTYPE ve
|
||||
unison_vibratto[nvoice].amplitude=(unison_real_spread-1.0)*unison_vibratto_a*0.5;
|
||||
|
||||
REALTYPE increments_per_second=SAMPLE_RATE/(REALTYPE)SOUND_BUFFER_SIZE;
|
||||
REALTYPE vibratto_base_period=0.25*pow(2.0,(1.0-pars->VoicePar[nvoice].Unison_vibratto_speed/127.0)*4.0);
|
||||
for (int k=0;k<unison;k++){
|
||||
unison_vibratto[nvoice].position[k]=RND*0.9-0.45;
|
||||
REALTYPE vibratto_period=0.5+RND*2.5;
|
||||
|
||||
REALTYPE vibratto_period=vibratto_base_period*pow(2.0,RND*2.0-1.0);//make period to vary randomly from 50% to 200% vibratto base period
|
||||
|
||||
unison_vibratto[nvoice].position[k]=0;
|
||||
REALTYPE m=4.0/(vibratto_period*increments_per_second);
|
||||
|
||||
@@ -553,17 +553,11 @@ voiceonbutton->redraw();} open
|
||||
} {
|
||||
Fl_Dial {} {
|
||||
label Stereo
|
||||
callback {pars->VoicePar[nvoice].Unison_stereo_spread=(int)o->value();}
|
||||
tooltip {Stereo Spread} xywh {265 540 25 25} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
|
||||
callback {pars->VoicePar[nvoice].Unison_stereo_spread=(int)o->value();} selected
|
||||
tooltip {Stereo Spread} xywh {285 540 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
|
||||
}
|
||||
Fl_Value_Slider {} {
|
||||
label {Frequency Spread}
|
||||
callback {pars->VoicePar[nvoice].Unison_frequency_spread=(int)o->value();}
|
||||
tooltip {Frequency Spread of the Unison} xywh {90 548 155 17} type {Horz Knob} box FLAT_BOX labelsize 11 align 5 maximum 127 step 1 value 64
|
||||
code0 {o->value(pars->VoicePar[nvoice].Unison_frequency_spread);}
|
||||
}
|
||||
Fl_Choice {} {
|
||||
label Unison
|
||||
callback {pars->set_unison_size_index(nvoice,(int) o->value());} open
|
||||
@@ -574,17 +568,37 @@ voiceonbutton->redraw();} open
|
||||
Fl_Dial {} {
|
||||
label Vibratto
|
||||
callback {pars->VoicePar[nvoice].Unison_vibratto=(int)o->value();}
|
||||
tooltip Vibratto xywh {340 540 25 25} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
|
||||
tooltip Vibratto xywh {340 540 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
|
||||
code0 {o->value(pars->VoicePar[nvoice].Unison_vibratto);}
|
||||
class WidgetPDial
|
||||
}
|
||||
Fl_Choice {} {
|
||||
label Invert
|
||||
callback {pars->VoicePar[nvoice].Unison_invert_phase=(int) o->value();} open selected
|
||||
tooltip {Phase Invert} xywh {425 545 70 15} down_box BORDER_BOX labelsize 11 align 5 textfont 1 textsize 10
|
||||
callback {pars->VoicePar[nvoice].Unison_invert_phase=(int) o->value();} open
|
||||
tooltip {Phase Invert} xywh {445 545 65 15} down_box BORDER_BOX labelsize 11 align 5 textfont 1 textsize 10
|
||||
code0 {o->add("None");o->add("Random");char tmp[100];for (int i=2;i<=5;i++){snprintf(tmp,100,"%d %%",100/i);o->add(tmp);};}
|
||||
code1 {o->value(pars->VoicePar[nvoice].Unison_invert_phase);}
|
||||
} {}
|
||||
Fl_Slider {} {
|
||||
label {Frequency Spread}
|
||||
callback {pars->VoicePar[nvoice].Unison_frequency_spread=(int)o->value();
|
||||
unisonspreadoutput->do_callback();}
|
||||
tooltip {Frequency Spread of the Unison} xywh {95 547 125 13} type {Horz Knob} box FLAT_BOX labelsize 12 align 1 maximum 127 step 1 value 64
|
||||
code0 {o->value(pars->VoicePar[nvoice].Unison_frequency_spread);}
|
||||
}
|
||||
Fl_Value_Output unisonspreadoutput {
|
||||
label {(cents)}
|
||||
callback {o->value(pars->getUnisonFrequencySpreadCents(nvoice));}
|
||||
xywh {225 545 40 15} labelsize 10 align 5 maximum 1000 step 0.1 textfont 1 textsize 10
|
||||
code0 {o->value(pars->getUnisonFrequencySpreadCents(nvoice));}
|
||||
}
|
||||
Fl_Dial {} {
|
||||
label {Vib.speed}
|
||||
callback {pars->VoicePar[nvoice].Unison_vibratto_speed=(int)o->value();}
|
||||
tooltip {Vibratto Average Speed} xywh {390 540 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_Group {} {
|
||||
|
||||
Reference in New Issue
Block a user