commit f346d5cc73544f46447d8f727a82e31a4b7e584a
parent a30a36cc88334889b62c5c113af471029094ae5f
Author: paulnasca <paulnasca>
Date: Thu, 24 Jun 2004 17:36:27 +0000
*** empty log message ***
Diffstat:
4 files changed, 39 insertions(+), 60 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -594,6 +594,7 @@
- Adaugata posibilitatea de draw la armonicele OscilGen daca se apasa tasta Shift
- Corectata o mica eroare care facea imposibila modificarea amplitudinii armonicelor cu tastatura
- Adaugat randomness de grup (adica se aplica acelasi randomness la toate vocile care folosesc acelasi oscilator)
-
+24 Iun 2004 - Inlaturat setara de normalize la OscilGen. Intotdeauna normalize este Full RMS
+
diff --git a/src/Synth/OscilGen.C b/src/Synth/OscilGen.C
@@ -49,7 +49,7 @@ OscilGen::~OscilGen(){
void OscilGen::defaults(){
- oldbasefunc=0;oldbasepar=64;oldhmagtype=0;oldwaveshapingfunction=0;oldwaveshaping=64,oldnormalizemethod=0;
+ oldbasefunc=0;oldbasepar=64;oldhmagtype=0;oldwaveshapingfunction=0;oldwaveshaping=64;
oldbasefuncmodulation=0;oldharmonicshift=0;oldbasefuncmodulationpar1=0;oldbasefuncmodulationpar2=0;oldbasefuncmodulationpar3=0;
oldmodulation=0;oldmodulationpar1=0;oldmodulationpar2=0;oldmodulationpar3=0;
for (int i=0;i<MAX_AD_HARMONICS;i++){
@@ -77,7 +77,6 @@ void OscilGen::defaults(){
Pwaveshapingfunction=0;
Pwaveshaping=64;
- Pnormalizemethod=2;
Pfiltertype=0;
Pfilterpar=64;
Pfilterbeforews=0;
@@ -372,13 +371,16 @@ void OscilGen::oscilfilter(){
gain=cos(x*PI)+1.5;//low shelf
break;
};
+
+
oscilFFTfreqs[OSCIL_SIZE-i]*=gain;
oscilFFTfreqs[i]*=gain;
REALTYPE tmp=oscilFFTfreqs[OSCIL_SIZE-i]*oscilFFTfreqs[OSCIL_SIZE-i]+
oscilFFTfreqs[i]*oscilFFTfreqs[i];
if (max<tmp) max=tmp;
};
-
+
+ max=sqrt(max);
if (max<1e-10) max=1.0;
for (int i=1;i<OSCIL_SIZE;i++) oscilFFTfreqs[i]/=max;
};
@@ -681,7 +683,7 @@ void OscilGen::prepare(){
spectrumadjust();
if (Pharmonicshiftfirst==0) shiftharmonics();
- //normalize (sum or RMS) - the "Full RMS" normalisation is located in the "::get()" function
+/* //normalize (sum or RMS) - the "Full RMS" normalisation is located in the "::get()" function
if ((Pnormalizemethod==0)||(Pnormalizemethod==1)){
REALTYPE sum=0;
for (j=1;j<OSCIL_SIZE/2;j++) {
@@ -689,12 +691,12 @@ void OscilGen::prepare(){
if (Pnormalizemethod==0) sum+=sqrt(term);
else sum+=term;
};
- if (sum<0.000001) sum=1.0;
+ if (sum<0.00000001) sum=1.0;
if (Pnormalizemethod==1) sum=sqrt(sum)*2.0;
sum*=0.5;
for (j=1;j<OSCIL_SIZE;j++) oscilFFTfreqs[j]/=sum;
};
-
+*/
oscilFFTfreqs[0]=0.0;//remove the DC
if (ANTI_ALIAS==0) {
@@ -706,7 +708,7 @@ void OscilGen::prepare(){
delete(tmp);
};
oldhmagtype=Phmagtype;
- oldnormalizemethod=Pnormalizemethod;
+// oldnormalizemethod=Pnormalizemethod;
oldharmonicshift=Pharmonicshift+Pharmonicshiftfirst*256;
oscilprepared=1;
@@ -791,7 +793,6 @@ short int OscilGen::get(REALTYPE *smps,REALTYPE freqHz,int resonance){
if ((oldbasepar!=Pbasefuncpar)||(oldbasefunc!=Pcurrentbasefunc)||(oldhmagtype!=Phmagtype)
||(oldwaveshaping!=Pwaveshaping)||(oldwaveshapingfunction!=Pwaveshapingfunction)) oscilprepared=0;
- if (oldnormalizemethod!=Pnormalizemethod) oscilprepared=0;
if (oldfilterpars!=Pfiltertype*256+Pfilterpar+Pfilterbeforews*65536){
oscilprepared=0;
oldfilterpars=Pfiltertype*256+Pfilterpar+Pfilterbeforews*65536;
@@ -901,19 +902,16 @@ short int OscilGen::get(REALTYPE *smps,REALTYPE freqHz,int resonance){
if ((freqHz>0.1)&&(resonance!=0)) res->applyres(nyquist-1,outoscilFFTfreqs,freqHz);
//Full RMS normalize
- if (Pnormalizemethod==2){
- REALTYPE sum=0;
- for (int j=1;j<OSCIL_SIZE/2;j++) {
- REALTYPE term=outoscilFFTfreqs[j]*outoscilFFTfreqs[j]+outoscilFFTfreqs[OSCIL_SIZE-j]*outoscilFFTfreqs[OSCIL_SIZE-j];
- sum+=term;
- };
- if (sum<0.000001) sum=1.0;
- sum=sqrt(sum);
-
- if ((freqHz>0.1)&&(resonance!=0)&&(res->Penabled!=0)) sum/=dB2rap(res->Pgain*0.5);//apply the ressonance gain
-
- for (int j=1;j<OSCIL_SIZE;j++) outoscilFFTfreqs[j]/=sum;
- };
+ REALTYPE sum=0;
+ for (int j=1;j<OSCIL_SIZE/2;j++) {
+ REALTYPE term=outoscilFFTfreqs[j]*outoscilFFTfreqs[j]+outoscilFFTfreqs[OSCIL_SIZE-j]*outoscilFFTfreqs[OSCIL_SIZE-j];
+ sum+=term;
+ };
+ if (sum<0.000001) sum=1.0;
+ sum=sqrt(sum);
+ if ((freqHz>0.1)&&(resonance!=0)&&(res->Penabled!=0)) sum/=dB2rap(res->Pgain*0.5);//apply the ressonance gain
+ for (int j=1;j<OSCIL_SIZE;j++) outoscilFFTfreqs[j]/=sum;
+
// for (i=0;i<OSCIL_SIZE/2;i++) outoscilFFTfreqs[i+OSCIL_SIZE/2]*=-1.0;//correct the amplitude
@@ -1077,7 +1075,6 @@ void OscilGen::saveloadbuf(Buffer *buf){
buf->rwbyte(&tmp);//if tmp!=0xfe error
if (buf->getmode()==0){
- Pnormalizemethod=0;
for (nharmonic=0;nharmonic<MAX_AD_HARMONICS;nharmonic++){
Phmag[nharmonic]=64;
Phphase[nharmonic]=64;
@@ -1151,8 +1148,8 @@ void OscilGen::saveloadbuf(Buffer *buf){
};
break;
- case 0x88: buf->rwbytepar(n,&Pnormalizemethod);
- break;
+// case 0x88: buf->rwbytepar(n,&Pnormalizemethod);
+// break;
case 0x89: buf->rwbytepar(n,&Pfiltertype);
break;
case 0x8A: buf->rwbytepar(n,&Pfilterpar);
@@ -1185,7 +1182,6 @@ void OscilGen::saveloadbuf(Buffer *buf){
void OscilGen::add2XML(XMLwrapper *xml){
xml->addpar("harmonic_mag_type",Phmagtype);
- xml->addpar("normalize_method",Pnormalizemethod);
xml->addpar("base_function",Pcurrentbasefunc);
xml->addpar("base_function_par",Pbasefuncpar);
@@ -1255,7 +1251,7 @@ void OscilGen::add2XML(XMLwrapper *xml){
void OscilGen::getfromXML(XMLwrapper *xml){
Phmagtype=xml->getpar127("harmonic_mag_type",Phmagtype);
- Pnormalizemethod=xml->getpar127("normalize_method",Pnormalizemethod);
+// Pnormalizemethod=xml->getpar127("normalize_method",Pnormalizemethod);
Pcurrentbasefunc=xml->getpar127("base_function",Pcurrentbasefunc);
Pbasefuncpar=xml->getpar127("base_function_par",Pbasefuncpar);
diff --git a/src/Synth/OscilGen.h b/src/Synth/OscilGen.h
@@ -86,7 +86,6 @@ class OscilGen{
65..127 - each harmonic randomness - 127 is maximum*/
unsigned char Prand;
unsigned char Pwaveshaping,Pwaveshapingfunction;
- unsigned char Pnormalizemethod;
unsigned char Pfiltertype,Pfilterpar;
unsigned char Pfilterbeforews;
unsigned char Psatype,Psapar;//spectrum adjust
@@ -152,7 +151,7 @@ class OscilGen{
REALTYPE basefunc_sqr(REALTYPE x,REALTYPE a);
//Internal Data
- unsigned char oldbasefunc,oldbasepar,oldhmagtype,oldwaveshapingfunction,oldwaveshaping,oldnormalizemethod;
+ unsigned char oldbasefunc,oldbasepar,oldhmagtype,oldwaveshapingfunction,oldwaveshaping;
int oldfilterpars,oldsapars,oldbasefuncmodulation,oldbasefuncmodulationpar1,oldbasefuncmodulationpar2,oldbasefuncmodulationpar3,oldharmonicshift;
int oldmodulation,oldmodulationpar1,oldmodulationpar2,oldmodulationpar3;
/*
diff --git a/src/UI/OscilGenUI.fl b/src/UI/OscilGenUI.fl
@@ -328,7 +328,8 @@ delete(harmonic);} {}
decl {Master *master;} {}
}
-class OscilEditor {} {
+class OscilEditor {open
+} {
Function {make_window()} {} {
Fl_Window osceditUI {
label {ADsynth Oscillator Editor}
@@ -617,7 +618,7 @@ oldosc->redraw();}
xywh {678 557 62 28} box THIN_UP_BOX
}
Fl_Button {} {
- label Clr
+ label Clear
callback {if (!fl_ask("Clear the harmonics settings?")) return;
for (int i=0;i<MAX_AD_HARMONICS;i++){
@@ -642,7 +643,7 @@ pthread_mutex_unlock(&master->mutex);
oscildisplaygroup->redraw();
oldosc->redraw();}
- xywh {680 530 25 20} box THIN_UP_BOX labelfont 1 labelsize 12
+ xywh {680 500 55 20} box THIN_UP_BOX labelfont 1 labelsize 12
}
Fl_Group {} {
xywh {145 305 150 30} box ENGRAVED_BOX
@@ -818,24 +819,6 @@ oldosc->redraw();}
code0 {for (int i=0;i<MAX_AD_HARMONICS;i++){h[i]=new Oscilharmonic(0,0,20,o->h(),"");h[i]->init(oscil,i,oscildisplaygroup,oldosc,master);}}
} {}
}
- Fl_Choice normalizetype {
- label Normalize
- callback {oscil->Pnormalizemethod=(int) o->value();}
- tooltip {Normalize type (harmonic's sum/RMS) of the oscillator} xywh {680 415 60 20} down_box BORDER_BOX labelsize 10 align 5 textsize 10
- } {
- menuitem {} {
- label Sum
- xywh {65 65 100 20} labelfont 1 labelsize 10
- }
- menuitem {} {
- label RMS
- xywh {75 75 100 20} labelfont 1 labelsize 10
- }
- menuitem {} {
- label {F.RMS}
- xywh {85 85 100 20} labelfont 1 labelsize 10
- }
- }
Fl_Group {} {
xywh {600 305 130 30} box ENGRAVED_BOX
} {
@@ -898,15 +881,15 @@ oldosc->redraw();}
}
}
Fl_Group {} {
- xywh {675 440 65 85} box ENGRAVED_FRAME
+ xywh {675 400 65 90} box ENGRAVED_FRAME
} {
Fl_Box {} {
label {Adaptive Harmonics}
- xywh {680 440 60 25} labelsize 10 align 144
+ xywh {678 405 60 25} labelsize 10 align 144
}
Fl_Choice adhrtype {
callback {oscil->Padaptiveharmonics=(int) o->value();} open
- tooltip {The type of the addaptive harmonics} xywh {680 465 55 15} down_box BORDER_BOX labelsize 10 textsize 10
+ tooltip {The type of the addaptive harmonics} xywh {680 430 55 15} down_box BORDER_BOX labelsize 10 textsize 10
} {
menuitem {} {
label OFF
@@ -920,13 +903,13 @@ oldosc->redraw();}
Fl_Dial adhrpow {
label pow
callback {oscil->Padaptiveharmonicspower=(int)o->value();}
- tooltip {Adaptive harmonics power} xywh {710 485 25 25} labelsize 10 maximum 100 step 1
+ tooltip {Adaptive harmonics power} xywh {710 450 25 25} labelsize 10 maximum 100 step 1
class WidgetPDial
}
Fl_Dial adhrbf {
label baseF
callback {oscil->Padaptiveharmonicsbasefreq=(int)o->value();}
- tooltip {Adaptive harmonics base frequency} xywh {680 485 25 25} labelsize 10 maximum 255 step 1
+ tooltip {Adaptive harmonics base frequency} xywh {680 450 25 25} labelsize 10 maximum 255 step 1
class WidgetPDial
}
}
@@ -991,7 +974,7 @@ oscildisplaygroup->redraw();
oldosc->redraw();
refresh();}
- xywh {710 530 30 20} box THIN_UP_BOX labelfont 1 labelsize 12
+ xywh {680 530 55 20} box THIN_UP_BOX labelfont 1 labelsize 12
}
}
}
@@ -1009,7 +992,8 @@ osceditUI->show();} {}
for (int i=0;i<MAX_AD_HARMONICS;i++) delete (h[i]);
delete (osceditUI);} {}
}
- Function {refresh()} {} {
+ Function {refresh()} {open
+ } {
code {magtype->value(oscil->Phmagtype);
rndslider->value(oscil->Prand-64);
@@ -1044,8 +1028,6 @@ sadjpar->value(oscil->Psapar);
harmonicshiftcounter->value(oscil->Pharmonicshift);
harmonicshiftpre->value(oscil->Pharmonicshiftfirst);
-normalizetype->value(oscil->Pnormalizemethod);
-
adhrtype->value(oscil->Padaptiveharmonics);
adhrbf->value(oscil->Padaptiveharmonicsbasefreq);
adhrpow->value(oscil->Padaptiveharmonicspower);
@@ -1054,7 +1036,8 @@ for (int i=0;i<MAX_AD_HARMONICS;i++) h[i]->refresh();
basefuncdisplaygroup->redraw();
oscildisplaygroup->redraw();
-oldosc->redraw();} {}
+oldosc->redraw();} {selected
+ }
}
decl {OscilGen *oscil;} {}
decl {Fl_Widget *oldosc;} {}