commit 5893d0652842c3cf050bd7103a4962f96853b460
parent 3c3b762a01a0b9b11652393044eb91848315f121
Author: paulnasca <paulnasca>
Date: Thu, 17 Jun 2004 20:20:48 +0000
*** empty log message ***
Diffstat:
6 files changed, 64 insertions(+), 115 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -579,6 +579,8 @@
- Adaugat inca o noua functie basefunc la OscilGen (sqr=atan(sin(x)*a))
15 Iun 2004 - Adaugat posibilitatea de a face armonicele ca sa depinda de frecventa ("adaptive") si rezultatul suna foarte frumos pentru ca tendinta este de pastrare a frecventelor armonicelor si nu a numarului de ordine al lor
16 Iun 2004 - Inceput sa trec configul pe XML
+17 Iun 2004 - Adaugat tipul threshUp la spectrum adjust
+ - Terminat de trecut config-ul pe XML (inclusiv setarile bancilor de instrumente)
diff --git a/src/Misc/Bank.C b/src/Misc/Bank.C
@@ -52,7 +52,6 @@ Bank::Bank(){
clearbank();
-// loadbank("nume directorbank");
for (int i=0;i<MAX_NUM_BANKS;i++){
banks[i].dir=NULL;
@@ -60,11 +59,14 @@ Bank::Bank(){
};
bankfiletitle=dirname;
+
+ loadbank(config.cfg.currentBankDir);
+
};
Bank::~Bank(){
if (dirname!=NULL) {
- //salvez numele bank-ul aici cu numele "dirname"
+ sprintf(config.cfg.currentBankDir,dirname);
};
for (int i=0;i<MAX_NUM_BANKS;i++){
if (banks[i].dir!=NULL) delete (banks[i].dir);
@@ -288,7 +290,7 @@ int Bank::newbank(const char *newbankdirname){
if (result<0) return(-1);
snprintf(tmpfilename,MAX_STRING_SIZE,"%s/%s",bankdir,FORCE_BANK_DIR_FILE);
- printf("%s\n",tmpfilename);
+// printf("%s\n",tmpfilename);
FILE *tmpfile=fopen(tmpfilename,"w+");
fclose(tmpfile);
@@ -369,11 +371,11 @@ void Bank::rescanforbanks(){
};
delete(currentrootdir);
- for (int i=0;i<MAX_NUM_BANKS;i++){
+/* for (int i=0;i<MAX_NUM_BANKS;i++){
if (banks[i].dir==NULL) continue;
printf("* %s = %s\n",banks[i].name,banks[i].dir);
};
-
+*/
};
diff --git a/src/Misc/Config.C b/src/Misc/Config.C
@@ -109,99 +109,37 @@ Config::~Config(){
};
void Config::readConfig(char *filename){
- FILE *file=fopen(filename,"r");
- if (file==NULL) return;
- while (!feof(file)){
- //read a line
- char line[MAX_STRING_SIZE+1];line[MAX_STRING_SIZE]=0;
- if (fgets(line,MAX_STRING_SIZE,file)==NULL) continue;
- if (strlen(line)<2) continue;
-
- //find out if the line begins with "#" (comment)
- char firstchar=0;
- for (int i=0;i<strlen(line);i++)
- if (line[i]>33) {
- firstchar=line[i];
- break;
- };
- if (firstchar=='#') continue;
- //get the parameter and the value
- char par[MAX_STRING_SIZE],val[MAX_STRING_SIZE];
- par[0]=0;val[0]=0;
- if (sscanf(line,"%s = %s",par,val)!=2) continue;//bad line
- if ((strlen(par)<1)|| (strlen(val)<1)) continue;//empty parameter/value
-
-// printf("%s\n",val);
-
-
- int intvalue=0;
- char *tmp;
- intvalue=strtoul(val,&tmp,10);
-
- //Check the parameter
- if (strstr(par,"SAMPLE_RATE")!=NULL){
- cfg.SampleRate=intvalue;
- };
- if (strstr(par,"SOUND_BUFFER_SIZE")!=NULL){
- cfg.SoundBufferSize=intvalue;
- };
- if (strstr(par,"OSCIL_SIZE")!=NULL){
- cfg.OscilSize=intvalue;
- };
- if (strstr(par,"SWAP_STEREO")!=NULL){
- cfg.SwapStereo=intvalue;
- };
- if (strstr(par,"BANK_WINDOW_AUTO_CLOSE")!=NULL){
- cfg.BankUIAutoClose=intvalue;
- };
- if (strstr(par,"LINUX_OSS_WAVE_OUT_DEV")!=NULL){
- if (strlen(val)<2) continue;
- snprintf(cfg.LinuxOSSWaveOutDev,MAX_STRING_SIZE,val);
- };
- if (strstr(par,"LINUX_OSS_SEQ_IN_DEV")!=NULL){
- if (strlen(val)<2) continue;
- snprintf(cfg.LinuxOSSSeqInDev,MAX_STRING_SIZE,val);
- };
+ XMLwrapper *xmlcfg=new XMLwrapper();
+ if (xmlcfg->loadXMLfile(filename)<0)return;
+ if (xmlcfg->enterbranch("CONFIGURATION")){
+ cfg.SampleRate=xmlcfg->getpar("sample_rate",cfg.SampleRate,4000,1024000);
+ cfg.SoundBufferSize=xmlcfg->getpar("sound_buffer_size",cfg.SoundBufferSize,2,8192);
+ cfg.OscilSize=xmlcfg->getpar("oscil_size",cfg.OscilSize,MAX_AD_HARMONICS*2,131072);
+ cfg.SwapStereo=xmlcfg->getpar("swap_stereo",cfg.SwapStereo,0,1);
+ cfg.BankUIAutoClose=xmlcfg->getpar("bank_window_auto_close",cfg.BankUIAutoClose,0,1);
+
+ cfg.DumpNotesToFile=xmlcfg->getpar("dump_notes_to_file",cfg.DumpNotesToFile,0,1);
+ cfg.DumpAppend=xmlcfg->getpar("dump_append",cfg.DumpAppend,0,1);
+ xmlcfg->getparstr("dump_file",cfg.DumpFile,MAX_STRING_SIZE);
+
+ cfg.GzipCompression=xmlcfg->getpar("gzip_compression",cfg.GzipCompression,0,9);
+
+ xmlcfg->getparstr("bank_current",cfg.currentBankDir,MAX_STRING_SIZE);
+ xmlcfg->getparstr("bank_root_list",cfg.bankRootDirList,MAX_STRING_SIZE);
+
+ //linux stuff
+ xmlcfg->getparstr("linux_oss_wave_out_dev",cfg.LinuxOSSWaveOutDev,MAX_STRING_SIZE);
+ xmlcfg->getparstr("linux_oss_seq_in_dev",cfg.LinuxOSSSeqInDev,MAX_STRING_SIZE);
- if (strstr(par,"WINDOWS_WAVE_OUT_ID")!=NULL){
- cfg.WindowsWaveOutId=intvalue;
- };
-
- if (strstr(par,"WINDOWS_MIDI_IN_ID")!=NULL){
- cfg.WindowsMidiInId=intvalue;
- };
-
- if (strstr(par,"DUMP_NOTES_TO_FILE")!=NULL){
- cfg.DumpNotesToFile=intvalue;
- };
- if (strstr(par,"DUMP_APPEND")!=NULL){
- cfg.DumpAppend=intvalue;
- };
- if (strstr(par,"DUMP_FILE")!=NULL){
- if (strlen(val)<2) continue;
- snprintf(cfg.DumpFile,MAX_STRING_SIZE,val);
- };
-
- if (strstr(par,"GZIP_COMPRESSION")!=NULL){
- cfg.GzipCompression=intvalue;
- };
-};
- fclose(file);
-
- //now, correct the bogus (incorrect) parameters
- if (cfg.SampleRate<4000) cfg.SampleRate=4000;
- if (cfg.SoundBufferSize<2) cfg.SoundBufferSize=2;
-
- if (cfg.OscilSize<MAX_AD_HARMONICS*2) cfg.OscilSize=MAX_AD_HARMONICS*2;
+ //windows stuff
+ cfg.WindowsWaveOutId=xmlcfg->getpar("windows_wave_out_id",cfg.WindowsWaveOutId,0,winwavemax);
+ cfg.WindowsMidiInId=xmlcfg->getpar("windows_midi_in_id",cfg.WindowsMidiInId,0,winmidimax);
+
+ xmlcfg->exitbranch();
+ };
+ delete(xmlcfg);
+
cfg.OscilSize=(int) pow(2,ceil(log (cfg.OscilSize-1.0)/log(2.0)));
-
- cfg.SwapStereo=(cfg.SwapStereo!=0?1:0);
-#ifdef OS_WINDOWS
- if (cfg.WindowsWaveOutId>=winwavemax) cfg.WindowsWaveOutId=0;
- if (cfg.WindowsMidiInId>=winmidimax) cfg.WindowsMidiInId=0;
-#endif
- if (cfg.GzipCompression<0) cfg.GzipCompression=0;
- else if (cfg.GzipCompression>9) cfg.GzipCompression=9;
};
diff --git a/src/Synth/OscilGen.C b/src/Synth/OscilGen.C
@@ -409,6 +409,8 @@ void OscilGen::spectrumadjust(){
break;
case 2: par=pow(10.0,(1.0-par)*3.0)*0.00095;
break;
+ case 3: par=pow(10.0,(1.0-par)*3.0)*0.00095;
+ break;
};
REALTYPE max=0.0;
for (int i=0;i<OSCIL_SIZE/2-1;i++){
@@ -427,6 +429,9 @@ void OscilGen::spectrumadjust(){
break;
case 2: if (mag<par) mag=0.0;
break;
+ case 3: mag/=par;
+ if (mag>1.0) mag=1.0;
+ break;
};
oscilFFTfreqs[OSCIL_SIZE-i-1]=mag*cos(phase);
oscilFFTfreqs[i+1]=mag*sin(phase);
diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl
@@ -285,13 +285,11 @@ delete(harmonic);} {}
decl {Master *master;} {}
}
-class ADOscilEditor {open
-} {
- Function {make_window()} {open
- } {
+class ADOscilEditor {} {
+ Function {make_window()} {} {
Fl_Window osceditUI {
- label {ADsynth Oscillator Editor} open
- xywh {66 94 750 590} type Double visible
+ label {ADsynth Oscillator Editor}
+ xywh {66 94 750 590} type Double hide
} {
Fl_Group oscildisplaygroup {
xywh {15 5 360 300} box ENGRAVED_FRAME
@@ -802,14 +800,14 @@ oldosc->redraw();}
}
}
Fl_Group {} {
- xywh {490 305 120 30} box ENGRAVED_BOX
+ xywh {490 305 130 30} box ENGRAVED_BOX
} {
Fl_Choice sabutton {
label {Sp.adj.}
callback {oscil->Psatype=(int) o->value();
oscildisplaygroup->redraw();
-oldosc->redraw();} open
- tooltip {Oscillator's spectrum adjust} xywh {530 310 50 20} down_box BORDER_BOX labelsize 10 textsize 10
+oldosc->redraw();}
+ tooltip {Oscillator's spectrum adjust} xywh {530 310 60 20} down_box BORDER_BOX labelsize 10 textsize 10
code0 {o->value(oscil->Psatype);}
} {
menuitem {} {
@@ -821,15 +819,19 @@ oldosc->redraw();} open
xywh {65 65 100 20} labelfont 1 labelsize 10
}
menuitem {} {
- label Thrs
+ label ThrsD
xywh {75 75 100 20} labelfont 1 labelsize 10
}
+ menuitem {} {
+ label ThrsU
+ xywh {85 85 100 20} labelfont 1 labelsize 10
+ }
}
Fl_Dial {} {
callback {oscil->Psapar=(int)o->value();
oscildisplaygroup->redraw();
oldosc->redraw();}
- tooltip {Oscillator's spectrum adjust parameter} xywh {585 310 20 20} maximum 127 step 1
+ tooltip {Oscillator's spectrum adjust parameter} xywh {595 310 20 20} maximum 127 step 1
code0 {o->value(oscil->Psapar);}
class WidgetPDial
}
@@ -862,7 +864,7 @@ oldosc->redraw();}
xywh {680 380 25 15} box THIN_UP_BOX labelfont 1 labelsize 10
}
}
- Fl_Group {} {open
+ Fl_Group {} {
xywh {675 445 65 90} box ENGRAVED_FRAME
} {
Fl_Box {} {
@@ -885,7 +887,7 @@ oldosc->redraw();}
}
Fl_Dial {} {
label pow
- callback {oscil->Padaptiveharmonicspower=(int)o->value();} selected
+ callback {oscil->Padaptiveharmonicspower=(int)o->value();}
tooltip {Adaptive harmonics power} xywh {710 495 25 25} labelsize 6 maximum 100 step 1
code0 {o->value(oscil->Padaptiveharmonicspower);}
class WidgetPDial
diff --git a/src/UI/PartUI.fl b/src/UI/PartUI.fl
@@ -255,9 +255,9 @@ delete(partkititem);} {}
decl {PartUI_ *partui;} {}
}
-class PartUI {open : {public Fl_Group,PartUI_}
+class PartUI {: {public Fl_Group,PartUI_}
} {
- Function {make_window()} {open private
+ Function {make_window()} {private
} {
Fl_Window partgroup {
private xywh {149 400 385 180} type Double hide
@@ -823,7 +823,7 @@ subsynenabledcheck->value(part->kit[0].Psubenabled);}
}
}
Fl_Window instrumenteditwindow {
- label {Instrument Edit} selected
+ label {Instrument Edit}
xywh {60 156 395 360} type Double hide
} {
Fl_Group {} {
@@ -837,7 +837,7 @@ subsynenabledcheck->value(part->kit[0].Psubenabled);}
label Edit
callback {//showparameters(0,1);
fl_alert("Oops... try again...")}
- xywh {215 280 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 12 align 128
+ xywh {215 280 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 18 align 128
}
Fl_Check_Button padsynenabledcheck {
label Enabled
@@ -859,7 +859,7 @@ fl_alert("Oops... try again...")}
Fl_Button {} {
label Edit
callback {showparameters(0,0);}
- xywh {15 281 80 34} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 12 align 128
+ xywh {15 281 80 34} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 18 align 128
}
}
Fl_Group {} {
@@ -875,7 +875,7 @@ fl_alert("Oops... try again...")}
Fl_Button {} {
label Edit
callback {showparameters(0,1);}
- xywh {115 280 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 12 align 128
+ xywh {115 280 80 35} box PLASTIC_UP_BOX color 222 selection_color 220 labelfont 1 labelsize 18 align 128
}
}
Fl_Button {} {