commit 8f6e2367c828b9389b9a688b34b8156b891d3464
parent 1506db6b4399526fad6c95caa1e79c6c74919a34
Author: paulnasca <paulnasca>
Date: Mon, 2 Feb 2004 20:59:08 +0000
started to add XML support (using mxml library from http://www.easysw.com/~mike/mxml/)
Diffstat:
11 files changed, 93 insertions(+), 31 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -508,4 +508,15 @@
15 Dec 2003 - Corectata o mica eroare la ADnoteParameters (lipseau niste break-uri la salvarea/incarcarea parametrilor)
16 Dec 2003 - Eroarea cu break-urile se dovedeste a fi o eroare majora :( ; adica corectarea ei, necesita resalvarea tuturor instrumentelor
- Am revenit la suportul vechi de JACK, dar cel nou este disponiblil ca JACK_RT (nefunctional inca)
-
-\ No newline at end of file
+17 Dec 2003 - Inceput sa restucturez Part-ul (am adaugat clasele Instrument,InstrumentParams) - programul nu mai este compatibil cu versiunile anterioare
+ - RMS normalize este prestabilit la OscilGen
+18 Dec 2003 - Continuat de restructurat Part-ul
+
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+01 Feb 2003 - Revenit la versiunea din 16 Dec. 2003
+ - Pus iarasi RMS normalize prestabilit la OscilGen
+ - M-am razgandit ;) nu mai restructurez part-ul; mai bine pun acolo o functie separata pentru salvari/incarcari par instrumente
+ - Inceput sa adaug suportul XML
+02 Feb 2003 - Corectata o eroare care facea ca numele la instrumentele din bank sa fie aratate gresit (nu era pus un \0 )
+ - Continuat suportul de XML
diff --git a/README.txt b/README.txt
@@ -31,6 +31,7 @@ Requirements:
- FLTK 1.x.x (tested with fltk 1.1.0, 1.1.1, 1.1.2,etc.)
- FFTW 2.x.x (tested with fftw 2.0.5, 2.1.3) - necesary for
Fast Fourier computations
+ - MXML library from http://www.easysw.com/~mike/mxml/
- (for Linux) OpenSoundSystem (OSS) (if you don't have ALSA, only)
- (for Windows) pthreads, portaudio
diff --git a/src/Makefile b/src/Makefile
@@ -9,7 +9,7 @@ endif
CXXFLAGS += -DOS_$(OS_PORT) -D$(MIDIIN)MIDIIN -D$(AUDIOOUT)AUDIOOUT -DFFTW_VERSION_$(FFTW_VERSION) -DASM_F2I_$(ASM_F2I) `fltk-config --cflags`
export CXXFLAGS
-LIBS= -lm `fltk-config --ldflags`
+LIBS= -lm `fltk-config --ldflags` -lmxml
ifeq ($(FFTW_VERSION),2)
LIBS += -lrfftw -lfftw
diff --git a/src/Misc/Bank.C b/src/Misc/Bank.C
@@ -33,9 +33,10 @@
Bank::Bank(){
bankfilename=NULL;bankfiletitle=NULL;lock=1;
+ memset(&defaultinsname,0,PART_MAX_NAME_LEN);
snprintf(defaultinsname,PART_MAX_NAME_LEN,"%s"," ");
for (int i=0;i<128;i++){
- ins[i].name[0]='\0';
+ memset(&ins[i].name[0],0,PART_MAX_NAME_LEN);
ins[i].size=0;
ins[i].data=NULL;
};
@@ -111,7 +112,8 @@ char *Bank::getname (unsigned char ninstrument){
*/
char *Bank::getnamenumbered (unsigned char ninstrument){
if (ninstrument>=128) return(&tmpinsname[0][0]);
- snprintf(&tmpinsname[ninstrument][0],PART_MAX_NAME_LEN+10,"%d. %s\0",ninstrument+1,getname(ninstrument));
+ memset(&tmpinsname[ninstrument][0],0,PART_MAX_NAME_LEN+15);
+ snprintf(&tmpinsname[ninstrument][0],PART_MAX_NAME_LEN,"%d. %s",ninstrument+1,getname(ninstrument));
return(&tmpinsname[ninstrument][0]);
};
@@ -173,6 +175,7 @@ void Bank::loadfromslot(unsigned char ninstrument,Buffer *buf){
*/
int Bank::loadfile(){
int file;
+
file=open(bankfilename,O_RDONLY|O_BINARY,00444+00222);
if (file==-1) return(2);//something went wrong (access denied,..etc.)
@@ -218,6 +221,7 @@ int Bank::loadfile(){
//get the name
unsigned char namesize;
read (file,&namesize,1);
+ memset(&ins[ni].name[0],0,PART_MAX_NAME_LEN);
read (file,&ins[ni].name[0],namesize);
//get the data
unsigned int datasize;
diff --git a/src/Misc/Makefile b/src/Misc/Makefile
@@ -1,6 +1,6 @@
include ../Makefile.inc
-objects=Bank.o Buffer.o Master.o Microtonal.o Part.o Util.o Config.o Dump.o
+objects=Bank.o Buffer.o Master.o Microtonal.o Part.o Util.o Config.o Dump.o XMLwrapper.o
all: $(objects)
diff --git a/src/Misc/Master.C b/src/Misc/Master.C
@@ -22,6 +22,8 @@
*/
#include "Master.h"
+#include "XMLwrapper.h"
+
#include <stdio.h>
@@ -692,6 +694,23 @@ void Master::saveloadbuf(Buffer *buf){
+int Master::saveXML(char *filename){
+
+ //sa pun aici un test daca exista fisierul
+
+ XMLwrapper *xml;
+ xml=new XMLwrapper();
+
+
+
+
+ xml->saveXMLfile(filename,0);
+ delete (xml);
+ return(0);
+};
+
+
+
diff --git a/src/Misc/Master.h b/src/Misc/Master.h
@@ -41,6 +41,10 @@ class Master{
Master();
~Master();
void saveloadbuf(Buffer *buf);
+
+ //saves all settings to a XML file
+ //returns 0 for ok, 1 if there is a existing file or -1 if there is an error
+ int saveXML(char *filename);
//Midi IN
void NoteOn(unsigned char chan,unsigned char note,unsigned char velocity);
diff --git a/src/Synth/OscilGen.C b/src/Synth/OscilGen.C
@@ -50,7 +50,7 @@ OscilGen::OscilGen(FFTwrapper *fft_,Resonance *res_){
Pbasefuncpar=64;
Pwaveshapingfunction=0;
Pwaveshaping=64;
- Pnormalizemethod=0;
+ Pnormalizemethod=1;
Pfiltertype=0;
Pfilterpar=64;
Pfilterbeforews=0;
diff --git a/src/UI/BankUI.fl b/src/UI/BankUI.fl
@@ -1,5 +1,5 @@
# data file for the Fltk User Interface Designer (fluid)
-version 1.0104
+version 1.0200
header_name {.h}
code_name {.cc}
decl {//Copyright (c) 2002-2003 Nasca Octavian Paul} {}
@@ -34,7 +34,7 @@ class BankProcess_ {} {
}
}
-class BankSlot {: {public Fl_Button,BankProcess_}
+class BankSlot {open : {public Fl_Button,BankProcess_}
} {
Function {BankSlot(int x,int y, int w, int h, const char *label=0):Fl_Button(x,y,w,h,label)} {} {
code {what=NULL;
@@ -55,7 +55,8 @@ int tmp=Fl_Button::handle(event);
if ((*what!=0) && Fl::event_inside(this)) (bp->*fnc)();
return(tmp);} {}
}
- Function {init(int nslot_, int *what_, int *whatslot_,void (BankProcess_:: *fnc_)(void),BankProcess_ *bp_,Bank *bank_)} {} {
+ Function {init(int nslot_, int *what_, int *whatslot_,void (BankProcess_:: *fnc_)(void),BankProcess_ *bp_,Bank *bank_)} {open
+ } {
code {nslot=nslot_;
what=what_;
whatslot=whatslot_;
@@ -67,10 +68,16 @@ align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
highlight=0;
refresh();} {}
}
- Function {refresh()} {} {
+ Function {refresh()} {open
+ } {
code {if (bank->emptyslot(nslot)) color(46);
else color(51);
-label(bank->getnamenumbered(nslot));} {}
+
+
+//printf("%s\\n",bank->getnamenumbered(nslot));
+
+label(bank->getnamenumbered(nslot));} {selected
+ }
}
decl {int *what,*whatslot,nslot,highlight;} {}
decl {void (BankProcess_:: *fnc)(void);} {}
@@ -82,7 +89,7 @@ class BankUI {: {public BankProcess_}
Function {make_window()} {} {
Fl_Window bankuiwindow {
label Bank
- xywh {16 205 770 430} hide
+ xywh {16 205 770 430} type Double hide
code0 {o->label(bank->bankfiletitle);}
code1 {if (bank->bankfiletitle==NULL) o->label ("Choose a bank to use by pressing the 'Load/Use Bank from file...' button or choose 'New Bank...' to make a new bank.");}
} {
@@ -275,8 +282,7 @@ if ((what==1)&&(mode==3)&&(!bank->emptyslot(slot))){//Clears the slot
bank->clearslot(slot);
bs[slot]->refresh();
};
-};} {selected
- }
+};} {}
}
Function {refreshmainwindow()} {} {
code {bankuiwindow->label(bank->bankfiletitle);
diff --git a/src/UI/MasterUI.fl b/src/UI/MasterUI.fl
@@ -1,5 +1,5 @@
# data file for the Fltk User Interface Designer (fluid)
-version 1.0104
+version 1.0200
header_name {.h}
code_name {.cc}
decl {//Copyright (c) 2002-2003 Nasca Octavian Paul} {}
@@ -248,7 +248,7 @@ class Panellistitem {: {public Fl_Group}
Function {make_window()} {private
} {
Fl_Window panellistitem {
- private xywh {315 213 70 260} hide
+ private xywh {315 213 70 260} type Double hide
class Fl_Group
} {
Fl_Group panellistitemgroup {
@@ -371,9 +371,9 @@ class MasterUI {} {
fl_alert("ZynAddSubFX could not be closed this way, because it's a VST plugin. Please use the host aplication to close it.");
\#else
if (fl_ask("Exit and leave the unsaved data?")) *exitprogram=1;
-\#endif}
- xywh {149 197 390 465} hide
- code0 {setfilelabel(NULL);} non_modal
+\#endif} selected
+ xywh {149 197 390 465} type Double
+ code0 {setfilelabel(NULL);} non_modal visible
} {
Fl_Menu_Bar mastermenu {
xywh {0 0 690 25}
@@ -383,7 +383,23 @@ if (fl_ask("Exit and leave the unsaved data?")) *exitprogram=1;
xywh {0 0 100 20}
} {
menuitem {} {
- label {&New Master...}
+ label {&Save All As XML (NOT IMPLEMENTED)...}
+ callback {char *filename;
+\#define EXT ".xml"
+filename=fl_file_chooser("Save:","(*"EXT")",NULL,0);
+if (filename==NULL) return;
+filename=fl_filename_setext(filename,EXT);
+\#undef EXT
+
+pthread_mutex_lock(&master->mutex);
+master->saveXML(filename);
+pthread_mutex_unlock(&master->mutex);
+
+updatepanel();}
+ xywh {10 10 100 20} divider
+ }
+ menuitem {} {
+ label {&New (erase all)...}
callback {if (fl_ask("Clear *ALL* the parameters ?")){
delete microtonalui;
@@ -408,7 +424,7 @@ updatepanel();}
xywh {20 20 100 20}
}
menuitem {} {
- label {&Open Master...}
+ label {&Open...}
callback {const char *filename;
filename=fl_file_chooser("Open:","(*.mas_zyn)",NULL,0);
if (filename==NULL) return;
@@ -443,7 +459,7 @@ updatepanel();}
xywh {10 10 100 20}
}
menuitem {} {
- label {&Save Master As...}
+ label {&Save All As...}
callback {char *filename;
\#define EXT ".mas_zyn"
filename=fl_file_chooser("Save:","(*"EXT")",NULL,0);
@@ -877,7 +893,7 @@ inseffectui->redraw();}
callback {microtonalui->show();}
xywh {330 80 56 19} box PLASTIC_UP_BOX color 231 labeltype ENGRAVED_LABEL labelfont 1
}
- Fl_Group {} {selected
+ Fl_Group {} {
xywh {172 30 117 45} box ENGRAVED_BOX
} {
Fl_Button recordbutton {
@@ -976,7 +992,7 @@ panelwindow->show();}
}
Fl_Window aboutwindow {
label {Copyright...}
- xywh {629 278 330 210} hide
+ xywh {629 278 330 210} type Double hide
} {
Fl_Box {} {
label {Copyright (c) 2002-2003 Nasca O. Paul}
@@ -1003,7 +1019,7 @@ GNU General Public License for details.}
}
Fl_Window syseffsendwindow {
label {System Effects Send}
- xywh {171 234 120 250} hide resizable
+ xywh {171 234 120 250} type Double hide resizable
} {
Fl_Scroll {} {open
xywh {0 45 120 170} box FLAT_BOX resizable
@@ -1022,7 +1038,7 @@ GNU General Public License for details.}
}
Fl_Window swapeffwindow {
label {Swap/Copy effect}
- xywh {581 329 205 100} hide modal
+ xywh {581 329 205 100} type Double hide modal
} {
Fl_Counter swapwitheffectcounter {
label {Swap with effect/Copy to:}
@@ -1069,7 +1085,7 @@ swapeffwindow->hide();}
}
Fl_Window panelwindow {
label {ZynAddSubFX Panel}
- xywh {4 20 632 635} hide
+ xywh {4 20 632 635} type Double hide
} {
Fl_Scroll {} {open
xywh {0 5 570 310} type HORIZONTAL box THIN_UP_BOX
diff --git a/src/main.C b/src/main.C
@@ -411,11 +411,13 @@ int main(int argc, char *argv[]){
pthread_create(&thr2,NULL,thread2,NULL);
#endif
-/* not working....yet.
+/*It is not working and I don't know why
//drop the suid-root permisions
#if !(defined(JACKAUDIOOUT)||defined(PAAUDIOOUT)||defined(VSTAUDIOOUT)|| (defined (WINMIDIIN)) )
- setuid(getuid());
- seteuid(getuid());
+ setuid(getuid());
+ seteuid(getuid());
+// setreuid(getuid(),getuid());
+// setregid(getuid(),getuid());
#endif
*/
if (noui==0) pthread_create(&thr3,NULL,thread3,NULL);