From e40fc849149dd97c248866a4a1d026dda5e57b62 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Mon, 7 Mar 2011 19:01:11 +0000 Subject: clean3 --- muse_qt4_evolution/synti/zynaddsubfx/Misc/Bank.C | 565 ------------- muse_qt4_evolution/synti/zynaddsubfx/Misc/Bank.h | 100 --- muse_qt4_evolution/synti/zynaddsubfx/Misc/Config.C | 303 ------- muse_qt4_evolution/synti/zynaddsubfx/Misc/Config.h | 67 -- muse_qt4_evolution/synti/zynaddsubfx/Misc/Dump.C | 99 --- muse_qt4_evolution/synti/zynaddsubfx/Misc/Dump.h | 43 - muse_qt4_evolution/synti/zynaddsubfx/Misc/Master.C | 680 ---------------- muse_qt4_evolution/synti/zynaddsubfx/Misc/Master.h | 167 ---- .../synti/zynaddsubfx/Misc/Microtonal.C | 514 ------------ .../synti/zynaddsubfx/Misc/Microtonal.h | 111 --- muse_qt4_evolution/synti/zynaddsubfx/Misc/Part.C | 881 --------------------- muse_qt4_evolution/synti/zynaddsubfx/Misc/Part.h | 176 ---- muse_qt4_evolution/synti/zynaddsubfx/Misc/Util.C | 112 --- muse_qt4_evolution/synti/zynaddsubfx/Misc/Util.h | 45 -- .../synti/zynaddsubfx/Misc/XMLwrapper.C | 533 ------------- .../synti/zynaddsubfx/Misc/XMLwrapper.h | 175 ---- 16 files changed, 4571 deletions(-) delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Bank.C delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Bank.h delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Config.C delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Config.h delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Dump.C delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Dump.h delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Master.C delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Master.h delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Microtonal.C delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Microtonal.h delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Part.C delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Part.h delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Util.C delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/Util.h delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/XMLwrapper.C delete mode 100644 muse_qt4_evolution/synti/zynaddsubfx/Misc/XMLwrapper.h (limited to 'muse_qt4_evolution/synti/zynaddsubfx/Misc') diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Bank.C b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Bank.C deleted file mode 100644 index 9b2e8f75..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Bank.C +++ /dev/null @@ -1,565 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Bank.h - Instrument Bank - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Bank.h" -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "Config.h" - -#define INSTRUMENT_EXTENSION ".xiz" - -//if this file exists into a directory, this make the directory to be considered as a bank, even if it not contains a instrument file -#define FORCE_BANK_DIR_FILE ".bankdir" - -Bank::Bank(){ - - - ZERO(defaultinsname,PART_MAX_NAME_LEN); - snprintf(defaultinsname,PART_MAX_NAME_LEN,"%s"," "); - - for (int i=0;i=0) snprintf(tmpfilename,100,"%4d-%s",newslot+1,newname); - else snprintf(tmpfilename,100,"%4d-%s",ninstrument+1,newname); - - //add the zeroes at the start of filename - for (int i=0;i<4;i++) if (tmpfilename[i]==' ') tmpfilename[i]='0'; - - //make the filenames legal - for (int i=0;i<(int) strlen(tmpfilename);i++) { - char c=tmpfilename[i]; - if ((c>='0')&&(c<='9')) continue; - if ((c>='A')&&(c<='Z')) continue; - if ((c>='a')&&(c<='z')) continue; - if ((c=='-')||(c==' ')) continue; - - tmpfilename[i]='_'; - }; - - snprintf(newfilename,1000,"%s/%s.xiz",dirname,tmpfilename); - -// printf("rename %s -> %s\n",ins[ninstrument].filename,newfilename);////////////// - - rename(ins[ninstrument].filename,newfilename); - if (ins[ninstrument].filename) delete(ins[ninstrument].filename); - ins[ninstrument].filename=new char[strlen(newfilename)+5]; - snprintf(ins[ninstrument].filename,strlen(newfilename)+1,"%s",newfilename); - snprintf(ins[ninstrument].name,PART_MAX_NAME_LEN,"%s",&tmpfilename[5]); - -}; - -/* - * Check if there is no instrument on a slot from the bank - */ -int Bank::emptyslot(unsigned int ninstrument){ - if (ninstrument>=BANK_SIZE) return (1); - if (ins[ninstrument].filename==NULL) return(1); - - if (ins[ninstrument].used) return (0); - else return(1); -}; - -/* - * Removes the instrument from the bank - */ -void Bank::clearslot(unsigned int ninstrument){ - if (emptyslot(ninstrument)) return; - -// printf("remove %s \n",ins[ninstrument].filename);//////////////////////// - - - remove(ins[ninstrument].filename); - deletefrombank(ninstrument); -}; - -/* - * Save the instrument to a slot - */ -void Bank::savetoslot(unsigned int ninstrument,Part *part){ - clearslot(ninstrument); - - const int maxfilename=200; - char tmpfilename[maxfilename+20]; - ZERO(tmpfilename,maxfilename+20); - - snprintf(tmpfilename,maxfilename,"%4d-%s",ninstrument+1,(char *)part->Pname); - - //add the zeroes at the start of filename - for (int i=0;i<4;i++) if (tmpfilename[i]==' ') tmpfilename[i]='0'; - - //make the filenames legal - for (int i=0;i<(int)strlen(tmpfilename);i++) { - char c=tmpfilename[i]; - if ((c>='0')&&(c<='9')) continue; - if ((c>='A')&&(c<='Z')) continue; - if ((c>='a')&&(c<='z')) continue; - if ((c=='-')||(c==' ')) continue; - - tmpfilename[i]='_'; - }; - - strncat(tmpfilename,".xiz",maxfilename+10); - - int fnsize=strlen(dirname)+strlen(tmpfilename)+10; - char *filename=new char[fnsize+4]; - ZERO(filename,fnsize+2); - - snprintf(filename,fnsize,"%s/%s",dirname,tmpfilename); - - remove(filename); - part->saveXML(filename); - addtobank(ninstrument,tmpfilename,(char *) part->Pname); - - delete(filename); -}; - -/* - * Loads the instrument from the bank - */ -void Bank::loadfromslot(unsigned int ninstrument,Part *part){ - if (emptyslot(ninstrument)) return; - - part->defaultsinstrument(); - -// printf("load: %s\n",ins[ninstrument].filename); - - part->loadXMLinstrument(ins[ninstrument].filename); - -}; - - -/* - * Makes current a bank directory - */ -int Bank::loadbank(const char *bankdirname) - { - DIR *dir = opendir(bankdirname); - clearbank(); - - if (dir==NULL) - return -1; - - if (dirname!=NULL) - delete(dirname); - dirname = new char[strlen(bankdirname)+1]; - snprintf(dirname, strlen(bankdirname)+1, "%s",bankdirname); - - bankfiletitle=dirname; - - // printf("loadbank %s/\n",bankdirname); - struct dirent *fn; - - while ((fn=readdir(dir))){ - const char *filename= fn->d_name; - - //sa verific daca e si extensia dorita - if (strstr(filename,INSTRUMENT_EXTENSION)==NULL) continue; - - //verify if the name is like this NNNN-name (where N is a digit) - int no=0; - unsigned int startname=0; - - for (unsigned int i=0;i<4;i++) { - if (strlen(filename)<=i) break; - - if ((filename[i]>='0')&&(filename[i]<='9')) { - no=no*10+(filename[i]-'0'); - startname++; - }; - }; - - - if ((startname+1)=2;i--){ - if (name[i]=='.') { - name[i]='\0'; - break; - }; - }; - - if (no!=0){//the instrument position in the bank is found - addtobank(no-1,filename,&name[startname]); - } else { - addtobank(-1,filename,name); - }; - - }; - - - closedir(dir); - - if (dirname!=NULL) { - sprintf(config.cfg.currentBankDir,"%s",dirname); - }; - - return(0); -}; - -/* - * Makes a new bank, put it on a file and makes it current bank - */ -int Bank::newbank(const char *newbankdirname){ - int result; - char tmpfilename[MAX_STRING_SIZE]; - char bankdir[MAX_STRING_SIZE]; - snprintf(bankdir,MAX_STRING_SIZE,"%s",config.cfg.bankRootDirList[0]); - - if (((bankdir[strlen(bankdir)-1])!='/')&&((bankdir[strlen(bankdir)-1])!='\\')){ - strncat(bankdir,"/",MAX_STRING_SIZE); - }; - strncat(bankdir,newbankdirname,MAX_STRING_SIZE); -#ifdef OS_WINDOWS - result=mkdir(bankdir); -#else - result=mkdir(bankdir,S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); -#endif - if (result<0) return(-1); - - snprintf(tmpfilename,MAX_STRING_SIZE,"%s/%s",bankdir,FORCE_BANK_DIR_FILE); -// printf("%s\n",tmpfilename); - FILE *tmpfile=fopen(tmpfilename,"w+"); - fclose(tmpfile); - - return(loadbank(bankdir)); -}; - -/* - * Check if the bank is locked (i.e. the file opened was readonly) - */ -int Bank::locked(){ - return(dirname==NULL); -}; - -/* - * Swaps a slot with another - */ -void Bank::swapslot(unsigned int n1, unsigned int n2){ - if ((n1==n2)||(locked())) return; - if (emptyslot(n1)&&(emptyslot(n2))) return; - if (emptyslot(n1)){//change n1 to n2 in order to make - int tmp=n2;n2=n1;n1=tmp; - }; - - if (emptyslot(n2)){//this is just a movement from slot1 to slot2 - setname(n1,getname(n1),n2); - ins[n2]=ins[n1]; - ins[n1].used=false; - ins[n1].name[0]='\0'; - ins[n1].filename=NULL; - ins[n1].info.PADsynth_used=0; - } else {//if both slots are used - if (strcmp(ins[n1].name,ins[n2].name)==0){//change the name of the second instrument if the name are equal - strncat(ins[n2].name,"2",PART_MAX_NAME_LEN); - }; - setname(n1,getname(n1),n2); - setname(n2,getname(n2),n1); - ins_t tmp; - tmp.used=true; - strcpy(tmp.name,ins[n2].name); - char *tmpfilename=ins[n2].filename; - bool padsynth_used=ins[n2].info.PADsynth_used; - - ins[n2]=ins[n1]; - strcpy(ins[n1].name,tmp.name); - ins[n1].filename=tmpfilename; - ins[n1].info.PADsynth_used=padsynth_used; - }; - -}; - - -//a helper function that compares 2 banks[] arrays -int Bank_compar(const void *a,const void *b){ - struct Bank::bankstruct *bank1= (Bank::bankstruct *)a; - struct Bank::bankstruct *bank2= (Bank::bankstruct *)b; - if (((bank1->name)==NULL)||((bank2->name)==NULL)) return(0); - - int result=strcasecmp(bank1->name,bank2->name); - return(result<0); -}; - - -/* - * Re-scan for directories containing instrument banks - */ - -void Bank::rescanforbanks(){ - for (int i=0;id_name; - if (dirname[0]=='.') continue; - - snprintf(bank.dir,maxdirsize,"%s%s%s/",rootdir,separator,dirname); - snprintf(bank.name,maxdirsize,"%s",dirname); - //find out if the directory contains at least 1 instrument - bool isbank=false; - - DIR *d=opendir(bank.dir); - if (d==NULL) continue; - - struct dirent *fname; - - while((fname=readdir(d))){ - if ((strstr(fname->d_name,INSTRUMENT_EXTENSION)!=NULL)|| - (strstr(fname->d_name,FORCE_BANK_DIR_FILE)!=NULL)){ - isbank=true; - break;//aici as putea pune in loc de break un update la un counter care imi arata nr. de instrumente din bank - }; - }; - - closedir(d); - - if (isbank) { - int pos=-1; - for (int i=1;i=0) { - banks[pos].name=new char[maxdirsize]; - banks[pos].dir=new char[maxdirsize]; - snprintf(banks[pos].name,maxdirsize,"%s",bank.name); - snprintf(banks[pos].dir,maxdirsize,"%s",bank.dir); - }; - - }; - - }; - - closedir(dir); - -}; - -void Bank::clearbank(){ - for (int i=0;i=0)&&(pos=BANK_SIZE) pos=-1; - - - if (pos<0) {//find a free position - for (int i=BANK_SIZE-1;i>=0;i--) - if (!ins[i].used) { - pos=i; - break; - }; - - }; - - if (pos<0) return (-1);//the bank is full - - // printf("%s %d\n",filename,pos); - - deletefrombank(pos); - - ins[pos].used=true; - snprintf(ins[pos].name,PART_MAX_NAME_LEN,"%s",name); - - snprintf(tmpinsname[pos],PART_MAX_NAME_LEN+10," "); - - int len=strlen(filename)+1+strlen(dirname); - ins[pos].filename=new char[len+2]; - ins[pos].filename[len+1]=0; - snprintf(ins[pos].filename,len+1,"%s/%s",dirname,filename); - - //see if PADsynth is used - if (config.cfg.CheckPADsynth){ - XMLwrapper *xml=new XMLwrapper(); - xml->checkfileinformation(ins[pos].filename); - - ins[pos].info.PADsynth_used=xml->information.PADsynth_used; - delete(xml); - } else ins[pos].info.PADsynth_used=false; - - return(0); -}; - -bool Bank::isPADsynth_used(unsigned int ninstrument){ - if (config.cfg.CheckPADsynth==0) return(0); - else return(ins[ninstrument].info.PADsynth_used); -}; - - -void Bank::deletefrombank(int pos){ - if ((pos<0)||(pos>=BANK_SIZE)) return; - ins[pos].used=false; - ZERO(ins[pos].name,PART_MAX_NAME_LEN+1); - if (ins[pos].filename!=NULL) { - delete (ins[pos].filename); - ins[pos].filename=NULL; - }; - - ZERO(tmpinsname[pos],PART_MAX_NAME_LEN+20); - -}; - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Bank.h b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Bank.h deleted file mode 100644 index 1a2f4382..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Bank.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Bank.C - Instrument Bank - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef BANK_H -#define BANK_H - -#include "../globals.h" -#include "XMLwrapper.h" -#include "Part.h" - -#define BANK_SIZE 160 - -/* - * The max. number of banks that are used - */ -#define MAX_NUM_BANKS 400 - - -class Bank{ - public: - Bank(); - ~Bank(); - char *getname(unsigned int ninstrument); - char *getnamenumbered(unsigned int ninstrument); - void setname(unsigned int ninstrument,const char *newname,int newslot);//if newslot==-1 then this is ignored, else it will be put on that slot - bool isPADsynth_used(unsigned int ninstrument); - - //returns 0 if the slot is not empty or 1 if the slot is empty - int emptyslot(unsigned int ninstrument); - - void clearslot(unsigned int ninstrument); - void savetoslot(unsigned int ninstrument,Part *part); - void loadfromslot(unsigned int ninstrument,Part *part); - - void swapslot(unsigned int n1,unsigned int n2); - - int loadbank(const char *bankdirname); - int newbank(const char *newbankdirname); - - char *bankfiletitle; //this is shown on the UI of the bank (the title of the window) - int locked(); - - void rescanforbanks(); - - struct bankstruct{ - char *dir; - char *name; - }; - - bankstruct banks[MAX_NUM_BANKS]; - - private: - - //it adds a filename to the bank - //if pos is -1 it try to find a position - //returns -1 if the bank is full, or 0 if the instrument was added - int addtobank(int pos,const char* filename,const char* name); - - void deletefrombank(int pos); - - void clearbank(); - - char defaultinsname[PART_MAX_NAME_LEN]; - char tmpinsname[BANK_SIZE][PART_MAX_NAME_LEN+20];//this keeps the numbered names - - struct ins_t{ - bool used; - char name[PART_MAX_NAME_LEN+1]; - char *filename; - struct{ - bool PADsynth_used; - } info; - }ins[BANK_SIZE]; - - char *dirname; - - void scanrootdir(char *rootdir);//scans a root dir for banks -}; - -#endif - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Config.C b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Config.C deleted file mode 100644 index f04a32ac..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Config.C +++ /dev/null @@ -1,303 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Config.C - Configuration file functions - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -#include -#include -#include -#include - -#ifdef OS_WINDOWS -#include -#include -#endif - -#include "Config.h" -#include "XMLwrapper.h" -#include "config.h" - -Config::Config(){ -}; -void Config::init(){ - maxstringsize=MAX_STRING_SIZE;//for ui - //defaults - cfg.SampleRate=44100; - cfg.SoundBufferSize=256; - cfg.OscilSize=512; - cfg.SwapStereo=0; - - cfg.LinuxOSSWaveOutDev=new char[MAX_STRING_SIZE]; - snprintf(cfg.LinuxOSSWaveOutDev,MAX_STRING_SIZE,"/dev/dsp"); - cfg.LinuxOSSSeqInDev=new char[MAX_STRING_SIZE]; - snprintf(cfg.LinuxOSSSeqInDev,MAX_STRING_SIZE,"/dev/sequencer"); - - cfg.DumpFile=new char[MAX_STRING_SIZE]; - snprintf(cfg.DumpFile,MAX_STRING_SIZE,"zynaddsubfx_dump.txt"); - - cfg.WindowsWaveOutId=0; - cfg.WindowsMidiInId=0; - - cfg.BankUIAutoClose=0; - cfg.DumpNotesToFile=0; - cfg.DumpAppend=1; - - cfg.GzipCompression=3; - - cfg.Interpolation=0; - cfg.CheckPADsynth=1; - - cfg.UserInterfaceMode=1; - cfg.VirKeybLayout=1; - winwavemax=1;winmidimax=1; -//try to find out how many input midi devices are there - winmididevices=new winmidionedevice[winmidimax]; - for (int i=0;iloadXMLfile(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,16,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); - cfg.Interpolation=xmlcfg->getpar("interpolation",cfg.Interpolation,0,1); - - cfg.CheckPADsynth=xmlcfg->getpar("check_pad_synth",cfg.CheckPADsynth,0,1); - - - cfg.UserInterfaceMode=xmlcfg->getpar("user_interface_mode",cfg.UserInterfaceMode,0,2); - cfg.VirKeybLayout=xmlcfg->getpar("virtual_keyboard_layout",cfg.VirKeybLayout,0,10); - - //get bankroot dirs - for (int i=0;ienterbranch("BANKROOT",i)){ - cfg.bankRootDirList[i]=new char[MAX_STRING_SIZE]; - xmlcfg->getparstr("bank_root",cfg.bankRootDirList[i],MAX_STRING_SIZE); - xmlcfg->exitbranch(); - }; - }; - - //get preset root dirs - for (int i=0;ienterbranch("PRESETSROOT",i)){ - cfg.presetsDirList[i]=new char[MAX_STRING_SIZE]; - xmlcfg->getparstr("presets_root",cfg.presetsDirList[i],MAX_STRING_SIZE); - xmlcfg->exitbranch(); - }; - }; - - //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); - - //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))); - -}; - -void Config::saveConfig(char *filename){ - XMLwrapper *xmlcfg=new XMLwrapper(); - - xmlcfg->beginbranch("CONFIGURATION"); - - xmlcfg->addpar("sample_rate",cfg.SampleRate); - xmlcfg->addpar("sound_buffer_size",cfg.SoundBufferSize); - xmlcfg->addpar("oscil_size",cfg.OscilSize); - xmlcfg->addpar("swap_stereo",cfg.SwapStereo); - xmlcfg->addpar("bank_window_auto_close",cfg.BankUIAutoClose); - - xmlcfg->addpar("dump_notes_to_file",cfg.DumpNotesToFile); - xmlcfg->addpar("dump_append",cfg.DumpAppend); - xmlcfg->addparstr("dump_file",cfg.DumpFile); - - xmlcfg->addpar("gzip_compression",cfg.GzipCompression); - - xmlcfg->addpar("check_pad_synth",cfg.CheckPADsynth); - - xmlcfg->addparstr("bank_current",cfg.currentBankDir); - - xmlcfg->addpar("user_interface_mode",cfg.UserInterfaceMode); - xmlcfg->addpar("virtual_keyboard_layout",cfg.VirKeybLayout); - - - for (int i=0;ibeginbranch("BANKROOT",i); - xmlcfg->addparstr("bank_root",cfg.bankRootDirList[i]); - xmlcfg->endbranch(); - }; - - for (int i=0;ibeginbranch("PRESETSROOT",i); - xmlcfg->addparstr("presets_root",cfg.presetsDirList[i]); - xmlcfg->endbranch(); - }; - - xmlcfg->addpar("interpolation",cfg.Interpolation); - - //linux stuff - xmlcfg->addparstr("linux_oss_wave_out_dev",cfg.LinuxOSSWaveOutDev); - xmlcfg->addparstr("linux_oss_seq_in_dev",cfg.LinuxOSSSeqInDev); - - //windows stuff - xmlcfg->addpar("windows_wave_out_id",cfg.WindowsWaveOutId); - xmlcfg->addpar("windows_midi_in_id",cfg.WindowsMidiInId); - - xmlcfg->endbranch(); - - int tmp=cfg.GzipCompression; - cfg.GzipCompression=0; - xmlcfg->saveXMLfile(filename); - cfg.GzipCompression=tmp; - - delete(xmlcfg); -}; - -void Config::getConfigFileName(char *name, int namesize){ - name[0]=0; -#ifdef OS_LINUX - snprintf(name,namesize,"%s%s",getenv("HOME"),"/.zynaddsubfxXML.cfg"); -#else - snprintf(name,namesize,"%s","zynaddsubfxXML.cfg"); -#endif - -}; - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Config.h b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Config.h deleted file mode 100644 index 800a1823..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Config.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Config.h - Configuration file functions - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef CONFIG_H -#define CONFIG_H -#include "../globals.h" -#define MAX_STRING_SIZE 4000 -#define MAX_BANK_ROOT_DIRS 100 - -class Config{ - public: - Config(); - ~Config(); - struct { - char *LinuxOSSWaveOutDev,*LinuxOSSSeqInDev; - int SampleRate,SoundBufferSize,OscilSize,SwapStereo; - int WindowsWaveOutId,WindowsMidiInId; - int BankUIAutoClose; - int DumpNotesToFile,DumpAppend; - int GzipCompression; - int Interpolation; - char *DumpFile; - char *bankRootDirList[MAX_BANK_ROOT_DIRS],*currentBankDir; - char *presetsDirList[MAX_BANK_ROOT_DIRS]; - int CheckPADsynth; - int UserInterfaceMode; - int VirKeybLayout; - } cfg; - int winwavemax,winmidimax;//number of wave/midi devices on Windows - int maxstringsize; - - struct winmidionedevice{ - char *name; - }; - winmidionedevice *winmididevices; - - void clearbankrootdirlist(); - void clearpresetsdirlist(); - void init(); - void save(); - - private: - void readConfig(char *filename); - void saveConfig(char *filename); - void getConfigFileName(char *name,int namesize); -}; -#endif - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Dump.C b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Dump.C deleted file mode 100644 index 2b5bd810..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Dump.C +++ /dev/null @@ -1,99 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Dump.C - It dumps the notes to a text file - - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include -#include "Util.h" -#include "Dump.h" - -Dump dump; - -Dump::Dump(){ - file=NULL; - tick=0; - k=0; - keyspressed=0; -}; - -Dump::~Dump(){ - if (file!=NULL) { - double duration=(double)tick*(double) SOUND_BUFFER_SIZE/(double) SAMPLE_RATE; - fprintf(file,"\n# statistics: duration = %d seconds; keyspressed = %d\n\n\n\n",(int) duration,keyspressed); - fclose(file); - }; -}; - -void Dump::startnow(){ - if (file!=NULL) return;//the file is already open - - if (config.cfg.DumpNotesToFile!=0){ - if (config.cfg.DumpAppend!=0) file=fopen(config.cfg.DumpFile,"a"); - else file=fopen(config.cfg.DumpFile,"w"); - if (file==NULL) return; - if (config.cfg.DumpAppend!=0) fprintf(file,"%s","#************************************\n"); - - time_t tm=time(NULL); - - fprintf(file,"#date/time = %s\n",ctime(&tm)); - fprintf(file,"#1 tick = %g milliseconds\n",SOUND_BUFFER_SIZE*1000.0/SAMPLE_RATE); - fprintf(file,"SAMPLERATE = %d\n",SAMPLE_RATE); - fprintf(file,"TICKSIZE = %d #samples\n",SOUND_BUFFER_SIZE); - fprintf(file,"\n\nSTART\n"); - }; -}; - -void Dump::inctick(){ - tick++; -}; - - -void Dump::dumpnote(char chan,char note, char vel){ - if (file==NULL) return; - if (note==0) return; - if (vel==0) fprintf(file,"n %d -> %d %d \n",tick,chan,note);//note off - else fprintf(file,"N %d -> %d %d %d \n",tick,chan,note,vel);//note on - - if (vel!=0) keyspressed++; -#ifndef JACKAUDIOOUT - if (k++>25) { - fflush(file); - k=0; - }; -#endif -}; - -void Dump::dumpcontroller(char chan,unsigned int type,int par){ - if (file==NULL) return; - switch(type){ - case C_pitchwheel:fprintf(file,"P %d -> %d %d\n",tick,chan,par); - break; - default:fprintf(file,"C %d -> %d %d %d\n",tick,chan,type,par); - break; - }; -#ifndef JACKAUDIOOUT - if (k++>25) { - fflush(file); - k=0; - }; -#endif -}; - - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Dump.h b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Dump.h deleted file mode 100644 index e5a49570..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Dump.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Dump.h - It dumps the notes to a text file - - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef DUMP_H -#define DUMP_H - -#include - -class Dump{ - public: - Dump(); - ~Dump(); - void startnow(); - void inctick(); - - void dumpnote(char chan,char note, char vel); - void dumpcontroller(char chan,unsigned int type,int par); - - private: - FILE *file; - int tick; - int k; - int keyspressed; -}; -#endif diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Master.C b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Master.C deleted file mode 100644 index 99a1ac28..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Master.C +++ /dev/null @@ -1,680 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Master.C - It sends Midi Messages to Parts, receives samples from parts, - process them with system/insertion effects and mix them - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Master.h" - -#include -#include -#include - -#include - -Master::Master(){ - swaplr=0; - - busy = false; - fft=new FFTwrapper(OSCIL_SIZE); - - tmpmixl=new REALTYPE[SOUND_BUFFER_SIZE]; - tmpmixr=new REALTYPE[SOUND_BUFFER_SIZE]; - audiooutl=new REALTYPE[SOUND_BUFFER_SIZE]; - audiooutr=new REALTYPE[SOUND_BUFFER_SIZE]; - - ksoundbuffersamples=0; - ksoundbuffersamplelow=0.0; - oldsamplel=0.0;oldsampler=0.0; - shutup=0; - for (int npart=0;npartdefaults(); - part[npart]->Prcvchn=npart%NUM_MIDI_CHANNELS; - }; - - partonoff(0,1);//enable the first part - - for (int nefx=0;nefxdefaults(); - Pinsparts[nefx]=-1; - }; - - //System Effects init - for (int nefx=0;nefxdefaults(); - for (int npart=0;npartchangeeffect(1); - microtonal.defaults(); - ShutUp(); -}; - -/* - * Note On Messages (velocity=0 for NoteOff) - */ -void Master::NoteOn(unsigned char chan,unsigned char note,unsigned char velocity){ - dump.dumpnote(chan,note,velocity); - - noteon(chan,note,velocity); -}; - -/* - * Internal Note On (velocity=0 for NoteOff) - */ -void Master::noteon(unsigned char chan,unsigned char note,unsigned char velocity){ - int npart; - if (velocity!=0){ - for (npart=0;npartPrcvchn){ - fakepeakpart[npart]=velocity*2; - if (part[npart]->Penabled!=0) part[npart]->NoteOn(note,velocity,keyshift); - }; - }; - }else{ - this->NoteOff(chan,note); - }; - HDDRecorder.triggernow(); -}; - -/* - * Note Off Messages - */ -void Master::NoteOff(unsigned char chan,unsigned char note){ - dump.dumpnote(chan,note,0); - - noteoff(chan,note); -}; - -/* - * Internal Note Off - */ -void Master::noteoff(unsigned char chan,unsigned char note){ - int npart; - for (npart=0;npartPrcvchn) && (part[npart]->Penabled!=0)) - part[npart]->NoteOff(note); - }; -}; - -/* - * Controllers - */ -void Master::SetController(unsigned char chan,unsigned int type,int par){ - dump.dumpcontroller(chan,type,par); - - setcontroller(chan,type,par); -}; - -/* - * Internal Controllers - */ -void Master::setcontroller(unsigned char chan,unsigned int type,int par){ - if ((type==C_dataentryhi)||(type==C_dataentrylo)|| - (type==C_nrpnhi)||(type==C_nrpnlo)){//Process RPN and NRPN by the Master (ignore the chan) - ctl.setparameternumber(type,par); - - int parhi=-1,parlo=-1,valhi=-1,vallo=-1; - if (ctl.getnrpn(&parhi,&parlo,&valhi,&vallo)==0){//this is NRPN - //fprintf(stderr,"rcv. NRPN: %d %d %d %d\n",parhi,parlo,valhi,vallo); - switch (parhi){ - case 0x04://System Effects - if (parloseteffectpar_nolock(valhi,vallo); - }; - break; - case 0x08://Insertion Effects - if (parloseteffectpar_nolock(valhi,vallo); - }; - break; - - }; - }; - } else {//other controllers - for (int npart=0;npartPrcvchn) && (part[npart]->Penabled!=0)) - part[npart]->SetController(type,par); - }; - }; -}; - - -/* - * Enable/Disable a part - */ -void Master::partonoff(int npart,int what){ - if (npart>=NUM_MIDI_PARTS) return; - if (what==0){//disable part - fakepeakpart[npart]=0; - part[npart]->Penabled=0; - part[npart]->cleanup(); - for (int nefx=0;nefxcleanup(); - }; - }; - } else {//enabled - part[npart]->Penabled=1; - fakepeakpart[npart]=0; - }; -}; - -/* - * Master audio out (the final sound) - */ - -void Master::AudioOut(REALTYPE* outl, REALTYPE* outr) - { - int i,npart,nefx; - - //Swaps the Left channel with Right Channel (if it is asked for) - if (swaplr != 0) { - REALTYPE *tmp=outl; - outl = outr; - outr = tmp; - } - - //clean up the output samples - memset(outl, 0, sizeof(REALTYPE) * SOUND_BUFFER_SIZE); - memset(outr, 0, sizeof(REALTYPE) * SOUND_BUFFER_SIZE); - - //Compute part samples and store them part[npart]->partoutl,partoutr - for (npart=0; npartPenabled != 0) - part[npart]->ComputePartSmps(); - - //Insertion effects - for (nefx=0;nefx=0) { - int efxpart=Pinsparts[nefx]; - if (part[efxpart]->Penabled!=0) - insefx[nefx]->out(part[efxpart]->partoutl,part[efxpart]->partoutr); - } - } - - - //Apply the part volumes and pannings (after insertion effects) - for (npart = 0; npart < NUM_MIDI_PARTS; npart++) { - if (part[npart]->Penabled==0) - continue; - - REALTYPE newvol_l=part[npart]->volume; - REALTYPE newvol_r=part[npart]->volume; - REALTYPE oldvol_l=part[npart]->oldvolumel; - REALTYPE oldvol_r=part[npart]->oldvolumer; - REALTYPE pan=part[npart]->panning; - if (pan < 0.5) - newvol_l *= pan*2.0; - else - newvol_r *= (1.0-pan)*2.0; - - if (ABOVE_AMPLITUDE_THRESHOLD(oldvol_l,newvol_l)|| - ABOVE_AMPLITUDE_THRESHOLD(oldvol_r,newvol_r)){//the volume or the panning has changed and needs interpolation - - for (i=0;ipartoutl[i]*=vol_l; - part[npart]->partoutr[i]*=vol_r; - } - part[npart]->oldvolumel=newvol_l; - part[npart]->oldvolumer=newvol_r; - - } - else { - for (i=0;ipartoutl[i] *= newvol_l; - part[npart]->partoutr[i] *= newvol_r; - } - } - } - - - //System effects - for (nefx=0;nefxgeteffect()==0) continue;//the effect is disabled - - //Clean up the samples used by the system effects - memset(tmpmixl, 0, sizeof(REALTYPE) * SOUND_BUFFER_SIZE); - memset(tmpmixr, 0, sizeof(REALTYPE) * SOUND_BUFFER_SIZE); - - //Mix the channels according to the part settings about System Effect - for (npart=0;npartPenabled==0) continue; - - //the output volume of each part to system effect - REALTYPE vol=sysefxvol[nefx][npart]; - for (i=0;ipartoutl[i]*vol; - tmpmixr[i]+=part[npart]->partoutr[i]*vol; - }; - }; - - // system effect send to next ones - for (int nefxfrom=0;nefxfromefxoutl[i]*v; - tmpmixr[i]+=sysefx[nefxfrom]->efxoutr[i]*v; - }; - }; - }; - - sysefx[nefx]->out(tmpmixl,tmpmixr); - - //Add the System Effect to sound output - REALTYPE outvol=sysefx[nefx]->sysefxgetvolume(); - for (i=0;ipartoutl[i]; - outr[i] += part[npart]->partoutr[i]; - } - } - - //Insertion effects for Master Out - for (nefx=0;nefxout(outl, outr); - } - - //Master Volume - for (i = 0; i < SOUND_BUFFER_SIZE; i++) { - outl[i] *= volume; - outr[i] *= volume; - } - - //Peak computation (for vumeters) - vuoutpeakl=1e-12;vuoutpeakr=1e-12; - for (i=0;ivuoutpeakl) vuoutpeakl=fabs(outl[i]); - if (fabs(outr[i])>vuoutpeakr) vuoutpeakr=fabs(outr[i]); - }; - if ((vuoutpeakl>1.0)||(vuoutpeakr>1.0)) vuclipped=1; - if (vumaxoutpeaklPenabled!=0) { - REALTYPE *outl=part[npart]->partoutl, - *outr=part[npart]->partoutr; - for (i=0;ivuoutpeakpart[npart]) vuoutpeakpart[npart]=tmp; - }; - vuoutpeakpart[npart]*=volume; - } else { - if (fakepeakpart[npart]>1) fakepeakpart[npart]--; - }; - }; - - - //Shutup if it is asked (with fade-out) - if (shutup != 0) { - for (i = 0; i < SOUND_BUFFER_SIZE; i++) { - REALTYPE tmp=(SOUND_BUFFER_SIZE-i)/(REALTYPE) SOUND_BUFFER_SIZE; - outl[i] *= tmp; - outr[i] *= tmp; - } - ShutUp(); - } - - //update the LFO's time - LFOParams::time++; - - if (HDDRecorder.recording()) - HDDRecorder.recordbuffer(outl,outr); - dump.inctick(); - }; - -//--------------------------------------------------------- -// GetAudioOutSamples -//--------------------------------------------------------- - -void Master::GetAudioOutSamples(int nsamples, REALTYPE* outl, REALTYPE* outr) - { - int dstOffset = 0; - while (nsamples) { - if (ksoundbuffersamples <= 0) { - AudioOut(audiooutl, audiooutr); - ksoundbuffersamples = SOUND_BUFFER_SIZE; - } - int n = nsamples > ksoundbuffersamples ? ksoundbuffersamples : nsamples; - int srcOffset = SOUND_BUFFER_SIZE - ksoundbuffersamples; - memcpy(outl + dstOffset, audiooutl + srcOffset, n * sizeof(REALTYPE)); - memcpy(outr + dstOffset, audiooutr + srcOffset, n * sizeof(REALTYPE)); - nsamples -= n; - dstOffset += n; - ksoundbuffersamples -= n; - } - } - -Master::~Master(){ - for (int npart=0;npartcleanup(); - fakepeakpart[npart]=0; - }; - for (int nefx=0;nefxcleanup(); - for (int nefx=0;nefxcleanup(); - vuresetpeaks(); - shutup=0; -}; - - -/* - * Reset peaks and clear the "cliped" flag (for VU-meter) - */ -void Master::vuresetpeaks(){ - vuoutpeakl=1e-9;vuoutpeakr=1e-9;vumaxoutpeakl=1e-9;vumaxoutpeakr=1e-9; - vuclipped=0; -}; - - - -void Master::applyparameters(){ - for (int npart=0;npartapplyparameters(); - }; -}; - -void Master::add2XML(XMLwrapper *xml){ - xml->addpar("volume",Pvolume); - xml->addpar("key_shift",Pkeyshift); - xml->addparbool("nrpn_receive",ctl.NRPN.receive); - - xml->beginbranch("MICROTONAL"); - microtonal.add2XML(xml); - xml->endbranch(); - - for (int npart=0;npartbeginbranch("PART",npart); - part[npart]->add2XML(xml); - xml->endbranch(); - }; - - xml->beginbranch("SYSTEM_EFFECTS"); - for (int nefx=0;nefxbeginbranch("SYSTEM_EFFECT",nefx); - xml->beginbranch("EFFECT"); - sysefx[nefx]->add2XML(xml); - xml->endbranch(); - - for (int pefx=0;pefxbeginbranch("VOLUME",pefx); - xml->addpar("vol",Psysefxvol[nefx][pefx]); - xml->endbranch(); - }; - - for (int tonefx=nefx+1;tonefxbeginbranch("SENDTO",tonefx); - xml->addpar("send_vol",Psysefxsend[nefx][tonefx]); - xml->endbranch(); - }; - - - xml->endbranch(); - }; - xml->endbranch(); - - xml->beginbranch("INSERTION_EFFECTS"); - for (int nefx=0;nefxbeginbranch("INSERTION_EFFECT",nefx); - xml->addpar("part",Pinsparts[nefx]); - - xml->beginbranch("EFFECT"); - insefx[nefx]->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - }; - - xml->endbranch(); - -}; - - -int Master::getalldata(char **data){ - XMLwrapper *xml=new XMLwrapper(); - - xml->beginbranch("MASTER"); - - busy = true; - add2XML(xml); - busy = false; - - xml->endbranch(); - - *data=xml->getXMLdata(); - delete (xml); - return(strlen(*data)+1); -}; - -void Master::putalldata(char *data,int size){ - XMLwrapper *xml=new XMLwrapper(); - if (!xml->putXMLdata(data)) { - delete(xml); - return; - }; - - if (xml->enterbranch("MASTER")==0) return; - - busy = true; - getfromXML(xml); - busy = false; - - xml->exitbranch(); - - delete(xml); -}; - -int Master::saveXML(char *filename){ - XMLwrapper *xml=new XMLwrapper(); - - xml->beginbranch("MASTER"); - add2XML(xml); - xml->endbranch(); - - int result=xml->saveXMLfile(filename); - delete (xml); - return(result); -}; - - - -int Master::loadXML(char *filename){ - XMLwrapper *xml=new XMLwrapper(); - if (xml->loadXMLfile(filename)<0) { - delete(xml); - return(-1); - }; - - if (xml->enterbranch("MASTER")==0) return(-10); - getfromXML(xml); - xml->exitbranch(); - - delete(xml); - return(0); -}; - -void Master::getfromXML(XMLwrapper *xml){ - setPvolume(xml->getpar127("volume",Pvolume)); - setPkeyshift(xml->getpar127("key_shift",Pkeyshift)); - ctl.NRPN.receive=xml->getparbool("nrpn_receive",ctl.NRPN.receive); - - - part[0]->Penabled=0; - for (int npart=0;npartenterbranch("PART",npart)==0) continue; - part[npart]->getfromXML(xml); - xml->exitbranch(); - }; - - if (xml->enterbranch("MICROTONAL")){ - microtonal.getfromXML(xml); - xml->exitbranch(); - }; - - sysefx[0]->changeeffect(0); - if (xml->enterbranch("SYSTEM_EFFECTS")){ - for (int nefx=0;nefxenterbranch("SYSTEM_EFFECT",nefx)==0) continue; - if (xml->enterbranch("EFFECT")){ - sysefx[nefx]->getfromXML(xml); - xml->exitbranch(); - }; - - for (int partefx=0;partefxenterbranch("VOLUME",partefx)==0) continue; - setPsysefxvol(partefx,nefx,xml->getpar127("vol",Psysefxvol[partefx][nefx])); - xml->exitbranch(); - }; - - for (int tonefx=nefx+1;tonefxenterbranch("SENDTO",tonefx)==0) continue; - setPsysefxsend(nefx,tonefx,xml->getpar127("send_vol",Psysefxsend[nefx][tonefx])); - xml->exitbranch(); - }; - xml->exitbranch(); - }; - xml->exitbranch(); - }; - - - if (xml->enterbranch("INSERTION_EFFECTS")){ - for (int nefx=0;nefxenterbranch("INSERTION_EFFECT",nefx)==0) continue; - Pinsparts[nefx]=xml->getpar("part",Pinsparts[nefx],-2,NUM_MIDI_PARTS); - if (xml->enterbranch("EFFECT")){ - insefx[nefx]->getfromXML(xml); - xml->exitbranch(); - }; - xml->exitbranch(); - - }; - - xml->exitbranch(); - }; - -}; - - - - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Master.h b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Master.h deleted file mode 100644 index 51feabdd..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Master.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Master.h - It sends Midi Messages to Parts, receives samples from parts, - process them with system/insertion effects and mix them - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef MASTER_H -#define MASTER_H - -#include "../globals.h" -#include "../Effects/EffectMgr.h" -#include "Part.h" -#include "../Output/Recorder.h" -#include "Microtonal.h" - -#include "Bank.h" -#include "Dump.h" -#include "../Seq/Sequencer.h" -#include "XMLwrapper.h" - -extern Dump dump; -class Master{ - public: - Master(); - ~Master(); - - //saves all settings to a XML file - //returns 0 for ok or <0 if there is an error - int saveXML(char *filename); - - //this adds the parameters to the XML data - void add2XML(XMLwrapper *xml); - - void defaults(); - - - //loads all settings from a XML file - //returns 0 for ok or -1 if there is an error - int loadXML(char *filename); - void applyparameters(); - - void getfromXML(XMLwrapper *xml); - - //get all data to a newly allocated array (used for VST) - //returns the datasize - int getalldata(char **data); - //put all data from the *data array to zynaddsubfx parameters (used for VST) - void putalldata(char *data,int size); - - - - //Midi IN - void NoteOn(unsigned char chan,unsigned char note,unsigned char velocity); - void NoteOff(unsigned char chan,unsigned char note); - void SetController(unsigned char chan,unsigned int type,int par); - //void NRPN... - - - void ShutUp(); - int shutup; - - //Audio Output - void AudioOut(REALTYPE *outl,REALTYPE *outr); - //Audio Output (for callback mode). This allows the program to be controled by an external program - void GetAudioOutSamples(int nsamples, REALTYPE *outl,REALTYPE *outr); - - - void partonoff(int npart,int what); - - //parts - Part *part[NUM_MIDI_PARTS]; - - //parameters - unsigned char Pvolume; - unsigned char Pkeyshift; - unsigned char Psysefxvol[NUM_SYS_EFX][NUM_MIDI_PARTS]; - unsigned char Psysefxsend[NUM_SYS_EFX][NUM_SYS_EFX]; - - //parameters control - void setPvolume(char Pvolume_); - void setPkeyshift(char Pkeyshift_); - void setPsysefxvol(int Ppart,int Pefx,char Pvol); - void setPsysefxsend(int Pefxfrom,int Pefxto,char Pvol); - - //effects - EffectMgr *sysefx[NUM_SYS_EFX];//system - EffectMgr *insefx[NUM_INS_EFX];//insertion -// void swapcopyeffects(int what,int type,int neff1,int neff2); - - //HDD recorder - Recorder HDDRecorder; - - //part that's apply the insertion effect; -1 to disable - short int Pinsparts[NUM_INS_EFX]; - - //peaks for VU-meter - void vuresetpeaks(); - REALTYPE vuoutpeakl,vuoutpeakr,vumaxoutpeakl,vumaxoutpeakr,vurmspeakl,vurmspeakr; - int vuclipped; - - //peaks for part VU-meters - REALTYPE vuoutpeakpart[NUM_MIDI_PARTS]; - unsigned char fakepeakpart[NUM_MIDI_PARTS];//this is used to compute the "peak" when the part is disabled - - Controller ctl; - int swaplr;//1 if L and R are swapped - - //Sequencer - Sequencer seq; - - //other objects - Microtonal microtonal; - Bank bank; - - FFTwrapper *fft; - volatile bool busy; // if true, is busy and cannot accept - // events or deliver data - void lock() { busy = true; } - void unlock() { busy = false; } - - private: - REALTYPE volume; - REALTYPE sysefxvol[NUM_SYS_EFX][NUM_MIDI_PARTS]; - REALTYPE sysefxsend[NUM_SYS_EFX][NUM_SYS_EFX]; - - //Temporary mixing samples for part samples which is sent to system effect - REALTYPE *tmpmixl; - REALTYPE *tmpmixr; - - - int keyshift; - - //Audio Output samples (if it used GetAudioOutSamples - eg. for Jack output; elsewhere is unused) - REALTYPE *audiooutl; - REALTYPE *audiooutr; - - int ksoundbuffersamples; // number of valid samples in audiooutr/l - REALTYPE ksoundbuffersamplelow;//this is used for resampling (eg. if Jack samplerate!= SAMPLE_RATE) - REALTYPE oldsamplel,oldsampler;//this is used for resampling - - //Theese are called by the NoteOn, NoteOff,SetController (which are from external sources like MIDI, Virtual Keyboard) - //and are called by internal parts of the program (like sequencer) - void noteon(unsigned char chan,unsigned char note,unsigned char velocity); - void noteoff(unsigned char chan,unsigned char note); - void setcontroller(unsigned char chan,unsigned int type,int par); -}; - - -#endif - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Microtonal.C b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Microtonal.C deleted file mode 100644 index 30a3a71e..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Microtonal.C +++ /dev/null @@ -1,514 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Microtonal.C - Tuning settings and microtonal capabilities - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#include -#include "Microtonal.h" - -#define MAX_LINE_SIZE 80 - -Microtonal::Microtonal(){ - Pname=new unsigned char[MICROTONAL_MAX_NAME_LEN]; - Pcomment=new unsigned char[MICROTONAL_MAX_NAME_LEN]; - defaults(); -}; - -void Microtonal::defaults(){ - Pinvertupdown=0; - Pinvertupdowncenter=60; - octavesize=12; - Penabled=0; - PAnote=69; - PAfreq=440.0; - Pscaleshift=64; - - Pfirstkey=0;Plastkey=127; - Pmiddlenote=60;Pmapsize=12; - Pmappingenabled=0; - - for (int i=0;i<128;i++) Pmapping[i]=i; - - for (int i=0;iPlastkey)) return (-1.0); - //Compute how many mapped keys are from middle note to reference note - //and find out the proportion between the freq. of middle note and "A" note - int tmp=PAnote-Pmiddlenote,minus=0; - if (tmp<0) { tmp=-tmp; minus=1; }; - int deltanote=0; - for (int i=0;i=0) deltanote++; - REALTYPE rap_anote_middlenote=(deltanote==0) ? (1.0) : (octave[(deltanote-1)%octavesize].tuning); - if (deltanote!=0) rap_anote_middlenote*=pow(octave[octavesize-1].tuning,(deltanote-1)/octavesize); - if (minus!=0) rap_anote_middlenote=1.0/rap_anote_middlenote; - - //Convert from note (midi) to degree (note from the tunning) - int degoct=(note-(int)Pmiddlenote+(int) Pmapsize*200)/(int)Pmapsize-200; - int degkey=(note-Pmiddlenote+(int)Pmapsize*100)%Pmapsize; - degkey=Pmapping[degkey]; - if (degkey<0) return(-1.0);//this key is not mapped - - //invert the keyboard upside-down if it is asked for - //TODO: do the right way by using Pinvertupdowncenter - if (Pinvertupdown!=0){ - degkey=octavesize-degkey-1; - degoct=-degoct; - }; - //compute the frequency of the note - degkey=degkey+scaleshift; - degoct+=degkey/octavesize; - degkey%=octavesize; - - REALTYPE freq=(degkey==0) ? (1.0):octave[degkey-1].tuning; - freq*=pow(octave[octavesize-1].tuning,degoct); - freq*=PAfreq/rap_anote_middlenote; - freq*=globalfinedetunerap; - if (scaleshift!=0) freq/=octave[scaleshift-1].tuning; - return(freq*rap_keyshift); - } else {//if the mapping is disabled - int nt=note-PAnote+scaleshift; - int ntkey=(nt+(int)octavesize*100)%octavesize; - int ntoct=(nt-ntkey)/octavesize; - - REALTYPE oct=octave[octavesize-1].tuning; - REALTYPE freq=octave[(ntkey+octavesize-1)%octavesize].tuning*pow(oct,ntoct)*PAfreq; - if (ntkey==0) freq/=oct; - if (scaleshift!=0) freq/=octave[scaleshift-1].tuning; -// fprintf(stderr,"note=%d freq=%.3f cents=%d\n",note,freq,(int)floor(log(freq/PAfreq)/log(2.0)*1200.0+0.5)); - freq*=globalfinedetunerap; - return(freq*rap_keyshift); - }; -}; - - -/* - * Convert a line to tunings; returns -1 if it ok - */ -int Microtonal::linetotunings(unsigned int nline,const char *line){ - int x1=-1,x2=-1,type=-1; - REALTYPE x=-1.0,tmp,tuning=1.0; - if (strstr(line,"/")==NULL){ - if (strstr(line,".")==NULL){// M case (M=M/1) - sscanf(line,"%d",&x1); - x2=1; - type=2;//division - } else {// float number case - sscanf(line,"%f",&x); - if (x<0.000001) return(1); - type=1;//float type(cents) - }; - } else {// M/N case - sscanf(line,"%d/%d",&x1,&x2); - if ((x1<0)||(x2<0)) return(1); - if (x2==0) x2=1; - type=2;//division - }; - - if (x1<=0) x1=1;//not allow zero frequency sounds (consider 0 as 1) - - //convert to float if the number are too big - if ((type==2)&&((x1>(128*128*128-1))||(x2>(128*128*128-1)))){ - type=1; - x=((REALTYPE) x1)/x2; - }; - switch (type){ - case 1: x1=(int) floor(x); - tmp=fmod(x,1.0); - x2=(int) (floor (tmp*1e6)); - tuning=pow(2.0,x/1200.0); - break; - case 2: x=((REALTYPE)x1)/x2; - tuning=x; - break; - }; - - tmpoctave[nline].tuning=tuning; - tmpoctave[nline].type=type; - tmpoctave[nline].x1=x1; - tmpoctave[nline].x2=x2; - - return(-1);//ok -}; - -/* - * Convert the text to tunnings - */ -int Microtonal::texttotunings(const char *text){ - unsigned int i,k=0,nl=0; - char *lin; - lin=new char[MAX_LINE_SIZE+1]; - while (kMAX_OCTAVE_SIZE) nl=MAX_OCTAVE_SIZE; - if (nl==0) return(-2);//the input is empty - octavesize=nl; - for (i=0;i127) break; - }; - delete [] lin; - - if (tx==0) tx=1; - Pmapsize=tx; -}; - -/* - * Convert tunning to text line - */ -void Microtonal::tuningtoline(int n,char *line,int maxn){ - if ((n>octavesize) || (n>MAX_OCTAVE_SIZE)) { - line[0]='\0'; - return; - }; - if (octave[n].type==1) snprintf(line,maxn,"%d.%d",octave[n].x1,octave[n].x2); - if (octave[n].type==2) snprintf(line,maxn,"%d/%d",octave[n].x1,octave[n].x2); -}; - - -int Microtonal::loadline(FILE *file,char *line){ - do { - if (fgets(line,500,file)==0) return(1); - } while (line[0]=='!'); - return(0); -}; -/* - * Loads the tunnings from a scl file - */ -int Microtonal::loadscl(const char *filename){ - FILE *file=fopen(filename, "r"); - char tmp[500]; - fseek(file,0,SEEK_SET); - //loads the short description - if (loadline(file,&tmp[0])!=0) return(2); - for (int i=0;i<500;i++) if (tmp[i]<32) tmp[i]=0; - snprintf((char *) Pname,MICROTONAL_MAX_NAME_LEN,"%s",tmp); - snprintf((char *) Pcomment,MICROTONAL_MAX_NAME_LEN,"%s",tmp); - //loads the number of the notes - if (loadline(file,&tmp[0])!=0) return(2); - int nnotes=MAX_OCTAVE_SIZE; - sscanf(&tmp[0],"%d",&nnotes); - if (nnotes>MAX_OCTAVE_SIZE) return (2); - //load the tunnings - for (int nline=0;nline127) x=127;//just in case... - Pmapsize=x; - //loads first MIDI note to retune - if (loadline(file,&tmp[0])!=0) return(2); - if (sscanf(&tmp[0],"%d",&x)==0) return(2); - if (x<1) x=0;if (x>127) x=127;//just in case... - Pfirstkey=x; - //loads last MIDI note to retune - if (loadline(file,&tmp[0])!=0) return(2); - if (sscanf(&tmp[0],"%d",&x)==0) return(2); - if (x<1) x=0;if (x>127) x=127;//just in case... - Plastkey=x; - //loads last the middle note where scale fro scale degree=0 - if (loadline(file,&tmp[0])!=0) return(2); - if (sscanf(&tmp[0],"%d",&x)==0) return(2); - if (x<1) x=0;if (x>127) x=127;//just in case... - Pmiddlenote=x; - //loads the reference note - if (loadline(file,&tmp[0])!=0) return(2); - if (sscanf(&tmp[0],"%d",&x)==0) return(2); - if (x<1) x=0;if (x>127) x=127;//just in case... - PAnote=x; - //loads the reference freq. - if (loadline(file,&tmp[0])!=0) return(2); - REALTYPE tmpPAfreq=440.0; - if (sscanf(&tmp[0],"%f",&tmpPAfreq)==0) return(2); - PAfreq=tmpPAfreq; - - //the scale degree(which is the octave) is not loaded, it is obtained by the tunnings with getoctavesize() method - if (loadline(file,&tmp[0])!=0) return(2); - - //load the mappings - if (Pmapsize!=0){ - for (int nline=0;nlineaddparstr("name",(char *) Pname); - xml->addparstr("comment",(char *) Pcomment); - - xml->addparbool("invert_up_down",Pinvertupdown); - xml->addparbool("invert_up_down_center",Pinvertupdowncenter); - - xml->addparbool("enabled",Penabled); - xml->addpar("global_fine_detune",Pglobalfinedetune); - - xml->addpar("a_note",PAnote); - xml->addparreal("a_freq",PAfreq); - - if ((Penabled==0)&&(xml->minimal)) return; - - xml->beginbranch("SCALE"); - xml->addpar("scale_shift",Pscaleshift); - xml->addpar("first_key",Pfirstkey); - xml->addpar("last_key",Plastkey); - xml->addpar("middle_note",Pmiddlenote); - - xml->beginbranch("OCTAVE"); - xml->addpar("octave_size",octavesize); - for (int i=0;ibeginbranch("DEGREE",i); - if (octave[i].type==1){ - xml->addparreal("cents",octave[i].tuning); - }; - if (octave[i].type==2){ - xml->addpar("numerator",octave[i].x1); - xml->addpar("denominator",octave[i].x2); - }; - xml->endbranch(); - }; - xml->endbranch(); - - xml->beginbranch("KEYBOARD_MAPPING"); - xml->addpar("map_size",Pmapsize); - xml->addpar("mapping_enabled",Pmappingenabled); - for (int i=0;ibeginbranch("KEYMAP",i); - xml->addpar("degree",Pmapping[i]); - xml->endbranch(); - }; - xml->endbranch(); - xml->endbranch(); -}; - -void Microtonal::getfromXML(XMLwrapper *xml){ - xml->getparstr("name",(char *) Pname,MICROTONAL_MAX_NAME_LEN); - xml->getparstr("comment",(char *) Pcomment,MICROTONAL_MAX_NAME_LEN); - - Pinvertupdown=xml->getparbool("invert_up_down",Pinvertupdown); - Pinvertupdowncenter=xml->getparbool("invert_up_down_center",Pinvertupdowncenter); - - Penabled=xml->getparbool("enabled",Penabled); - Pglobalfinedetune=xml->getpar127("global_fine_detune",Pglobalfinedetune); - - PAnote=xml->getpar127("a_note",PAnote); - PAfreq=xml->getparreal("a_freq",PAfreq,1.0,10000.0); - - if (xml->enterbranch("SCALE")){ - Pscaleshift=xml->getpar127("scale_shift",Pscaleshift); - Pfirstkey=xml->getpar127("first_key",Pfirstkey); - Plastkey=xml->getpar127("last_key",Plastkey); - Pmiddlenote=xml->getpar127("middle_note",Pmiddlenote); - - if (xml->enterbranch("OCTAVE")){ - octavesize=xml->getpar127("octave_size",octavesize); - for (int i=0;ienterbranch("DEGREE",i)==0) continue; - octave[i].x2=0; - octave[i].tuning=xml->getparreal("cents",octave[i].tuning); - octave[i].x1=xml->getpar127("numerator",octave[i].x1); - octave[i].x2=xml->getpar127("denominator",octave[i].x2); - - if (octave[i].x2!=0) octave[i].type=2; - else octave[i].type=1; - - xml->exitbranch(); - }; - xml->exitbranch(); - }; - - if (xml->enterbranch("KEYBOARD_MAPPING")){ - Pmapsize=xml->getpar127("map_size",Pmapsize); - Pmappingenabled=xml->getpar127("mapping_enabled",Pmappingenabled); - for (int i=0;ienterbranch("KEYMAP",i)==0) continue; - Pmapping[i]=xml->getpar127("degree",Pmapping[i]); - xml->exitbranch(); - }; - xml->exitbranch(); - }; - xml->exitbranch(); - }; -}; - - -int Microtonal::saveXML(char *filename){ - XMLwrapper *xml=new XMLwrapper(); - - xml->beginbranch("MICROTONAL"); - add2XML(xml); - xml->endbranch(); - - int result=xml->saveXMLfile(filename); - delete (xml); - return(result); -}; - -int Microtonal::loadXML(char *filename){ - XMLwrapper *xml=new XMLwrapper(); - if (xml->loadXMLfile(filename)<0) { - delete(xml); - return(-1); - }; - - if (xml->enterbranch("MICROTONAL")==0) return(-10); - getfromXML(xml); - xml->exitbranch(); - - delete(xml); - return(0); -}; - - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Microtonal.h b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Microtonal.h deleted file mode 100644 index 60ffc4cf..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Microtonal.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Microtonal.h - Tuning settings and microtonal capabilities - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef MICROTONAL_H -#define MICROTONAL_H - -#include "../globals.h" -#include "XMLwrapper.h" - -#define MAX_OCTAVE_SIZE 128 -#define MICROTONAL_MAX_NAME_LEN 120 - -#include - -class Microtonal{ - public: - Microtonal(); - ~Microtonal(); - void defaults(); - REALTYPE getnotefreq(int note,int keyshift); - - - //Parameters - //if the keys are inversed (the pitch is lower to keys from the right direction) - unsigned char Pinvertupdown; - - //the central key of the inversion - unsigned char Pinvertupdowncenter; - - //0 for 12 key temperate scale, 1 for microtonal - unsigned char Penabled; - - //the note of "A" key - unsigned char PAnote; - - //the frequency of the "A" note - REALTYPE PAfreq; - - //if the scale is "tuned" to a note, you can tune to other note - unsigned char Pscaleshift; - - //first and last key (to retune) - unsigned char Pfirstkey; - unsigned char Plastkey; - - //The middle note where scale degree 0 is mapped to - unsigned char Pmiddlenote; - - //Map size - unsigned char Pmapsize; - - //Mapping ON/OFF - unsigned char Pmappingenabled; - //Mapping (keys) - short int Pmapping[128]; - - unsigned char Pglobalfinedetune; - - // Functions - unsigned char getoctavesize(); - void tuningtoline(int n,char *line,int maxn); - int loadscl(const char *filename);//load the tunnings from a .scl file - int loadkbm(const char *filename);//load the mapping from .kbm file - int texttotunings(const char *text); - void texttomapping(const char *text); - unsigned char *Pname; - unsigned char *Pcomment; - - void add2XML(XMLwrapper *xml); - void getfromXML(XMLwrapper *xml); - int saveXML(char *filename); - int loadXML(char *filename); - - private: - int linetotunings(unsigned int nline,const char *line); - int loadline(FILE *file,char *line);//loads a line from the text file, while ignoring the lines beggining with "!" - unsigned char octavesize; - struct { - unsigned char type;//1 for cents or 2 for division - - // the real tuning (eg. +1.05946 for one halftone) - // or 2.0 for one octave - REALTYPE tuning; - - //the real tunning is x1/x2 - unsigned int x1,x2; - - } octave[MAX_OCTAVE_SIZE],tmpoctave[MAX_OCTAVE_SIZE]; - -}; - -#endif diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Part.C b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Part.C deleted file mode 100644 index ceeeb7b6..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Part.C +++ /dev/null @@ -1,881 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Part.C - Part implementation - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Master.h" -#include "Part.h" -#include "Microtonal.h" -#include -#include -#include - -Part::Part(Microtonal *microtonal_,FFTwrapper *fft_, Master* master_){ - microtonal=microtonal_; - fft=fft_; - master=master_; - partoutl=new REALTYPE [SOUND_BUFFER_SIZE]; - partoutr=new REALTYPE [SOUND_BUFFER_SIZE]; - tmpoutl=new REALTYPE [SOUND_BUFFER_SIZE]; - tmpoutr=new REALTYPE [SOUND_BUFFER_SIZE]; - - for (int n=0;ndefaults(); - kit[0].subpars->defaults(); - kit[0].padpars->defaults(); - - for (int nefx=0;nefxdefaults(); - Pefxroute[nefx]=0;//route to next effect - }; - -}; - - - -/* - * Cleanup the part - */ -void Part::cleanup(){ - for (int k=0;kcleanup(); - for (int n=0;nPmaxkey)) return; - - pos=-1; - for (i=0;i POLIPHONY) - (Part.C::NoteOn(..))\n"); - } else { - if (Pnoteon!=0){ - //start the note - partnote[pos].status=KEY_PLAYING; - partnote[pos].note=note; - - //this computes the velocity sensing of the part - REALTYPE vel=VelF(velocity/127.0,Pvelsns); - - //compute the velocity offset - vel+=(Pveloffs-64.0)/64.0; - if (vel<0.0) vel=0.0; else if (vel>1.0) vel=1.0; - - //compute the keyshift - int partkeyshift=(int)Pkeyshift-64; - int keyshift=masterkeyshift+partkeyshift; - - //initialise note frequency - REALTYPE notebasefreq; - if (Pdrummode==0){ - notebasefreq=microtonal->getnotefreq(note,keyshift); - if (notebasefreq<0.0) return;//the key is no mapped - } else { - notebasefreq=440.0*pow(2.0,(note-69.0)/12.0); - }; - - //Portamento - if (oldfreq<1.0) oldfreq=notebasefreq;//this is only the first note is played - - int portamento=ctl.initportamento(oldfreq,notebasefreq); - - if (portamento!=0) ctl.portamento.noteusing=pos; - oldfreq=notebasefreq; - - partnote[pos].itemsplaying=0; - if (Pkitmode==0){//init the notes for the "normal mode" - partnote[pos].kititem[0].sendtoparteffect=0; - if (kit[0].Padenabled!=0) partnote[pos].kititem[0].adnote=new ADnote(kit[0].adpars,&ctl,notebasefreq,vel,portamento,note); - if (kit[0].Psubenabled!=0) partnote[pos].kititem[0].subnote=new SUBnote(kit[0].subpars,&ctl,notebasefreq,vel,portamento,note); - if (kit[0].Ppadenabled!=0) partnote[pos].kititem[0].padnote=new PADnote(kit[0].padpars,&ctl,notebasefreq,vel,portamento,note); - if ((kit[0].Padenabled!=0)||(kit[0].Psubenabled!=0)||(kit[0].Ppadenabled!=0)) partnote[pos].itemsplaying++; - - } else {//init the notes for the "kit mode" - for (int item=0;itemkit[item].Pmaxkey)) continue; - - int ci=partnote[pos].itemsplaying;//ci=current item - - partnote[pos].kititem[ci].sendtoparteffect=( kit[item].Psendtoparteffect=0;i--){ //first note in, is first out if there are same note multiple times - if ((partnote[i].status==KEY_PLAYING)&&(partnote[i].note==note)) { - if (ctl.sustain.sustain==0){ //the sustain pedal is not pushed - RelaseNotePos(i); - break; - } else {//the sustain pedal is pushed - partnote[i].status=KEY_RELASED_AND_SUSTAINED; - }; - }; - }; -}; - -/* - * Controllers - */ -void Part::SetController(unsigned int type,int par){ - switch (type){ - case C_pitchwheel:ctl.setpitchwheel(par); - break; - case C_expression:ctl.setexpression(par); - setPvolume(Pvolume);//update the volume - break; - case C_portamento:ctl.setportamento(par); - break; - case C_panning:ctl.setpanning(par); - setPpanning(Ppanning);//update the panning - break; - case C_filtercutoff:ctl.setfiltercutoff(par); - break; - case C_filterq:ctl.setfilterq(par); - break; - case C_bandwidth:ctl.setbandwidth(par); - break; - case C_modwheel:ctl.setmodwheel(par); - break; - case C_fmamp:ctl.setfmamp(par); - break; - case C_volume:ctl.setvolume(par); - if (ctl.volume.receive!=0) volume=ctl.volume.volume; - else setPvolume(Pvolume); - break; - case C_sustain:ctl.setsustain(par); - if (ctl.sustain.sustain==0) RelaseSustainedKeys(); - break; - case C_allsoundsoff:AllNotesOff();//Panic - break; - case C_resetallcontrollers: - ctl.resetall(); - RelaseSustainedKeys(); - if (ctl.volume.receive!=0) volume=ctl.volume.volume; - else setPvolume(Pvolume); - setPvolume(Pvolume);//update the volume - setPpanning(Ppanning);//update the panning - - for (int item=0;itemGlobalPar.Reson-> - sendcontroller(C_resonance_center,1.0); - - kit[item].adpars->GlobalPar.Reson-> - sendcontroller(C_resonance_bandwidth,1.0); - }; - //more update to add here if I add controllers - break; - case C_allnotesoff:RelaseAllKeys(); - break; - case C_resonance_center: - ctl.setresonancecenter(par); - for (int item=0;itemGlobalPar.Reson-> - sendcontroller(C_resonance_center,ctl.resonancecenter.relcenter); - }; - break; - case C_resonance_bandwidth: - ctl.setresonancebw(par); - kit[0].adpars->GlobalPar.Reson-> - sendcontroller(C_resonance_bandwidth,ctl.resonancebandwidth.relbw); - break; - }; -}; -/* - * Relase the sustained keys - */ - -void Part::RelaseSustainedKeys(){ - for (int i=0;irelasekey(); - - if (partnote[pos].kititem[j].subnote!=NULL) - if (partnote[pos].kititem[j].subnote!=NULL) - partnote[pos].kititem[j].subnote->relasekey(); - - if (partnote[pos].kititem[j].padnote!=NULL) - if (partnote[pos].kititem[j].padnote) - partnote[pos].kititem[j].padnote->relasekey(); - }; - partnote[pos].status=KEY_RELASED; -}; - - -/* - * Kill note at position - */ -void Part::KillNotePos(int pos){ - partnote[pos].status=KEY_OFF; - partnote[pos].note=-1; - partnote[pos].time=0; - partnote[pos].itemsplaying=0; - - for (int j=0;jPkeylimit=Pkeylimit; - int keylimit=Pkeylimit; - if (keylimit==0) keylimit=POLIPHONY-5; - - //release old keys if the number of notes>keylimit - if (Ppolymode!=0){ - int notecount=0; - for (int i=0;ikeylimit){//find out the oldest note - for (int i=0;imaxtime)){ - maxtime=partnote[i].time; - oldestnotepos=i; - }; - }; - }; - if (oldestnotepos!=-1) RelaseNotePos(oldestnotepos); - }; -}; - - -/* - * Prepare all notes to be turned off - */ -void Part::AllNotesOff(){ - killallnotes=1; -}; - - -/* - * Compute Part samples and store them in the partoutl[] and partoutr[] - */ -void Part::ComputePartSmps(){ - int i, k; - int noteplay;//0 if there is nothing activated - for (int nefx=0;nefxready!=0) adnote->noteout(&tmpoutl[0],&tmpoutr[0]); - else { - memset(tmpoutl, 0, sizeof(REALTYPE) * SOUND_BUFFER_SIZE); - memset(tmpoutr, 0, sizeof(REALTYPE) * SOUND_BUFFER_SIZE); - } - if (adnote->finished()!=0){ - delete (adnote); - partnote[k].kititem[item].adnote=NULL; - }; - for (i=0;iready!=0) subnote->noteout(&tmpoutl[0],&tmpoutr[0]); - else { - memset(tmpoutl, 0, sizeof(REALTYPE) * SOUND_BUFFER_SIZE); - memset(tmpoutr, 0, sizeof(REALTYPE) * SOUND_BUFFER_SIZE); - } - - for (i=0;ifinished()!=0){ - delete (subnote); - partnote[k].kititem[item].subnote=NULL; - }; - }; - //get from the PADnote - if (padnote!=NULL) { - noteplay++; - if (padnote->ready!=0) padnote->noteout(&tmpoutl[0],&tmpoutr[0]); - else { - memset(tmpoutl, 0, sizeof(REALTYPE) * SOUND_BUFFER_SIZE); - memset(tmpoutr, 0, sizeof(REALTYPE) * SOUND_BUFFER_SIZE); - } - if (padnote->finished()!=0){ - delete (padnote); - partnote[k].kititem[item].padnote=NULL; - }; - for (i=0;iout(partfxinputl[nefx],partfxinputr[nefx]); - if (Pefxroute[nefx]==2){ - for (i=0;iefxoutl[i]; - partfxinputr[nefx+1][i]+=partefx[nefx]->efxoutr[i]; - }; - }; - }; - int routeto=((Pefxroute[nefx]==0) ? nefx+1 : NUM_PART_EFX); - for (i=0;icleanup(); - }; - }; - ctl.updateportamento(); -}; - -/* - * Parameter control - */ -void Part::setPvolume(char Pvolume_){ - Pvolume=Pvolume_; - volume=dB2rap((Pvolume-96.0)/96.0*40.0)*ctl.expression.relvolume; -}; - -void Part::setPpanning(char Ppanning_){ - Ppanning=Ppanning_; - panning=Ppanning/127.0+ctl.panning.pan; - if (panning<0.0) panning=0.0;else if (panning>1.0) panning=1.0; - -}; - -/* - * Enable or disable a kit item - */ -void Part::setkititemstatus(int kititem,int Penabled_){ - if ((kititem==0)&&(kititem>=NUM_KIT_ITEMS)) return;//nonexistent kit item and the first kit item is always enabled - kit[kititem].Penabled=Penabled_; - - bool resetallnotes=false; - if (Penabled_==0){ - if (kit[kititem].adpars!=NULL) delete (kit[kititem].adpars); - if (kit[kititem].subpars!=NULL) delete (kit[kititem].subpars); - if (kit[kititem].padpars!=NULL) { - delete (kit[kititem].padpars); - resetallnotes=true; - }; - kit[kititem].adpars=NULL;kit[kititem].subpars=NULL;kit[kititem].padpars=NULL; - kit[kititem].Pname[0]='\0'; - } else { - if (kit[kititem].adpars==NULL) kit[kititem].adpars=new ADnoteParameters(fft); - if (kit[kititem].subpars==NULL) kit[kititem].subpars=new SUBnoteParameters(); - if (kit[kititem].padpars==NULL) kit[kititem].padpars=new PADnoteParameters(fft,master); - }; - - if (resetallnotes) for (int k=0;kbeginbranch("INFO"); - xml->addparstr("name",(char *)Pname); - xml->addparstr("author",(char *)info.Pauthor); - xml->addparstr("comments",(char *)info.Pcomments); - xml->addpar("type",info.Ptype); - xml->endbranch(); - - - xml->beginbranch("INSTRUMENT_KIT"); - xml->addpar("kit_mode",Pkitmode); - xml->addparbool("drum_mode",Pdrummode); - - for (int i=0;ibeginbranch("INSTRUMENT_KIT_ITEM",i); - xml->addparbool("enabled",kit[i].Penabled); - if (kit[i].Penabled!=0) { - xml->addparstr("name",(char *)kit[i].Pname); - - xml->addparbool("muted",kit[i].Pmuted); - xml->addpar("min_key",kit[i].Pminkey); - xml->addpar("max_key",kit[i].Pmaxkey); - - xml->addpar("send_to_instrument_effect",kit[i].Psendtoparteffect); - - xml->addparbool("add_enabled",kit[i].Padenabled); - if ((kit[i].Padenabled!=0)&&(kit[i].adpars!=NULL)){ - xml->beginbranch("ADD_SYNTH_PARAMETERS"); - kit[i].adpars->add2XML(xml); - xml->endbranch(); - }; - - xml->addparbool("sub_enabled",kit[i].Psubenabled); - if ((kit[i].Psubenabled!=0)&&(kit[i].subpars!=NULL)){ - xml->beginbranch("SUB_SYNTH_PARAMETERS"); - kit[i].subpars->add2XML(xml); - xml->endbranch(); - }; - - xml->addparbool("pad_enabled",kit[i].Ppadenabled); - if ((kit[i].Ppadenabled!=0)&&(kit[i].padpars!=NULL)){ - xml->beginbranch("PAD_SYNTH_PARAMETERS"); - kit[i].padpars->add2XML(xml); - xml->endbranch(); - }; - - }; - xml->endbranch(); - }; - xml->endbranch(); - - xml->beginbranch("INSTRUMENT_EFFECTS"); - for (int nefx=0;nefxbeginbranch("INSTRUMENT_EFFECT",nefx); - xml->beginbranch("EFFECT"); - partefx[nefx]->add2XML(xml); - xml->endbranch(); - - xml->addpar("route",Pefxroute[nefx]); - partefx[nefx]->setdryonly(Pefxroute[nefx]==2); - xml->addparbool("bypass",Pefxbypass[nefx]); - xml->endbranch(); - }; - xml->endbranch(); -}; - - -void Part::add2XML(XMLwrapper *xml){ - //parameters - xml->addparbool("enabled",Penabled); - if ((Penabled==0)&&(xml->minimal)) return; - - xml->addpar("volume",Pvolume); - xml->addpar("panning",Ppanning); - - xml->addpar("min_key",Pminkey); - xml->addpar("max_key",Pmaxkey); - xml->addpar("key_shift",Pkeyshift); - xml->addpar("rcv_chn",Prcvchn); - - xml->addpar("velocity_sensing",Pvelsns); - xml->addpar("velocity_offset",Pveloffs); - - xml->addparbool("note_on",Pnoteon); - xml->addparbool("poly_mode",Ppolymode); - xml->addpar("key_limit",Pkeylimit); - - xml->beginbranch("INSTRUMENT"); - add2XMLinstrument(xml); - xml->endbranch(); - - xml->beginbranch("CONTROLLER"); - ctl.add2XML(xml); - xml->endbranch(); -}; - -int Part::saveXML(char *filename){ - XMLwrapper *xml; - xml=new XMLwrapper(); - - xml->beginbranch("INSTRUMENT"); - add2XMLinstrument(xml); - xml->endbranch(); - - int result=xml->saveXMLfile(filename); - delete (xml); - return(result); -}; - -int Part::loadXMLinstrument(const char *filename){ - XMLwrapper *xml=new XMLwrapper(); - if (xml->loadXMLfile(filename)<0) { - delete(xml); - return(-1); - }; - - if (xml->enterbranch("INSTRUMENT")==0) return(-10); - getfromXMLinstrument(xml); - xml->exitbranch(); - - delete(xml); - return(0); -}; - - -void Part::applyparameters(){ - for (int n=0;napplyparameters(true); - }; -}; - -void Part::getfromXMLinstrument(XMLwrapper *xml){ - if (xml->enterbranch("INFO")){ - xml->getparstr("name",(char *)Pname,PART_MAX_NAME_LEN); - xml->getparstr("author",(char *)info.Pauthor,MAX_INFO_TEXT_SIZE); - xml->getparstr("comments",(char *)info.Pcomments,MAX_INFO_TEXT_SIZE); - info.Ptype=xml->getpar("type",info.Ptype,0,16); - - xml->exitbranch(); - }; - - if (xml->enterbranch("INSTRUMENT_KIT")){ - Pkitmode=xml->getpar127("kit_mode",Pkitmode); - Pdrummode=xml->getparbool("drum_mode",Pdrummode); - - setkititemstatus(0,0); - for (int i=0;ienterbranch("INSTRUMENT_KIT_ITEM",i)==0) continue; - setkititemstatus(i,xml->getparbool("enabled",kit[i].Penabled)); - if (kit[i].Penabled==0) { - xml->exitbranch(); - continue; - }; - - xml->getparstr("name",(char *)kit[i].Pname,PART_MAX_NAME_LEN); - - kit[i].Pmuted=xml->getparbool("muted",kit[i].Pmuted); - kit[i].Pminkey=xml->getpar127("min_key",kit[i].Pminkey); - kit[i].Pmaxkey=xml->getpar127("max_key",kit[i].Pmaxkey); - - kit[i].Psendtoparteffect=xml->getpar127("send_to_instrument_effect",kit[i].Psendtoparteffect); - - kit[i].Padenabled=xml->getparbool("add_enabled",kit[i].Padenabled); - if (xml->enterbranch("ADD_SYNTH_PARAMETERS")){ - kit[i].adpars->getfromXML(xml); - xml->exitbranch(); - }; - - kit[i].Psubenabled=xml->getparbool("sub_enabled",kit[i].Psubenabled); - if (xml->enterbranch("SUB_SYNTH_PARAMETERS")){ - kit[i].subpars->getfromXML(xml); - xml->exitbranch(); - }; - - kit[i].Ppadenabled=xml->getparbool("pad_enabled",kit[i].Ppadenabled); - if (xml->enterbranch("PAD_SYNTH_PARAMETERS")){ - kit[i].padpars->getfromXML(xml); - xml->exitbranch(); - }; - - xml->exitbranch(); - }; - - xml->exitbranch(); - }; - - - if (xml->enterbranch("INSTRUMENT_EFFECTS")){ - for (int nefx=0;nefxenterbranch("INSTRUMENT_EFFECT",nefx)==0) continue; - if (xml->enterbranch("EFFECT")){ - partefx[nefx]->getfromXML(xml); - xml->exitbranch(); - }; - - Pefxroute[nefx]=xml->getpar("route",Pefxroute[nefx],0,NUM_PART_EFX); - partefx[nefx]->setdryonly(Pefxroute[nefx]==2); - Pefxbypass[nefx]=xml->getparbool("bypass",Pefxbypass[nefx]); - xml->exitbranch(); - }; - xml->exitbranch(); - }; - -}; - -void Part::getfromXML(XMLwrapper *xml){ - Penabled=xml->getparbool("enabled",Penabled); - - setPvolume(xml->getpar127("volume",Pvolume)); - setPpanning(xml->getpar127("panning",Ppanning)); - - Pminkey=xml->getpar127("min_key",Pminkey); - Pmaxkey=xml->getpar127("max_key",Pmaxkey); - Pkeyshift=xml->getpar127("key_shift",Pkeyshift); - Prcvchn=xml->getpar127("rcv_chn",Prcvchn); - - Pvelsns=xml->getpar127("velocity_sensing",Pvelsns); - Pveloffs=xml->getpar127("velocity_offset",Pveloffs); - - Pnoteon=xml->getparbool("note_on",Pnoteon); - Ppolymode=xml->getparbool("poly_mode",Ppolymode); - Pkeylimit=xml->getpar127("key_limit",Pkeylimit); - - - if (xml->enterbranch("INSTRUMENT")){ - getfromXMLinstrument(xml); - xml->exitbranch(); - }; - - if (xml->enterbranch("CONTROLLER")){ - ctl.getfromXML(xml); - xml->exitbranch(); - }; - -}; - - - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Part.h b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Part.h deleted file mode 100644 index 28ea9816..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Part.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Part.h - Part implementation - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef PART_H -#define PART_H - -#define MAX_INFO_TEXT_SIZE 1000 - -#include "../globals.h" -#include "../Params/ADnoteParameters.h" -#include "../Params/SUBnoteParameters.h" -#include "../Params/PADnoteParameters.h" -#include "../Synth/ADnote.h" -#include "../Synth/SUBnote.h" -#include "../Synth/PADnote.h" -#include "../Params/Controller.h" -#include "../Misc/Microtonal.h" -#include "../DSP/FFTwrapper.h" -#include "../Effects/EffectMgr.h" -#include "XMLwrapper.h" - -class Master; - -class Part{ - - public: - Part(Microtonal *microtonal_,FFTwrapper *fft_, Master* master); - ~Part(); - - /* Midi commands implemented */ - void NoteOn(unsigned char note,unsigned char velocity,int masterkeyshift); - void NoteOff(unsigned char note); - void AllNotesOff();//panic - void SetController(unsigned int type,int par); - void RelaseSustainedKeys();//this is called when the sustain pedal is relased - void RelaseAllKeys();//this is called on AllNotesOff controller - - /* The synthesizer part output */ - void ComputePartSmps();//Part output - - //instrumentonly: 0 - save all, 1 - save only instrumnet, 2 - save only instrument without the name(used in bank) - - - //saves the instrument settings to a XML file - //returns 0 for ok or <0 if there is an error - int saveXML(char *filename); - int loadXMLinstrument(const char *filename); - - void add2XML(XMLwrapper *xml); - void add2XMLinstrument(XMLwrapper *xml); - - void defaults(); - void defaultsinstrument(); - - void applyparameters(); - - void getfromXML(XMLwrapper *xml); - void getfromXMLinstrument(XMLwrapper *xml); - - void cleanup(); - -// ADnoteParameters *ADPartParameters; -// SUBnoteParameters *SUBPartParameters; - - //the part's kit - struct { - unsigned char Penabled,Pmuted,Pminkey,Pmaxkey; - unsigned char *Pname; - unsigned char Padenabled,Psubenabled,Ppadenabled; - unsigned char Psendtoparteffect; - ADnoteParameters *adpars; - SUBnoteParameters *subpars; - PADnoteParameters *padpars; - } kit[NUM_KIT_ITEMS]; - - - //Part parameters - void setkeylimit(unsigned char Pkeylimit); - void setkititemstatus(int kititem,int Penabled_); - - unsigned char Penabled;//if the part is enabled - unsigned char Pvolume;//part volume - unsigned char Pminkey;//the minimum key that the part receives noteon messages - unsigned char Pmaxkey;//the maximum key that the part receives noteon messages - void setPvolume(char Pvolume); - unsigned char Pkeyshift;//Part keyshift - unsigned char Prcvchn;//from what midi channel it receive commnads - unsigned char Ppanning;//part panning - void setPpanning(char Ppanning); - unsigned char Pvelsns;//velocity sensing (amplitude velocity scale) - unsigned char Pveloffs;//velocity offset - unsigned char Pnoteon;//if the part receives NoteOn messages - unsigned char Pkitmode;//if the kitmode is enabled - unsigned char Pdrummode;//if all keys are mapped and the system is 12tET (used for drums) - - unsigned char Ppolymode;//Part mode - 0=monophonic , 1=polyphonic - unsigned char Pkeylimit;//how many keys are alowed to be played same time (0=off), the older will be relased - - unsigned char *Pname; //name of the instrument - struct{//instrument additional information - unsigned char Ptype; - unsigned char Pauthor[MAX_INFO_TEXT_SIZE+1]; - unsigned char Pcomments[MAX_INFO_TEXT_SIZE+1]; - } info; - - - REALTYPE *partoutl;//Left channel output of the part - REALTYPE *partoutr;//Right channel output of the part - - REALTYPE *partfxinputl[NUM_PART_EFX+1],*partfxinputr[NUM_PART_EFX+1];//Left and right signal that pass thru part effects; partfxinput l/r [NUM_PART_EFX] is for "no effect" buffer - - enum NoteStatus{KEY_OFF,KEY_PLAYING,KEY_RELASED_AND_SUSTAINED,KEY_RELASED}; - - REALTYPE volume,oldvolumel,oldvolumer;//this is applied by Master - REALTYPE panning;//this is applied by Master, too - - Controller ctl;//Part controllers - - EffectMgr *partefx[NUM_PART_EFX];//insertion part effects (they are part of the instrument) - unsigned char Pefxroute[NUM_PART_EFX];//how the effect's output is routed(to next effect/to out) - bool Pefxbypass[NUM_PART_EFX];//if the effects are bypassed - - - Master* master; - - int lastnote; - - private: - void KillNotePos(int pos); - void RelaseNotePos(int pos); - int killallnotes;//is set to 1 if I want to kill all notes - - struct PartNotes{ - NoteStatus status; - int note;//if there is no note playing, the "note"=-1 - int itemsplaying; - struct { - ADnote *adnote; - SUBnote *subnote; - PADnote *padnote; - int sendtoparteffect; - } kititem[NUM_KIT_ITEMS]; - int time; - }; - - PartNotes partnote[POLIPHONY]; - - REALTYPE *tmpoutl;//used to get the note - REALTYPE *tmpoutr; - - REALTYPE oldfreq;//this is used for portamento - Microtonal *microtonal; - FFTwrapper *fft; -}; - -#endif - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Util.C b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Util.C deleted file mode 100644 index 74619731..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Util.C +++ /dev/null @@ -1,112 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Util.C - Miscellaneous functions - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "Util.h" -#include -#include - -#include -#include -#include -#include -#include -#include - -int SAMPLE_RATE=44100; -int SOUND_BUFFER_SIZE=256; -int OSCIL_SIZE=512; - -Config config; -REALTYPE *denormalkillbuf; - - -/* - * Transform the velocity according the scaling parameter (velocity sensing) - */ -REALTYPE VelF(REALTYPE velocity,unsigned char scaling){ - REALTYPE x; - x=pow(VELOCITY_MAX_SCALE,(64.0-scaling)/64.0); - if ((scaling==127)||(velocity>0.99)) return(1.0); - else return(pow(velocity,x)); -}; - -/* - * Get the detune in cents - */ -REALTYPE getdetune(unsigned char type,unsigned short int coarsedetune,unsigned short int finedetune){ - REALTYPE det=0.0,octdet=0.0,cdet=0.0,findet=0.0; - //Get Octave - int octave=coarsedetune/1024; - if (octave>=8) octave-=16; - octdet=octave*1200.0; - - //Coarse and fine detune - int cdetune=coarsedetune%1024; - if (cdetune>512) cdetune-=1024; - - int fdetune=finedetune-8192; - - switch (type){ -// case 1: is used for the default (see below) - case 2: cdet=fabs(cdetune*10.0); - findet=fabs(fdetune/8192.0)*10.0; - break; - case 3: cdet=fabs(cdetune*100); - findet=pow(10,fabs(fdetune/8192.0)*3.0)/10.0-0.1; - break; - case 4: cdet=fabs(cdetune*701.95500087);//perfect fifth - findet=(pow(2,fabs(fdetune/8192.0)*12.0)-1.0)/4095*1200; - break; - //case ...: need to update N_DETUNE_TYPES, if you'll add more - default:cdet=fabs(cdetune*50.0); - findet=fabs(fdetune/8192.0)*35.0;//almost like "Paul's Sound Designer 2" - break; - }; - if (finedetune<8192) findet=-findet; - if (cdetune<0) cdet=-cdet; - - det=octdet+cdet+findet; - return(det); -}; - - -bool fileexists(char *filename){ - struct stat tmp; - int result=stat(filename,&tmp); - if (result>=0) return(true); - - return(false); -}; - -void newFFTFREQS(FFTFREQS *f,int size){ - f->c=new REALTYPE[size]; - f->s=new REALTYPE[size]; - for (int i=0;ic[i]=0.0;f->s[i]=0.0; - }; -}; -void deleteFFTFREQS(FFTFREQS *f){ - delete[] f->c; - delete[] f->s; - f->c=f->s=NULL; -}; - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Util.h b/muse_qt4_evolution/synti/zynaddsubfx/Misc/Util.h deleted file mode 100644 index c5b39476..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/Util.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Util.h - Miscellaneous functions - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#ifndef UTIL_H -#define UTIL_H - -#include -#include "../globals.h" -#include "Microtonal.h" -#include "../DSP/FFTwrapper.h" -#include "Config.h" - -//Velocity Sensing function -extern REALTYPE VelF(REALTYPE velocity,unsigned char scaling); - -bool fileexists(char *filename); - -#define N_DETUNE_TYPES 4 //the number of detune types -extern REALTYPE getdetune(unsigned char type,unsigned short int coarsedetune,unsigned short int finedetune); - -extern REALTYPE *denormalkillbuf;//the buffer to add noise in order to avoid denormalisation - -extern Config config; - -#endif - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/XMLwrapper.C b/muse_qt4_evolution/synti/zynaddsubfx/Misc/XMLwrapper.C deleted file mode 100644 index 0f35faf2..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/XMLwrapper.C +++ /dev/null @@ -1,533 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - XMLwrapper.C - XML wrapper - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include "XMLwrapper.h" -#include -#include -#include - -#include "../globals.h" -#include "Util.h" - -int xml_k=0; -char tabs[STACKSIZE+2]; - -const char *XMLwrapper_whitespace_callback(mxml_node_t *node,int where){ - const char *name=node->value.element.name; - - if ((where==MXML_WS_BEFORE_OPEN)&&(!strcmp(name,"?xml"))) return(NULL); - if ((where==MXML_WS_BEFORE_CLOSE)&&(!strcmp(name,"string"))) return(NULL); - - if ((where==MXML_WS_BEFORE_OPEN)||(where==MXML_WS_BEFORE_CLOSE)) { -/* const char *tmp=node->value.element.name; - if (tmp!=NULL) { - if ((strstr(tmp,"par")!=tmp)&&(strstr(tmp,"string")!=tmp)) { - printf("%s ",tmp); - if (where==MXML_WS_BEFORE_OPEN) xml_k++; - if (where==MXML_WS_BEFORE_CLOSE) xml_k--; - if (xml_k>=STACKSIZE) xml_k=STACKSIZE-1; - if (xml_k<0) xml_k=0; - printf("%d\n",xml_k); - printf("\n"); - }; - - }; - int i=0; - for (i=1;i"); - char *end=strstr(xmldata,""); - - if ((start==NULL)||(end==NULL)||(start>end)) { - delete(xmldata); - return(false); - }; - end+=strlen(""); - end[0]='\0'; - - tree=mxmlNewElement(MXML_NO_PARENT,"?xml"); - node=root=mxmlLoadString(tree,xmldata,MXML_OPAQUE_CALLBACK); - if (root==NULL) { - delete(xmldata); - mxmlDelete(tree); - node=root=tree=NULL; - return(false); - }; - - root=mxmlFindElement(tree,tree,"INFORMATION",NULL,NULL,MXML_DESCEND); - push(root); - - if (root==NULL){ - delete(xmldata); - mxmlDelete(tree); - node=root=tree=NULL; - return(false); - }; - - information.PADsynth_used=getparbool("PADsynth_used",false); - - exitbranch(); - if (tree!=NULL) mxmlDelete(tree); - delete(xmldata); - node=root=tree=NULL; - - return(true); -}; - - -/* SAVE XML members */ - -int XMLwrapper::saveXMLfile(char *filename){ - char *xmldata=getXMLdata(); - if (xmldata==NULL) return(-2); - - int compression=config.cfg.GzipCompression; - - int fnsize=strlen(filename)+100; - char *filenamenew=new char [fnsize]; - snprintf(filenamenew,fnsize,"%s",filename); - - int result=dosavefile(filenamenew,compression,xmldata); - - delete(filenamenew); - delete(xmldata); - return(result); -}; - -char *XMLwrapper::getXMLdata(){ - xml_k=0; - ZERO(tabs,STACKSIZE+2); - - mxml_node_t *oldnode=node; - - node=info; - //Info storing - addparbool("PADsynth_used",information.PADsynth_used); - - node=oldnode; - char *xmldata=mxmlSaveAllocString(tree,XMLwrapper_whitespace_callback); - - return(xmldata); -}; - - -int XMLwrapper::dosavefile(char *filename,int compression,char *xmldata){ - if (compression==0){ - FILE *file; - file=fopen(filename,"w"); - if (file==NULL) return(-1); - fputs(xmldata,file); - fclose(file); - } else { - if (compression>9) compression=9; - if (compression<1) compression=1; - char options[10]; - snprintf(options,10,"wb%d",compression); - - gzFile gzfile; - gzfile=gzopen(filename,options); - if (gzfile==NULL) return(-1); - gzputs(gzfile,xmldata); - gzclose(gzfile); - }; - - return(0); -}; - - - -void XMLwrapper::addpar(char *name,int val){ - addparams2("par","name",name,"value",int2str(val)); -}; - -void XMLwrapper::addparreal(char *name,REALTYPE val){ - addparams2("par_real","name",name,"value",real2str(val)); -}; - -void XMLwrapper::addparbool(char *name,int val){ - if (val!=0) addparams2("par_bool","name",name,"value","yes"); - else addparams2("par_bool","name",name,"value","no"); -}; - -void XMLwrapper::addparstr(char *name,char *val){ - mxml_node_t *element=mxmlNewElement(node,"string"); - mxmlElementSetAttr(element,"name",name); - mxmlNewText(element,0,val); -}; - - -void XMLwrapper::beginbranch(char *name){ - push(node); - node=addparams0(name); -}; - -void XMLwrapper::beginbranch(char *name,int id){ - push(node); - node=addparams1(name,"id",int2str(id)); -}; - -void XMLwrapper::endbranch(){ - node=pop(); -}; - - - -/* LOAD XML members */ - -int XMLwrapper::loadXMLfile(const char *filename){ - if (tree!=NULL) mxmlDelete(tree); - tree=NULL; - - ZERO(&parentstack,(int)sizeof(parentstack)); - ZERO(&values,(int)sizeof(values)); - - stackpos=0; - - char *xmldata=doloadfile(filename); - if (xmldata==NULL) return(-1);//the file could not be loaded or uncompressed - - root=tree=mxmlLoadString(NULL,xmldata,MXML_OPAQUE_CALLBACK); - - delete(xmldata); - - if (tree==NULL) return(-2);//this is not XML - - - node=root=mxmlFindElement(tree,tree,"ZynAddSubFX-data",NULL,NULL,MXML_DESCEND); - if (root==NULL) return(-3);//the XML doesnt embbed zynaddsubfx data - push(root); - - values.xml_version.major=str2int(mxmlElementGetAttr(root,"version-major")); - values.xml_version.minor=str2int(mxmlElementGetAttr(root,"version-minor")); - - return(0); -}; - - -char *XMLwrapper::doloadfile(const char *filename){ - char *xmldata=NULL; - int filesize=-1; - - //try get filesize as gzip data (first) - gzFile gzfile=gzopen(filename,"rb"); - if (gzfile!=NULL){//this is a gzip file - // first check it's size - while(!gzeof(gzfile)) { - gzseek (gzfile,1024*1024,SEEK_CUR); - if (gztell(gzfile)>10000000) { - gzclose(gzfile); - goto notgzip;//the file is too big - }; - }; - filesize=gztell(gzfile); - - //rewind the file and load the data - xmldata=new char[filesize+1]; - ZERO(xmldata,filesize+1); - - gzrewind(gzfile); - gzread(gzfile,xmldata,filesize); - - gzclose(gzfile); - return (xmldata); - } else {//this is not a gzip file - notgzip: - FILE *file=fopen(filename,"rb"); - if (file==NULL) return(NULL); - fseek(file,0,SEEK_END); - filesize=ftell(file); - - xmldata=new char [filesize+1]; - ZERO(xmldata,filesize+1); - - rewind(file); - fread(xmldata,filesize,1,file); - - fclose(file); - return(xmldata); - }; -}; - -bool XMLwrapper::putXMLdata(char *xmldata){ - if (tree!=NULL) mxmlDelete(tree); - tree=NULL; - - ZERO(&parentstack,(int)sizeof(parentstack)); - ZERO(&values,(int)sizeof(values)); - - stackpos=0; - - if (xmldata==NULL) return (false); - - root=tree=mxmlLoadString(NULL,xmldata,MXML_OPAQUE_CALLBACK); - - if (tree==NULL) return(false); - - node=root=mxmlFindElement(tree,tree,"ZynAddSubFX-data",NULL,NULL,MXML_DESCEND); - if (root==NULL) return (false);; - push(root); - - return(true); -}; - - - -int XMLwrapper::enterbranch(char *name){ - node=mxmlFindElement(peek(),peek(),name,NULL,NULL,MXML_DESCEND_FIRST); - if (node==NULL) return(0); - - push(node); - return(1); -}; - -int XMLwrapper::enterbranch(char *name,int id){ - snprintf(tmpstr,TMPSTR_SIZE,"%d",id); - node=mxmlFindElement(peek(),peek(),name,"id",tmpstr,MXML_DESCEND_FIRST); - if (node==NULL) return(0); - - push(node); - return(1); -}; - - -void XMLwrapper::exitbranch(){ - pop(); -}; - - -int XMLwrapper::getbranchid(int min, int max){ - int id=str2int(mxmlElementGetAttr(node,"id")); - if ((min==0)&&(max==0)) return(id); - - if (idmax) id=max; - - return(id); -}; - -int XMLwrapper::getpar(char *name,int defaultpar,int min,int max){ - node=mxmlFindElement(peek(),peek(),"par","name",name,MXML_DESCEND_FIRST); - if (node==NULL) return(defaultpar); - - const char *strval=mxmlElementGetAttr(node,"value"); - if (strval==NULL) return(defaultpar); - - int val=str2int(strval); - if (valmax) val=max; - - return(val); -}; - -int XMLwrapper::getpar127(char *name,int defaultpar){ - return(getpar(name,defaultpar,0,127)); -}; - -int XMLwrapper::getparbool(char *name,int defaultpar){ - node=mxmlFindElement(peek(),peek(),"par_bool","name",name,MXML_DESCEND_FIRST); - if (node==NULL) return(defaultpar); - - const char *strval=mxmlElementGetAttr(node,"value"); - if (strval==NULL) return(defaultpar); - - if ((strval[0]=='Y')||(strval[0]=='y')) return(1); - else return(0); -}; - -void XMLwrapper::getparstr(char *name,char *par,int maxstrlen){ - ZERO(par,maxstrlen); - node=mxmlFindElement(peek(),peek(),"string","name",name,MXML_DESCEND_FIRST); - - if (node==NULL) return; - if (node->child==NULL) return; - if (node->child->type!=MXML_OPAQUE) return; - - snprintf(par,maxstrlen,"%s",node->child->value.element.name); - -}; - -REALTYPE XMLwrapper::getparreal(char *name,REALTYPE defaultpar){ - node=mxmlFindElement(peek(),peek(),"par_real","name",name,MXML_DESCEND_FIRST); - if (node==NULL) return(defaultpar); - - const char *strval=mxmlElementGetAttr(node,"value"); - if (strval==NULL) return(defaultpar); - - return(str2real(strval)); -}; - -REALTYPE XMLwrapper::getparreal(char *name,REALTYPE defaultpar,REALTYPE min,REALTYPE max){ - REALTYPE result=getparreal(name,defaultpar); - - if (resultmax) result=max; - return(result); -}; - - -/** Private members **/ - -char *XMLwrapper::int2str(int x){ - snprintf(tmpstr,TMPSTR_SIZE,"%d",x); - return(tmpstr); -}; - -char *XMLwrapper::real2str(REALTYPE x){ - snprintf(tmpstr,TMPSTR_SIZE,"%g",x); - return(tmpstr); -}; - -int XMLwrapper::str2int(const char *str){ - if (str==NULL) return(0); - int result=strtol(str,NULL,10); - return(result); -}; - -REALTYPE XMLwrapper::str2real(const char *str){ - if (str==NULL) return(0.0); - REALTYPE result=strtod(str,NULL); - return(result); -}; - - -mxml_node_t *XMLwrapper::addparams0(char *name){ - mxml_node_t *element=mxmlNewElement(node,name); - return(element); -}; - -mxml_node_t *XMLwrapper::addparams1(char *name,char *par1,char *val1){ - mxml_node_t *element=mxmlNewElement(node,name); - mxmlElementSetAttr(element,par1,val1); - return(element); -}; - -mxml_node_t *XMLwrapper::addparams2(char *name,char *par1,char *val1,char *par2, char *val2){ - mxml_node_t *element=mxmlNewElement(node,name); - mxmlElementSetAttr(element,par1,val1); - mxmlElementSetAttr(element,par2,val2); - return(element); -}; - - - - -void XMLwrapper::push(mxml_node_t *node){ - if (stackpos>=STACKSIZE-1) { - printf("BUG!: XMLwrapper::push() - full parentstack\n"); - return; - }; - stackpos++; - parentstack[stackpos]=node; - -// printf("push %d - %s\n",stackpos,node->value.element.name); - -}; -mxml_node_t *XMLwrapper::pop(){ - if (stackpos<=0) { - printf("BUG!: XMLwrapper::pop() - empty parentstack\n"); - return (root); - }; - mxml_node_t *node=parentstack[stackpos]; - parentstack[stackpos]=NULL; - -// printf("pop %d - %s\n",stackpos,node->value.element.name); - - stackpos--; - return(node); -}; - -mxml_node_t *XMLwrapper::peek(){ - if (stackpos<=0) { - printf("BUG!: XMLwrapper::peek() - empty parentstack\n"); - return (root); - }; - return(parentstack[stackpos]); -}; - - - diff --git a/muse_qt4_evolution/synti/zynaddsubfx/Misc/XMLwrapper.h b/muse_qt4_evolution/synti/zynaddsubfx/Misc/XMLwrapper.h deleted file mode 100644 index 765622a2..00000000 --- a/muse_qt4_evolution/synti/zynaddsubfx/Misc/XMLwrapper.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - XML.h - XML wrapper - Copyright (C) 2003-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - -#include -#ifndef REALTYPE -#define REALTYPE float -#endif - -#ifndef XML_WRAPPER_H -#define XML_WRAPPER_H - -#define TMPSTR_SIZE 50 - -//the maxim tree depth -#define STACKSIZE 100 - -class XMLwrapper{ - public: - XMLwrapper(); - ~XMLwrapper(); - - /********************************/ - /* SAVE to XML */ - /********************************/ - - //returns 0 if ok or -1 if the file cannot be saved - int saveXMLfile(char *filename); - - //returns the new allocated string that contains the XML data (used for clipboard) - //the string is NULL terminated - char *getXMLdata(); - - //add simple parameter (name and value) - void addpar(char *name,int val); - void addparreal(char *name,REALTYPE val); - - //add boolean parameter (name and boolean value) - //if the value is 0 => "yes", else "no" - void addparbool(char *name,int val); - - //add string parameter (name and string) - void addparstr(char *name,char *val); - - //add a branch - void beginbranch(char *name); - void beginbranch(char *name, int id); - - //this must be called after each branch (nodes that contains child nodes) - void endbranch(); - - /********************************/ - /* LOAD from XML */ - /********************************/ - - //returns 0 if ok or -1 if the file cannot be loaded - int loadXMLfile(const char *filename); - - //used by the clipboard - bool putXMLdata(char *xmldata); - - //enter into the branch - //returns 1 if is ok, or 0 otherwise - int enterbranch(char *name); - - - //enter into the branch with id - //returns 1 if is ok, or 0 otherwise - int enterbranch(char *name, int id); - - //exits from a branch - void exitbranch(); - - //get the the branch_id and limits it between the min and max - //if min==max==0, it will not limit it - //if there isn't any id, will return min - //this must be called only imediately after enterbranch() - int getbranchid(int min, int max); - - //it returns the parameter and limits it between min and max - //if min==max==0, it will not limit it - //if no parameter will be here, the defaultpar will be returned - int getpar(char *name,int defaultpar,int min,int max); - - //the same as getpar, but the limits are 0 and 127 - int getpar127(char *name,int defaultpar); - - int getparbool(char *name,int defaultpar); - - void getparstr(char *name,char *par,int maxstrlen); - REALTYPE getparreal(char *name,REALTYPE defaultpar); - REALTYPE getparreal(char *name,REALTYPE defaultpar,REALTYPE min,REALTYPE max); - - bool minimal;//false if all parameters will be stored (used only for clipboard) - - struct { - bool PADsynth_used; - }information; - - //opens a file and parse only the "information" data on it - //returns "true" if all went ok or "false" on errors - bool checkfileinformation(char *filename); - - private: - - int dosavefile(char *filename,int compression,char *xmldata); - char *doloadfile(const char *filename); - - - mxml_node_t *tree;//all xml data - mxml_node_t *root;//xml data used by zynaddsubfx - mxml_node_t *node;//current node - mxml_node_t *info;//this node is used to store the information about the data - - //adds params like this: - // - //returns the node - mxml_node_t *addparams0(char *name); - - //adds params like this: - // - //returns the node - mxml_node_t *addparams1(char *name,char *par1,char *val1); - - //adds params like this: - // - //returns the node - mxml_node_t *addparams2(char *name,char *par1,char *val1,char *par2, char *val2); - - char *int2str(int x); - char *real2str(REALTYPE x); - - int str2int(const char *str); - REALTYPE str2real(const char *str); - - char tmpstr[TMPSTR_SIZE]; - - - //this is used to store the parents - mxml_node_t *parentstack[STACKSIZE]; - int stackpos; - - - void push(mxml_node_t *node); - mxml_node_t *pop(); - mxml_node_t *peek(); - - //theese are used to store the values - struct{ - struct { - int major,minor; - }xml_version; - }values; - -}; - -#endif -- cgit v1.2.3