zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 73e0cdc93dc43af6bac5ea24fb8ca5ead2a68968
parent dd62835d6dbe8bf3d8d3e6d830aa880012203a73
Author: Olivier Jolly <[email protected]>
Date:   Wed, 18 Nov 2015 23:36:11 +0100

prevented memory leak when loading malformed XML files by allocating XMLWrapper on stack instead of heap

Diffstat:
Msrc/Effects/EffectMgr.cpp | 40++++++++++++++++++++--------------------
Msrc/Effects/EffectMgr.h | 4++--
Msrc/Misc/Master.cpp | 150++++++++++++++++++++++++++++++++++++++-----------------------------------------
Msrc/Misc/Master.h | 4++--
Msrc/Misc/Microtonal.cpp | 142++++++++++++++++++++++++++++++++++++++-----------------------------------------
Msrc/Misc/Microtonal.h | 4++--
Msrc/Misc/Part.cpp | 226++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/Misc/Part.h | 8++++----
Msrc/Misc/PresetExtractor.cpp | 4++--
Msrc/Params/ADnoteParameters.cpp | 506++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/Params/ADnoteParameters.h | 16++++++++--------
Msrc/Params/Controller.cpp | 106++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/Params/Controller.h | 4++--
Msrc/Params/EnvelopeParams.cpp | 78+++++++++++++++++++++++++++++++++++++++---------------------------------------
Msrc/Params/EnvelopeParams.h | 4++--
Msrc/Params/FilterParams.cpp | 118++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/Params/FilterParams.h | 8++++----
Msrc/Params/LFOParams.cpp | 40++++++++++++++++++++--------------------
Msrc/Params/LFOParams.h | 4++--
Msrc/Params/PADnoteParameters.cpp | 298++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/Params/PADnoteParameters.h | 4++--
Msrc/Params/Presets.cpp | 2+-
Msrc/Params/Presets.h | 2+-
Msrc/Params/PresetsArray.cpp | 4++--
Msrc/Params/PresetsArray.h | 2+-
Msrc/Params/SUBnoteParameters.cpp | 202++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/Params/SUBnoteParameters.h | 4++--
Msrc/Synth/OscilGen.cpp | 160++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/Synth/OscilGen.h | 4++--
Msrc/Synth/Resonance.cpp | 40++++++++++++++++++++--------------------
Msrc/Synth/Resonance.h | 4++--
Msrc/Tests/AdNoteTest.h | 17++++++++---------
Msrc/Tests/MemoryStressTest.h | 17++++++++---------
Msrc/Tests/MicrotonalTest.h | 4++--
Msrc/Tests/OscilGenTest.h | 21++++++++++-----------
Msrc/Tests/PadNoteTest.h | 2+-
Msrc/Tests/SubNoteTest.h | 17++++++++---------
37 files changed, 1128 insertions(+), 1142 deletions(-)

diff --git a/src/Effects/EffectMgr.cpp b/src/Effects/EffectMgr.cpp @@ -417,55 +417,55 @@ void EffectMgr::paste(EffectMgr &e) seteffectparrt(i, e.settings[i]); } -void EffectMgr::add2XML(XMLwrapper *xml) +void EffectMgr::add2XML(XMLwrapper& xml) { - xml->addpar("type", geteffect()); + xml.addpar("type", geteffect()); if(!geteffect()) return; - xml->addpar("preset", preset); + xml.addpar("preset", preset); - xml->beginbranch("EFFECT_PARAMETERS"); + xml.beginbranch("EFFECT_PARAMETERS"); for(int n = 0; n < 128; ++n) { int par = geteffectpar(n); if(par == 0) continue; - xml->beginbranch("par_no", n); - xml->addpar("par", par); - xml->endbranch(); + xml.beginbranch("par_no", n); + xml.addpar("par", par); + xml.endbranch(); } if(filterpars) { - xml->beginbranch("FILTER"); + xml.beginbranch("FILTER"); filterpars->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); } -void EffectMgr::getfromXML(XMLwrapper *xml) +void EffectMgr::getfromXML(XMLwrapper& xml) { - changeeffect(xml->getpar127("type", geteffect())); + changeeffect(xml.getpar127("type", geteffect())); if(!geteffect()) return; - preset = xml->getpar127("preset", preset); + preset = xml.getpar127("preset", preset); - if(xml->enterbranch("EFFECT_PARAMETERS")) { + if(xml.enterbranch("EFFECT_PARAMETERS")) { for(int n = 0; n < 128; ++n) { seteffectpar(n, 0); //erase effect parameter - if(xml->enterbranch("par_no", n) == 0) + if(xml.enterbranch("par_no", n) == 0) continue; int par = geteffectpar(n); - seteffectpar(n, xml->getpar127("par", par)); - xml->exitbranch(); + seteffectpar(n, xml.getpar127("par", par)); + xml.exitbranch(); } if(filterpars) - if(xml->enterbranch("FILTER")) { + if(xml.enterbranch("FILTER")) { filterpars->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } cleanup(); } diff --git a/src/Effects/EffectMgr.h b/src/Effects/EffectMgr.h @@ -40,9 +40,9 @@ class EffectMgr:public Presets ~EffectMgr(); void paste(EffectMgr &e); - void add2XML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); void defaults(void) REALTIME; - void getfromXML(XMLwrapper *xml); + void getfromXML(XMLwrapper& xml); void out(float *smpsl, float *smpsr) REALTIME; diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp @@ -954,193 +954,187 @@ void Master::initialize_rt(void) part[i]->initialize_rt(); } -void Master::add2XML(XMLwrapper *xml) +void Master::add2XML(XMLwrapper& xml) { - xml->addpar("volume", Pvolume); - xml->addpar("key_shift", Pkeyshift); - xml->addparbool("nrpn_receive", ctl.NRPN.receive); + xml.addpar("volume", Pvolume); + xml.addpar("key_shift", Pkeyshift); + xml.addparbool("nrpn_receive", ctl.NRPN.receive); - xml->beginbranch("MICROTONAL"); + xml.beginbranch("MICROTONAL"); microtonal.add2XML(xml); - xml->endbranch(); + xml.endbranch(); for(int npart = 0; npart < NUM_MIDI_PARTS; ++npart) { - xml->beginbranch("PART", npart); + xml.beginbranch("PART", npart); part[npart]->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->beginbranch("SYSTEM_EFFECTS"); + xml.beginbranch("SYSTEM_EFFECTS"); for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) { - xml->beginbranch("SYSTEM_EFFECT", nefx); - xml->beginbranch("EFFECT"); + xml.beginbranch("SYSTEM_EFFECT", nefx); + xml.beginbranch("EFFECT"); sysefx[nefx]->add2XML(xml); - xml->endbranch(); + xml.endbranch(); for(int pefx = 0; pefx < NUM_MIDI_PARTS; ++pefx) { - xml->beginbranch("VOLUME", pefx); - xml->addpar("vol", Psysefxvol[nefx][pefx]); - xml->endbranch(); + xml.beginbranch("VOLUME", pefx); + xml.addpar("vol", Psysefxvol[nefx][pefx]); + xml.endbranch(); } for(int tonefx = nefx + 1; tonefx < NUM_SYS_EFX; ++tonefx) { - xml->beginbranch("SENDTO", tonefx); - xml->addpar("send_vol", Psysefxsend[nefx][tonefx]); - xml->endbranch(); + xml.beginbranch("SENDTO", tonefx); + xml.addpar("send_vol", Psysefxsend[nefx][tonefx]); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("INSERTION_EFFECTS"); + xml.beginbranch("INSERTION_EFFECTS"); for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) { - xml->beginbranch("INSERTION_EFFECT", nefx); - xml->addpar("part", Pinsparts[nefx]); + xml.beginbranch("INSERTION_EFFECT", nefx); + xml.addpar("part", Pinsparts[nefx]); - xml->beginbranch("EFFECT"); + xml.beginbranch("EFFECT"); insefx[nefx]->add2XML(xml); - xml->endbranch(); - xml->endbranch(); + xml.endbranch(); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); } int Master::getalldata(char **data) { - XMLwrapper *xml = new XMLwrapper(); + XMLwrapper xml; - xml->beginbranch("MASTER"); + xml.beginbranch("MASTER"); add2XML(xml); - xml->endbranch(); + xml.endbranch(); - *data = xml->getXMLdata(); - delete (xml); + *data = xml.getXMLdata(); return strlen(*data) + 1; } void Master::putalldata(const char *data) { - XMLwrapper *xml = new XMLwrapper(); - if(!xml->putXMLdata(data)) { - delete (xml); + XMLwrapper xml; + if(!xml.putXMLdata(data)) { return; } - if(xml->enterbranch("MASTER") == 0) + if(xml.enterbranch("MASTER") == 0) return; getfromXML(xml); - xml->exitbranch(); - - delete (xml); + xml.exitbranch(); } int Master::saveXML(const char *filename) { - XMLwrapper *xml = new XMLwrapper(); + XMLwrapper xml; - xml->beginbranch("MASTER"); + xml.beginbranch("MASTER"); add2XML(xml); - xml->endbranch(); + xml.endbranch(); - int result = xml->saveXMLfile(filename, gzip_compression); - delete (xml); - return result; + return xml.saveXMLfile(filename, gzip_compression); } int Master::loadXML(const char *filename) { - XMLwrapper *xml = new XMLwrapper(); - if(xml->loadXMLfile(filename) < 0) { - delete (xml); + XMLwrapper xml; + + if(xml.loadXMLfile(filename) < 0) { return -1; } - if(xml->enterbranch("MASTER") == 0) + if(xml.enterbranch("MASTER") == 0) return -10; + getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); - delete (xml); initialize_rt(); return 0; } -void Master::getfromXML(XMLwrapper *xml) +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); + 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; npart < NUM_MIDI_PARTS; ++npart) { - if(xml->enterbranch("PART", npart) == 0) + if(xml.enterbranch("PART", npart) == 0) continue; part[npart]->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("MICROTONAL")) { + if(xml.enterbranch("MICROTONAL")) { microtonal.getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } sysefx[0]->changeeffect(0); - if(xml->enterbranch("SYSTEM_EFFECTS")) { + if(xml.enterbranch("SYSTEM_EFFECTS")) { for(int nefx = 0; nefx < NUM_SYS_EFX; ++nefx) { - if(xml->enterbranch("SYSTEM_EFFECT", nefx) == 0) + if(xml.enterbranch("SYSTEM_EFFECT", nefx) == 0) continue; - if(xml->enterbranch("EFFECT")) { + if(xml.enterbranch("EFFECT")) { sysefx[nefx]->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } for(int partefx = 0; partefx < NUM_MIDI_PARTS; ++partefx) { - if(xml->enterbranch("VOLUME", partefx) == 0) + if(xml.enterbranch("VOLUME", partefx) == 0) continue; setPsysefxvol(partefx, nefx, - xml->getpar127("vol", Psysefxvol[partefx][nefx])); - xml->exitbranch(); + xml.getpar127("vol", Psysefxvol[partefx][nefx])); + xml.exitbranch(); } for(int tonefx = nefx + 1; tonefx < NUM_SYS_EFX; ++tonefx) { - if(xml->enterbranch("SENDTO", tonefx) == 0) + if(xml.enterbranch("SENDTO", tonefx) == 0) continue; setPsysefxsend(nefx, tonefx, - xml->getpar127("send_vol", + xml.getpar127("send_vol", Psysefxsend[nefx][tonefx])); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("INSERTION_EFFECTS")) { + if(xml.enterbranch("INSERTION_EFFECTS")) { for(int nefx = 0; nefx < NUM_INS_EFX; ++nefx) { - if(xml->enterbranch("INSERTION_EFFECT", nefx) == 0) + if(xml.enterbranch("INSERTION_EFFECT", nefx) == 0) continue; - Pinsparts[nefx] = xml->getpar("part", + Pinsparts[nefx] = xml.getpar("part", Pinsparts[nefx], -2, NUM_MIDI_PARTS); - if(xml->enterbranch("EFFECT")) { + if(xml.enterbranch("EFFECT")) { insefx[nefx]->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } } diff --git a/src/Misc/Master.h b/src/Misc/Master.h @@ -63,7 +63,7 @@ class Master int saveXML(const char *filename); /**This adds the parameters to the XML data*/ - void add2XML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); void defaults(); @@ -78,7 +78,7 @@ class Master //This must be called prior-to/at-the-time-of RT insertion void initialize_rt(void) REALTIME; - void getfromXML(XMLwrapper *xml); + void getfromXML(XMLwrapper& xml); /**get all data to a newly allocated array (used for plugin) * @return the datasize*/ diff --git a/src/Misc/Microtonal.cpp b/src/Misc/Microtonal.cpp @@ -566,87 +566,87 @@ int Microtonal::loadkbm(const char *filename) -void Microtonal::add2XML(XMLwrapper *xml) const +void Microtonal::add2XML(XMLwrapper& xml) const { - xml->addparstr("name", (char *) Pname); - xml->addparstr("comment", (char *) Pcomment); + xml.addparstr("name", (char *) Pname); + xml.addparstr("comment", (char *) Pcomment); - xml->addparbool("invert_up_down", Pinvertupdown); - xml->addpar("invert_up_down_center", Pinvertupdowncenter); + xml.addparbool("invert_up_down", Pinvertupdown); + xml.addpar("invert_up_down_center", Pinvertupdowncenter); - xml->addparbool("enabled", Penabled); - xml->addpar("global_fine_detune", Pglobalfinedetune); + xml.addparbool("enabled", Penabled); + xml.addpar("global_fine_detune", Pglobalfinedetune); - xml->addpar("a_note", PAnote); - xml->addparreal("a_freq", PAfreq); + xml.addpar("a_note", PAnote); + xml.addparreal("a_freq", PAfreq); - if((Penabled == 0) && (xml->minimal)) + 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("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); + xml.beginbranch("OCTAVE"); + xml.addpar("octave_size", octavesize); for(int i = 0; i < octavesize; ++i) { - xml->beginbranch("DEGREE", i); + xml.beginbranch("DEGREE", i); if(octave[i].type == 1) - xml->addparreal("cents", octave[i].tuning); + xml.addparreal("cents", octave[i].tuning); ; if(octave[i].type == 2) { - xml->addpar("numerator", octave[i].x1); - xml->addpar("denominator", octave[i].x2); + xml.addpar("numerator", octave[i].x1); + xml.addpar("denominator", octave[i].x2); } - xml->endbranch(); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("KEYBOARD_MAPPING"); - xml->addpar("map_size", Pmapsize); - xml->addpar("mapping_enabled", Pmappingenabled); + xml.beginbranch("KEYBOARD_MAPPING"); + xml.addpar("map_size", Pmapsize); + xml.addpar("mapping_enabled", Pmappingenabled); for(int i = 0; i < Pmapsize; ++i) { - xml->beginbranch("KEYMAP", i); - xml->addpar("degree", Pmapping[i]); - xml->endbranch(); + xml.beginbranch("KEYMAP", i); + xml.addpar("degree", Pmapping[i]); + xml.endbranch(); } - xml->endbranch(); - xml->endbranch(); + xml.endbranch(); + xml.endbranch(); } -void Microtonal::getfromXML(XMLwrapper *xml) +void Microtonal::getfromXML(XMLwrapper& xml) { - xml->getparstr("name", (char *) Pname, MICROTONAL_MAX_NAME_LEN); - xml->getparstr("comment", (char *) Pcomment, MICROTONAL_MAX_NAME_LEN); + 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->getpar127("invert_up_down_center", + Pinvertupdown = xml.getparbool("invert_up_down", Pinvertupdown); + Pinvertupdowncenter = xml.getpar127("invert_up_down_center", Pinvertupdowncenter); - Penabled = xml->getparbool("enabled", Penabled); - Pglobalfinedetune = xml->getpar127("global_fine_detune", Pglobalfinedetune); + 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.0f, 10000.0f); + PAnote = xml.getpar127("a_note", PAnote); + PAfreq = xml.getparreal("a_freq", PAfreq, 1.0f, 10000.0f); - 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("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); + if(xml.enterbranch("OCTAVE")) { + octavesize = xml.getpar127("octave_size", octavesize); for(int i = 0; i < octavesize; ++i) { - if(xml->enterbranch("DEGREE", i) == 0) + if(xml.enterbranch("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); + 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; @@ -659,23 +659,23 @@ void Microtonal::getfromXML(XMLwrapper *xml) } - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("KEYBOARD_MAPPING")) { - Pmapsize = xml->getpar127("map_size", Pmapsize); - Pmappingenabled = xml->getpar127("mapping_enabled", Pmappingenabled); + if(xml.enterbranch("KEYBOARD_MAPPING")) { + Pmapsize = xml.getpar127("map_size", Pmapsize); + Pmappingenabled = xml.getpar127("mapping_enabled", Pmappingenabled); for(int i = 0; i < Pmapsize; ++i) { - if(xml->enterbranch("KEYMAP", i) == 0) + if(xml.enterbranch("KEYMAP", i) == 0) continue; - Pmapping[i] = xml->getpar127("degree", Pmapping[i]); - xml->exitbranch(); + Pmapping[i] = xml.getpar127("degree", Pmapping[i]); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } } @@ -683,30 +683,26 @@ void Microtonal::getfromXML(XMLwrapper *xml) int Microtonal::saveXML(const char *filename) const { - XMLwrapper *xml = new XMLwrapper(); + XMLwrapper xml; - xml->beginbranch("MICROTONAL"); + xml.beginbranch("MICROTONAL"); add2XML(xml); - xml->endbranch(); + xml.endbranch(); - int result = xml->saveXMLfile(filename, gzip_compression); - delete (xml); - return result; + return xml.saveXMLfile(filename, gzip_compression); } int Microtonal::loadXML(const char *filename) { - XMLwrapper *xml = new XMLwrapper(); - if(xml->loadXMLfile(filename) < 0) { - delete (xml); + XMLwrapper xml; + if(xml.loadXMLfile(filename) < 0) { return -1; } - if(xml->enterbranch("MICROTONAL") == 0) + if(xml.enterbranch("MICROTONAL") == 0) return -10; getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); - delete (xml); return 0; } diff --git a/src/Misc/Microtonal.h b/src/Misc/Microtonal.h @@ -105,8 +105,8 @@ class Microtonal /**Comment about the tuning*/ char Pcomment[MICROTONAL_MAX_NAME_LEN]; - void add2XML(XMLwrapper *xml) const; - void getfromXML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml) const; + void getfromXML(XMLwrapper& xml); int saveXML(const char *filename) const; int loadXML(const char *filename); diff --git a/src/Misc/Part.cpp b/src/Misc/Part.cpp @@ -853,102 +853,102 @@ void Part::setkititemstatus(unsigned kititem, bool Penabled_) } } -void Part::add2XMLinstrument(XMLwrapper *xml) +void Part::add2XMLinstrument(XMLwrapper& xml) { - xml->beginbranch("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("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); + xml.beginbranch("INSTRUMENT_KIT"); + xml.addpar("kit_mode", Pkitmode); + xml.addparbool("drum_mode", Pdrummode); for(int i = 0; i < NUM_KIT_ITEMS; ++i) { - xml->beginbranch("INSTRUMENT_KIT_ITEM", i); - xml->addparbool("enabled", kit[i].Penabled); + xml.beginbranch("INSTRUMENT_KIT_ITEM", i); + xml.addparbool("enabled", kit[i].Penabled); if(kit[i].Penabled != 0) { - xml->addparstr("name", (char *)kit[i].Pname); + 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.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.addpar("send_to_instrument_effect", kit[i].Psendtoparteffect); - xml->addparbool("add_enabled", kit[i].Padenabled); + xml.addparbool("add_enabled", kit[i].Padenabled); if(kit[i].Padenabled && kit[i].adpars) { - xml->beginbranch("ADD_SYNTH_PARAMETERS"); + xml.beginbranch("ADD_SYNTH_PARAMETERS"); kit[i].adpars->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->addparbool("sub_enabled", kit[i].Psubenabled); + xml.addparbool("sub_enabled", kit[i].Psubenabled); if(kit[i].Psubenabled && kit[i].subpars) { - xml->beginbranch("SUB_SYNTH_PARAMETERS"); + xml.beginbranch("SUB_SYNTH_PARAMETERS"); kit[i].subpars->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->addparbool("pad_enabled", kit[i].Ppadenabled); + xml.addparbool("pad_enabled", kit[i].Ppadenabled); if(kit[i].Ppadenabled && kit[i].padpars) { - xml->beginbranch("PAD_SYNTH_PARAMETERS"); + xml.beginbranch("PAD_SYNTH_PARAMETERS"); kit[i].padpars->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } } - xml->endbranch(); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("INSTRUMENT_EFFECTS"); + xml.beginbranch("INSTRUMENT_EFFECTS"); for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { - xml->beginbranch("INSTRUMENT_EFFECT", nefx); - xml->beginbranch("EFFECT"); + xml.beginbranch("INSTRUMENT_EFFECT", nefx); + xml.beginbranch("EFFECT"); partefx[nefx]->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->addpar("route", Pefxroute[nefx]); + xml.addpar("route", Pefxroute[nefx]); partefx[nefx]->setdryonly(Pefxroute[nefx] == 2); - xml->addparbool("bypass", Pefxbypass[nefx]); - xml->endbranch(); + xml.addparbool("bypass", Pefxbypass[nefx]); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); } -void Part::add2XML(XMLwrapper *xml) +void Part::add2XML(XMLwrapper& xml) { //parameters - xml->addparbool("enabled", Penabled); - if((Penabled == 0) && (xml->minimal)) + xml.addparbool("enabled", Penabled); + if((Penabled == 0) && (xml.minimal)) return; - xml->addpar("volume", Pvolume); - xml->addpar("panning", Ppanning); + 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("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.addpar("velocity_sensing", Pvelsns); + xml.addpar("velocity_offset", Pveloffs); - xml->addparbool("note_on", Pnoteon); - xml->addparbool("poly_mode", Ppolymode); - xml->addpar("legato_mode", Plegatomode); - xml->addpar("key_limit", Pkeylimit); + xml.addparbool("note_on", Pnoteon); + xml.addparbool("poly_mode", Ppolymode); + xml.addpar("legato_mode", Plegatomode); + xml.addpar("key_limit", Pkeylimit); - xml->beginbranch("INSTRUMENT"); + xml.beginbranch("INSTRUMENT"); add2XMLinstrument(xml); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("CONTROLLER"); + xml.beginbranch("CONTROLLER"); ctl.add2XML(xml); - xml->endbranch(); + xml.endbranch(); } int Part::saveXML(const char *filename) @@ -956,7 +956,7 @@ int Part::saveXML(const char *filename) XMLwrapper xml; xml.beginbranch("INSTRUMENT"); - add2XMLinstrument(&xml); + add2XMLinstrument(xml); xml.endbranch(); int result = xml.saveXMLfile(filename, gzip_compression); @@ -972,7 +972,7 @@ int Part::loadXMLinstrument(const char *filename) if(xml.enterbranch("INSTRUMENT") == 0) return -10; - getfromXMLinstrument(&xml); + getfromXMLinstrument(xml); xml.exitbranch(); return 0; @@ -1043,127 +1043,127 @@ void Part::monomemClear(void) monomemnotes[i] = -1; } -void Part::getfromXMLinstrument(XMLwrapper *xml) +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); + 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(); + xml.exitbranch(); } - if(xml->enterbranch("INSTRUMENT_KIT")) { - Pkitmode = xml->getpar127("kit_mode", Pkitmode); - Pdrummode = xml->getparbool("drum_mode", Pdrummode); + if(xml.enterbranch("INSTRUMENT_KIT")) { + Pkitmode = xml.getpar127("kit_mode", Pkitmode); + Pdrummode = xml.getparbool("drum_mode", Pdrummode); setkititemstatus(0, 0); for(int i = 0; i < NUM_KIT_ITEMS; ++i) { - if(xml->enterbranch("INSTRUMENT_KIT_ITEM", i) == 0) + if(xml.enterbranch("INSTRUMENT_KIT_ITEM", i) == 0) continue; - setkititemstatus(i, xml->getparbool("enabled", kit[i].Penabled)); + setkititemstatus(i, xml.getparbool("enabled", kit[i].Penabled)); if(kit[i].Penabled == 0) { - xml->exitbranch(); + xml.exitbranch(); continue; } - xml->getparstr("name", (char *)kit[i].Pname, PART_MAX_NAME_LEN); + 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].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( + kit[i].Psendtoparteffect = xml.getpar127( "send_to_instrument_effect", kit[i].Psendtoparteffect); - kit[i].Padenabled = xml->getparbool("add_enabled", + kit[i].Padenabled = xml.getparbool("add_enabled", kit[i].Padenabled); - if(xml->enterbranch("ADD_SYNTH_PARAMETERS")) { + if(xml.enterbranch("ADD_SYNTH_PARAMETERS")) { if(!kit[i].adpars) kit[i].adpars = new ADnoteParameters(synth, fft); kit[i].adpars->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - kit[i].Psubenabled = xml->getparbool("sub_enabled", + kit[i].Psubenabled = xml.getparbool("sub_enabled", kit[i].Psubenabled); - if(xml->enterbranch("SUB_SYNTH_PARAMETERS")) { + if(xml.enterbranch("SUB_SYNTH_PARAMETERS")) { if(!kit[i].subpars) kit[i].subpars = new SUBnoteParameters(); kit[i].subpars->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - kit[i].Ppadenabled = xml->getparbool("pad_enabled", + kit[i].Ppadenabled = xml.getparbool("pad_enabled", kit[i].Ppadenabled); - if(xml->enterbranch("PAD_SYNTH_PARAMETERS")) { + if(xml.enterbranch("PAD_SYNTH_PARAMETERS")) { if(!kit[i].padpars) kit[i].padpars = new PADnoteParameters(synth, fft); kit[i].padpars->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("INSTRUMENT_EFFECTS")) { + if(xml.enterbranch("INSTRUMENT_EFFECTS")) { for(int nefx = 0; nefx < NUM_PART_EFX; ++nefx) { - if(xml->enterbranch("INSTRUMENT_EFFECT", nefx) == 0) + if(xml.enterbranch("INSTRUMENT_EFFECT", nefx) == 0) continue; - if(xml->enterbranch("EFFECT")) { + if(xml.enterbranch("EFFECT")) { partefx[nefx]->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - Pefxroute[nefx] = xml->getpar("route", + 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(); + Pefxbypass[nefx] = xml.getparbool("bypass", Pefxbypass[nefx]); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } } -void Part::getfromXML(XMLwrapper *xml) +void Part::getfromXML(XMLwrapper& xml) { - Penabled = xml->getparbool("enabled", Penabled); + Penabled = xml.getparbool("enabled", Penabled); - setPvolume(xml->getpar127("volume", Pvolume)); - setPpanning(xml->getpar127("panning", Ppanning)); + 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); + 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); + Pvelsns = xml.getpar127("velocity_sensing", Pvelsns); + Pveloffs = xml.getpar127("velocity_offset", Pveloffs); - Pnoteon = xml->getparbool("note_on", Pnoteon); - Ppolymode = xml->getparbool("poly_mode", Ppolymode); - Plegatomode = xml->getparbool("legato_mode", Plegatomode); //older versions + Pnoteon = xml.getparbool("note_on", Pnoteon); + Ppolymode = xml.getparbool("poly_mode", Ppolymode); + Plegatomode = xml.getparbool("legato_mode", Plegatomode); //older versions if(!Plegatomode) - Plegatomode = xml->getpar127("legato_mode", Plegatomode); - Pkeylimit = xml->getpar127("key_limit", Pkeylimit); + Plegatomode = xml.getpar127("legato_mode", Plegatomode); + Pkeylimit = xml.getpar127("key_limit", Pkeylimit); - if(xml->enterbranch("INSTRUMENT")) { + if(xml.enterbranch("INSTRUMENT")) { getfromXMLinstrument(xml); - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("CONTROLLER")) { + if(xml.enterbranch("CONTROLLER")) { ctl.getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } } diff --git a/src/Misc/Part.h b/src/Misc/Part.h @@ -71,8 +71,8 @@ class Part int saveXML(const char *filename); int loadXMLinstrument(const char *filename); - void add2XML(XMLwrapper *xml); - void add2XMLinstrument(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); + void add2XMLinstrument(XMLwrapper& xml); void defaults(); void defaultsinstrument(); @@ -83,8 +83,8 @@ class Part void initialize_rt(void) REALTIME; void kill_rt(void) REALTIME; - void getfromXML(XMLwrapper *xml); - void getfromXMLinstrument(XMLwrapper *xml); + void getfromXML(XMLwrapper& xml); + void getfromXMLinstrument(XMLwrapper& xml); void cleanup(bool final = false); diff --git a/src/Misc/PresetExtractor.cpp b/src/Misc/PresetExtractor.cpp @@ -222,7 +222,7 @@ void doPaste(MiddleWare &mw, string url, string type, XMLwrapper &xml, Ts&&... a if(xml.enterbranch(type) == 0) return; - t->getfromXML(&xml); + t->getfromXML(xml); //Send the pointer string path = url+"paste"; @@ -264,7 +264,7 @@ void doArrayPaste(MiddleWare &mw, int field, string url, string type, return; } t->defaults(field); - t->getfromXMLsection(&xml, field); + t->getfromXMLsection(xml, field); xml.exitbranch(); //Send the pointer diff --git a/src/Params/ADnoteParameters.cpp b/src/Params/ADnoteParameters.cpp @@ -567,7 +567,7 @@ ADnoteParameters::~ADnoteParameters() KillVoice(nvoice); } -void ADnoteParameters::add2XMLsection(XMLwrapper *xml, int n) +void ADnoteParameters::add2XMLsection(XMLwrapper& xml, int n) { int nvoice = n; if(nvoice >= NUM_VOICES) @@ -582,321 +582,321 @@ void ADnoteParameters::add2XMLsection(XMLwrapper *xml, int n) fmoscilused = 1; } - xml->addparbool("enabled", VoicePar[nvoice].Enabled); + xml.addparbool("enabled", VoicePar[nvoice].Enabled); if(((VoicePar[nvoice].Enabled == 0) && (oscilused == 0) - && (fmoscilused == 0)) && (xml->minimal)) + && (fmoscilused == 0)) && (xml.minimal)) return; VoicePar[nvoice].add2XML(xml, fmoscilused); } -void ADnoteVoiceParam::add2XML(XMLwrapper *xml, bool fmoscilused) +void ADnoteVoiceParam::add2XML(XMLwrapper& xml, bool fmoscilused) { - xml->addpar("type", Type); + xml.addpar("type", Type); - xml->addpar("unison_size", Unison_size); - xml->addpar("unison_frequency_spread", + xml.addpar("unison_size", Unison_size); + xml.addpar("unison_frequency_spread", Unison_frequency_spread); - xml->addpar("unison_stereo_spread", Unison_stereo_spread); - xml->addpar("unison_vibratto", Unison_vibratto); - xml->addpar("unison_vibratto_speed", Unison_vibratto_speed); - xml->addpar("unison_invert_phase", Unison_invert_phase); - xml->addpar("unison_phase_randomness", Unison_phase_randomness); + xml.addpar("unison_stereo_spread", Unison_stereo_spread); + xml.addpar("unison_vibratto", Unison_vibratto); + xml.addpar("unison_vibratto_speed", Unison_vibratto_speed); + xml.addpar("unison_invert_phase", Unison_invert_phase); + xml.addpar("unison_phase_randomness", Unison_phase_randomness); - xml->addpar("delay", PDelay); - xml->addparbool("resonance", Presonance); + xml.addpar("delay", PDelay); + xml.addparbool("resonance", Presonance); - xml->addpar("ext_oscil", Pextoscil); - xml->addpar("ext_fm_oscil", PextFMoscil); + xml.addpar("ext_oscil", Pextoscil); + xml.addpar("ext_fm_oscil", PextFMoscil); - xml->addpar("oscil_phase", Poscilphase); - xml->addpar("oscil_fm_phase", PFMoscilphase); + xml.addpar("oscil_phase", Poscilphase); + xml.addpar("oscil_fm_phase", PFMoscilphase); - xml->addparbool("filter_enabled", PFilterEnabled); - xml->addparbool("filter_bypass", Pfilterbypass); + xml.addparbool("filter_enabled", PFilterEnabled); + xml.addparbool("filter_bypass", Pfilterbypass); - xml->addpar("fm_enabled", PFMEnabled); + xml.addpar("fm_enabled", PFMEnabled); - xml->beginbranch("OSCIL"); + xml.beginbranch("OSCIL"); OscilSmp->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addpar("panning", PPanning); - xml->addpar("volume", PVolume); - xml->addparbool("volume_minus", PVolumeminus); - xml->addpar("velocity_sensing", PAmpVelocityScaleFunction); + xml.beginbranch("AMPLITUDE_PARAMETERS"); + xml.addpar("panning", PPanning); + xml.addpar("volume", PVolume); + xml.addparbool("volume_minus", PVolumeminus); + xml.addpar("velocity_sensing", PAmpVelocityScaleFunction); - xml->addparbool("amp_envelope_enabled", + xml.addparbool("amp_envelope_enabled", PAmpEnvelopeEnabled); - if((PAmpEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("AMPLITUDE_ENVELOPE"); + if((PAmpEnvelopeEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("AMPLITUDE_ENVELOPE"); AmpEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->addparbool("amp_lfo_enabled", PAmpLfoEnabled); - if((PAmpLfoEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("AMPLITUDE_LFO"); + xml.addparbool("amp_lfo_enabled", PAmpLfoEnabled); + if((PAmpLfoEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("AMPLITUDE_LFO"); AmpLfo->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addparbool("fixed_freq", Pfixedfreq); - xml->addpar("fixed_freq_et", PfixedfreqET); - xml->addpar("detune", PDetune); - xml->addpar("coarse_detune", PCoarseDetune); - xml->addpar("detune_type", PDetuneType); + xml.beginbranch("FREQUENCY_PARAMETERS"); + xml.addparbool("fixed_freq", Pfixedfreq); + xml.addpar("fixed_freq_et", PfixedfreqET); + xml.addpar("detune", PDetune); + xml.addpar("coarse_detune", PCoarseDetune); + xml.addpar("detune_type", PDetuneType); - xml->addparbool("freq_envelope_enabled", + xml.addparbool("freq_envelope_enabled", PFreqEnvelopeEnabled); - if((PFreqEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_ENVELOPE"); + if((PFreqEnvelopeEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("FREQUENCY_ENVELOPE"); FreqEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->addparbool("freq_lfo_enabled", PFreqLfoEnabled); - if((PFreqLfoEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_LFO"); + xml.addparbool("freq_lfo_enabled", PFreqLfoEnabled); + if((PFreqLfoEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("FREQUENCY_LFO"); FreqLfo->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); - if((PFilterEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER_PARAMETERS"); - xml->addpar("velocity_sensing_amplitude", PFilterVelocityScale); - xml->addpar("velocity_sensing", PFilterVelocityScaleFunction); - xml->beginbranch("FILTER"); + if((PFilterEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("FILTER_PARAMETERS"); + xml.addpar("velocity_sensing_amplitude", PFilterVelocityScale); + xml.addpar("velocity_sensing", PFilterVelocityScaleFunction); + xml.beginbranch("FILTER"); VoiceFilter->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->addparbool("filter_envelope_enabled", + xml.addparbool("filter_envelope_enabled", PFilterEnvelopeEnabled); - if((PFilterEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER_ENVELOPE"); + if((PFilterEnvelopeEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("FILTER_ENVELOPE"); FilterEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->addparbool("filter_lfo_enabled", + xml.addparbool("filter_lfo_enabled", PFilterLfoEnabled); - if((PFilterLfoEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER_LFO"); + if((PFilterLfoEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("FILTER_LFO"); FilterLfo->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); } if((PFMEnabled != 0) || (fmoscilused != 0) - || (!xml->minimal)) { - xml->beginbranch("FM_PARAMETERS"); - xml->addpar("input_voice", PFMVoice); + || (!xml.minimal)) { + xml.beginbranch("FM_PARAMETERS"); + xml.addpar("input_voice", PFMVoice); - xml->addpar("volume", PFMVolume); - xml->addpar("volume_damp", PFMVolumeDamp); - xml->addpar("velocity_sensing", + xml.addpar("volume", PFMVolume); + xml.addpar("volume_damp", PFMVolumeDamp); + xml.addpar("velocity_sensing", PFMVelocityScaleFunction); - xml->addparbool("amp_envelope_enabled", + xml.addparbool("amp_envelope_enabled", PFMAmpEnvelopeEnabled); - if((PFMAmpEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("AMPLITUDE_ENVELOPE"); + if((PFMAmpEnvelopeEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("AMPLITUDE_ENVELOPE"); FMAmpEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->beginbranch("MODULATOR"); - xml->addpar("detune", PFMDetune); - xml->addpar("coarse_detune", PFMCoarseDetune); - xml->addpar("detune_type", PFMDetuneType); + xml.beginbranch("MODULATOR"); + xml.addpar("detune", PFMDetune); + xml.addpar("coarse_detune", PFMCoarseDetune); + xml.addpar("detune_type", PFMDetuneType); - xml->addparbool("freq_envelope_enabled", + xml.addparbool("freq_envelope_enabled", PFMFreqEnvelopeEnabled); - if((PFMFreqEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_ENVELOPE"); + if((PFMFreqEnvelopeEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("FREQUENCY_ENVELOPE"); FMFreqEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->beginbranch("OSCIL"); + xml.beginbranch("OSCIL"); FMSmp->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->endbranch(); - xml->endbranch(); + xml.endbranch(); + xml.endbranch(); } } -void ADnoteGlobalParam::add2XML(XMLwrapper *xml) +void ADnoteGlobalParam::add2XML(XMLwrapper& xml) { - xml->addparbool("stereo", PStereo); - - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addpar("volume", PVolume); - xml->addpar("panning", PPanning); - xml->addpar("velocity_sensing", PAmpVelocityScaleFunction); - xml->addpar("fadein_adjustment", Fadein_adjustment); - xml->addpar("punch_strength", PPunchStrength); - xml->addpar("punch_time", PPunchTime); - xml->addpar("punch_stretch", PPunchStretch); - xml->addpar("punch_velocity_sensing", PPunchVelocitySensing); - xml->addpar("harmonic_randomness_grouping", Hrandgrouping); - - xml->beginbranch("AMPLITUDE_ENVELOPE"); + xml.addparbool("stereo", PStereo); + + xml.beginbranch("AMPLITUDE_PARAMETERS"); + xml.addpar("volume", PVolume); + xml.addpar("panning", PPanning); + xml.addpar("velocity_sensing", PAmpVelocityScaleFunction); + xml.addpar("fadein_adjustment", Fadein_adjustment); + xml.addpar("punch_strength", PPunchStrength); + xml.addpar("punch_time", PPunchTime); + xml.addpar("punch_stretch", PPunchStretch); + xml.addpar("punch_velocity_sensing", PPunchVelocitySensing); + xml.addpar("harmonic_randomness_grouping", Hrandgrouping); + + xml.beginbranch("AMPLITUDE_ENVELOPE"); AmpEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("AMPLITUDE_LFO"); + xml.beginbranch("AMPLITUDE_LFO"); AmpLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); + xml.endbranch(); + xml.endbranch(); - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addpar("detune", PDetune); + xml.beginbranch("FREQUENCY_PARAMETERS"); + xml.addpar("detune", PDetune); - xml->addpar("coarse_detune", PCoarseDetune); - xml->addpar("detune_type", PDetuneType); + xml.addpar("coarse_detune", PCoarseDetune); + xml.addpar("detune_type", PDetuneType); - xml->addpar("bandwidth", PBandwidth); + xml.addpar("bandwidth", PBandwidth); - xml->beginbranch("FREQUENCY_ENVELOPE"); + xml.beginbranch("FREQUENCY_ENVELOPE"); FreqEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("FREQUENCY_LFO"); + xml.beginbranch("FREQUENCY_LFO"); FreqLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); + xml.endbranch(); + xml.endbranch(); - xml->beginbranch("FILTER_PARAMETERS"); - xml->addpar("velocity_sensing_amplitude", PFilterVelocityScale); - xml->addpar("velocity_sensing", PFilterVelocityScaleFunction); + xml.beginbranch("FILTER_PARAMETERS"); + xml.addpar("velocity_sensing_amplitude", PFilterVelocityScale); + xml.addpar("velocity_sensing", PFilterVelocityScaleFunction); - xml->beginbranch("FILTER"); + xml.beginbranch("FILTER"); GlobalFilter->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("FILTER_ENVELOPE"); + xml.beginbranch("FILTER_ENVELOPE"); FilterEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("FILTER_LFO"); + xml.beginbranch("FILTER_LFO"); FilterLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); + xml.endbranch(); + xml.endbranch(); - xml->beginbranch("RESONANCE"); + xml.beginbranch("RESONANCE"); Reson->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } -void ADnoteParameters::add2XML(XMLwrapper *xml) +void ADnoteParameters::add2XML(XMLwrapper& xml) { GlobalPar.add2XML(xml); for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { - xml->beginbranch("VOICE", nvoice); + xml.beginbranch("VOICE", nvoice); add2XMLsection(xml, nvoice); - xml->endbranch(); + xml.endbranch(); } } -void ADnoteGlobalParam::getfromXML(XMLwrapper *xml) +void ADnoteGlobalParam::getfromXML(XMLwrapper& xml) { - PStereo = xml->getparbool("stereo", PStereo); + PStereo = xml.getparbool("stereo", PStereo); - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - PVolume = xml->getpar127("volume", PVolume); - PPanning = xml->getpar127("panning", PPanning); - PAmpVelocityScaleFunction = xml->getpar127("velocity_sensing", + if(xml.enterbranch("AMPLITUDE_PARAMETERS")) { + PVolume = xml.getpar127("volume", PVolume); + PPanning = xml.getpar127("panning", PPanning); + PAmpVelocityScaleFunction = xml.getpar127("velocity_sensing", PAmpVelocityScaleFunction); - Fadein_adjustment = xml->getpar127("fadein_adjustment", Fadein_adjustment); - PPunchStrength = xml->getpar127("punch_strength", PPunchStrength); - PPunchTime = xml->getpar127("punch_time", PPunchTime); - PPunchStretch = xml->getpar127("punch_stretch", PPunchStretch); - PPunchVelocitySensing = xml->getpar127("punch_velocity_sensing", + Fadein_adjustment = xml.getpar127("fadein_adjustment", Fadein_adjustment); + PPunchStrength = xml.getpar127("punch_strength", PPunchStrength); + PPunchTime = xml.getpar127("punch_time", PPunchTime); + PPunchStretch = xml.getpar127("punch_stretch", PPunchStretch); + PPunchVelocitySensing = xml.getpar127("punch_velocity_sensing", PPunchVelocitySensing); - Hrandgrouping = xml->getpar127("harmonic_randomness_grouping", + Hrandgrouping = xml.getpar127("harmonic_randomness_grouping", Hrandgrouping); - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { + if(xml.enterbranch("AMPLITUDE_ENVELOPE")) { AmpEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("AMPLITUDE_LFO")) { + if(xml.enterbranch("AMPLITUDE_LFO")) { AmpLfo->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - PDetune = xml->getpar("detune", PDetune, 0, 16383); - PCoarseDetune = xml->getpar("coarse_detune", PCoarseDetune, 0, 16383); - PDetuneType = xml->getpar127("detune_type", PDetuneType); - PBandwidth = xml->getpar127("bandwidth", PBandwidth); + if(xml.enterbranch("FREQUENCY_PARAMETERS")) { + PDetune = xml.getpar("detune", PDetune, 0, 16383); + PCoarseDetune = xml.getpar("coarse_detune", PCoarseDetune, 0, 16383); + PDetuneType = xml.getpar127("detune_type", PDetuneType); + PBandwidth = xml.getpar127("bandwidth", PBandwidth); - xml->enterbranch("FREQUENCY_ENVELOPE"); + xml.enterbranch("FREQUENCY_ENVELOPE"); FreqEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); - xml->enterbranch("FREQUENCY_LFO"); + xml.enterbranch("FREQUENCY_LFO"); FreqLfo->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("FILTER_PARAMETERS")) { - PFilterVelocityScale = xml->getpar127("velocity_sensing_amplitude", + if(xml.enterbranch("FILTER_PARAMETERS")) { + PFilterVelocityScale = xml.getpar127("velocity_sensing_amplitude", PFilterVelocityScale); - PFilterVelocityScaleFunction = xml->getpar127( + PFilterVelocityScaleFunction = xml.getpar127( "velocity_sensing", PFilterVelocityScaleFunction); - xml->enterbranch("FILTER"); + xml.enterbranch("FILTER"); GlobalFilter->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); - xml->enterbranch("FILTER_ENVELOPE"); + xml.enterbranch("FILTER_ENVELOPE"); FilterEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); - xml->enterbranch("FILTER_LFO"); + xml.enterbranch("FILTER_LFO"); FilterLfo->getfromXML(xml); - xml->exitbranch(); - xml->exitbranch(); + xml.exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("RESONANCE")) { + if(xml.enterbranch("RESONANCE")) { Reson->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } } -void ADnoteParameters::getfromXML(XMLwrapper *xml) +void ADnoteParameters::getfromXML(XMLwrapper& xml) { GlobalPar.getfromXML(xml); for(int nvoice = 0; nvoice < NUM_VOICES; ++nvoice) { VoicePar[nvoice].Enabled = 0; - if(xml->enterbranch("VOICE", nvoice) == 0) + if(xml.enterbranch("VOICE", nvoice) == 0) continue; getfromXMLsection(xml, nvoice); - xml->exitbranch(); + xml.exitbranch(); } } -void ADnoteParameters::getfromXMLsection(XMLwrapper *xml, int n) +void ADnoteParameters::getfromXMLsection(XMLwrapper& xml, int n) { int nvoice = n; if(nvoice >= NUM_VOICES) @@ -1042,149 +1042,149 @@ void ADnoteGlobalParam::paste(ADnoteGlobalParam &a) #undef copy #undef RCopy -void ADnoteVoiceParam::getfromXML(XMLwrapper *xml, unsigned nvoice) +void ADnoteVoiceParam::getfromXML(XMLwrapper& xml, unsigned nvoice) { - Enabled = xml->getparbool("enabled", 0); - Unison_size = xml->getpar127("unison_size", Unison_size); - Unison_frequency_spread = xml->getpar127("unison_frequency_spread", + Enabled = xml.getparbool("enabled", 0); + Unison_size = xml.getpar127("unison_size", Unison_size); + Unison_frequency_spread = xml.getpar127("unison_frequency_spread", Unison_frequency_spread); - Unison_stereo_spread = xml->getpar127("unison_stereo_spread", + Unison_stereo_spread = xml.getpar127("unison_stereo_spread", Unison_stereo_spread); - Unison_vibratto = xml->getpar127("unison_vibratto", Unison_vibratto); - Unison_vibratto_speed = xml->getpar127("unison_vibratto_speed", + Unison_vibratto = xml.getpar127("unison_vibratto", Unison_vibratto); + Unison_vibratto_speed = xml.getpar127("unison_vibratto_speed", Unison_vibratto_speed); - Unison_invert_phase = xml->getpar127("unison_invert_phase", + Unison_invert_phase = xml.getpar127("unison_invert_phase", Unison_invert_phase); - Unison_phase_randomness = xml->getpar127("unison_phase_randomness", + Unison_phase_randomness = xml.getpar127("unison_phase_randomness", Unison_phase_randomness); - Type = xml->getpar127("type", Type); - PDelay = xml->getpar127("delay", PDelay); - Presonance = xml->getparbool("resonance", Presonance); + Type = xml.getpar127("type", Type); + PDelay = xml.getpar127("delay", PDelay); + Presonance = xml.getparbool("resonance", Presonance); - Pextoscil = xml->getpar("ext_oscil", -1, -1, nvoice - 1); - PextFMoscil = xml->getpar("ext_fm_oscil", -1, -1, nvoice - 1); + Pextoscil = xml.getpar("ext_oscil", -1, -1, nvoice - 1); + PextFMoscil = xml.getpar("ext_fm_oscil", -1, -1, nvoice - 1); - Poscilphase = xml->getpar127("oscil_phase", Poscilphase); - PFMoscilphase = xml->getpar127("oscil_fm_phase", PFMoscilphase); - PFilterEnabled = xml->getparbool("filter_enabled", PFilterEnabled); - Pfilterbypass = xml->getparbool("filter_bypass", Pfilterbypass); - PFMEnabled = xml->getpar127("fm_enabled", PFMEnabled); + Poscilphase = xml.getpar127("oscil_phase", Poscilphase); + PFMoscilphase = xml.getpar127("oscil_fm_phase", PFMoscilphase); + PFilterEnabled = xml.getparbool("filter_enabled", PFilterEnabled); + Pfilterbypass = xml.getparbool("filter_bypass", Pfilterbypass); + PFMEnabled = xml.getpar127("fm_enabled", PFMEnabled); - if(xml->enterbranch("OSCIL")) { + if(xml.enterbranch("OSCIL")) { OscilSmp->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - PPanning = xml->getpar127("panning", PPanning); - PVolume = xml->getpar127("volume", PVolume); - PVolumeminus = xml->getparbool("volume_minus", PVolumeminus); - PAmpVelocityScaleFunction = xml->getpar127("velocity_sensing", + if(xml.enterbranch("AMPLITUDE_PARAMETERS")) { + PPanning = xml.getpar127("panning", PPanning); + PVolume = xml.getpar127("volume", PVolume); + PVolumeminus = xml.getparbool("volume_minus", PVolumeminus); + PAmpVelocityScaleFunction = xml.getpar127("velocity_sensing", PAmpVelocityScaleFunction); - PAmpEnvelopeEnabled = xml->getparbool("amp_envelope_enabled", + PAmpEnvelopeEnabled = xml.getparbool("amp_envelope_enabled", PAmpEnvelopeEnabled); - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { + if(xml.enterbranch("AMPLITUDE_ENVELOPE")) { AmpEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - PAmpLfoEnabled = xml->getparbool("amp_lfo_enabled", PAmpLfoEnabled); - if(xml->enterbranch("AMPLITUDE_LFO")) { + PAmpLfoEnabled = xml.getparbool("amp_lfo_enabled", PAmpLfoEnabled); + if(xml.enterbranch("AMPLITUDE_LFO")) { AmpLfo->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - Pfixedfreq = xml->getparbool("fixed_freq", Pfixedfreq); - PfixedfreqET = xml->getpar127("fixed_freq_et", PfixedfreqET); - PDetune = xml->getpar("detune", PDetune, 0, 16383); - PCoarseDetune = xml->getpar("coarse_detune", PCoarseDetune, 0, 16383); - PDetuneType = xml->getpar127("detune_type", PDetuneType); - PFreqEnvelopeEnabled = xml->getparbool("freq_envelope_enabled", + if(xml.enterbranch("FREQUENCY_PARAMETERS")) { + Pfixedfreq = xml.getparbool("fixed_freq", Pfixedfreq); + PfixedfreqET = xml.getpar127("fixed_freq_et", PfixedfreqET); + PDetune = xml.getpar("detune", PDetune, 0, 16383); + PCoarseDetune = xml.getpar("coarse_detune", PCoarseDetune, 0, 16383); + PDetuneType = xml.getpar127("detune_type", PDetuneType); + PFreqEnvelopeEnabled = xml.getparbool("freq_envelope_enabled", PFreqEnvelopeEnabled); - if(xml->enterbranch("FREQUENCY_ENVELOPE")) { + if(xml.enterbranch("FREQUENCY_ENVELOPE")) { FreqEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - PFreqLfoEnabled = xml->getparbool("freq_lfo_enabled", PFreqLfoEnabled); + PFreqLfoEnabled = xml.getparbool("freq_lfo_enabled", PFreqLfoEnabled); - if(xml->enterbranch("FREQUENCY_LFO")) { + if(xml.enterbranch("FREQUENCY_LFO")) { FreqLfo->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("FILTER_PARAMETERS")) { - PFilterVelocityScale = xml->getpar127("velocity_sensing_amplitude", + if(xml.enterbranch("FILTER_PARAMETERS")) { + PFilterVelocityScale = xml.getpar127("velocity_sensing_amplitude", PFilterVelocityScale); - PFilterVelocityScaleFunction = xml->getpar127( + PFilterVelocityScaleFunction = xml.getpar127( "velocity_sensing", PFilterVelocityScaleFunction); - if(xml->enterbranch("FILTER")) { + if(xml.enterbranch("FILTER")) { VoiceFilter->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - PFilterEnvelopeEnabled = xml->getparbool("filter_envelope_enabled", + PFilterEnvelopeEnabled = xml.getparbool("filter_envelope_enabled", PFilterEnvelopeEnabled); - if(xml->enterbranch("FILTER_ENVELOPE")) { + if(xml.enterbranch("FILTER_ENVELOPE")) { FilterEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - PFilterLfoEnabled = xml->getparbool("filter_lfo_enabled", + PFilterLfoEnabled = xml.getparbool("filter_lfo_enabled", PFilterLfoEnabled); - if(xml->enterbranch("FILTER_LFO")) { + if(xml.enterbranch("FILTER_LFO")) { FilterLfo->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("FM_PARAMETERS")) { - PFMVoice = xml->getpar("input_voice", PFMVoice, -1, nvoice - 1); - PFMVolume = xml->getpar127("volume", PFMVolume); - PFMVolumeDamp = xml->getpar127("volume_damp", PFMVolumeDamp); - PFMVelocityScaleFunction = xml->getpar127("velocity_sensing", + if(xml.enterbranch("FM_PARAMETERS")) { + PFMVoice = xml.getpar("input_voice", PFMVoice, -1, nvoice - 1); + PFMVolume = xml.getpar127("volume", PFMVolume); + PFMVolumeDamp = xml.getpar127("volume_damp", PFMVolumeDamp); + PFMVelocityScaleFunction = xml.getpar127("velocity_sensing", PFMVelocityScaleFunction); - PFMAmpEnvelopeEnabled = xml->getparbool("amp_envelope_enabled", + PFMAmpEnvelopeEnabled = xml.getparbool("amp_envelope_enabled", PFMAmpEnvelopeEnabled); - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { + if(xml.enterbranch("AMPLITUDE_ENVELOPE")) { FMAmpEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("MODULATOR")) { - PFMDetune = xml->getpar("detune", PFMDetune, 0, 16383); - PFMCoarseDetune = xml->getpar("coarse_detune", + if(xml.enterbranch("MODULATOR")) { + PFMDetune = xml.getpar("detune", PFMDetune, 0, 16383); + PFMCoarseDetune = xml.getpar("coarse_detune", PFMCoarseDetune, 0, 16383); - PFMDetuneType = xml->getpar127("detune_type", PFMDetuneType); + PFMDetuneType = xml.getpar127("detune_type", PFMDetuneType); - PFMFreqEnvelopeEnabled = xml->getparbool("freq_envelope_enabled", + PFMFreqEnvelopeEnabled = xml.getparbool("freq_envelope_enabled", PFMFreqEnvelopeEnabled); - if(xml->enterbranch("FREQUENCY_ENVELOPE")) { + if(xml.enterbranch("FREQUENCY_ENVELOPE")) { FMFreqEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("OSCIL")) { + if(xml.enterbranch("OSCIL")) { FMSmp->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } } diff --git a/src/Params/ADnoteParameters.h b/src/Params/ADnoteParameters.h @@ -38,8 +38,8 @@ struct ADnoteGlobalParam { ADnoteGlobalParam(); ~ADnoteGlobalParam(); void defaults(); - void add2XML(XMLwrapper *xml); - void getfromXML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); + void getfromXML(XMLwrapper& xml); void paste(ADnoteGlobalParam &a); /* The instrument type - MONO/STEREO If the mode is MONO, the panning of voices are not used @@ -115,8 +115,8 @@ struct ADnoteGlobalParam { /* VOICE PARAMETERS */ /***********************************************************/ struct ADnoteVoiceParam { - void getfromXML(XMLwrapper *xml, unsigned nvoice); - void add2XML(XMLwrapper *xml, bool fmoscilused); + void getfromXML(XMLwrapper& xml, unsigned nvoice); + void add2XML(XMLwrapper& xml, bool fmoscilused); void paste(ADnoteVoiceParam &p); void defaults(void); void enable(const SYNTH_T &synth, FFTwrapper *fft, Resonance *Reson); @@ -306,8 +306,8 @@ class ADnoteParameters:public PresetsArray ADnoteVoiceParam VoicePar[NUM_VOICES]; void defaults(); - void add2XML(XMLwrapper *xml); - void getfromXML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); + void getfromXML(XMLwrapper& xml); void paste(ADnoteParameters &a); void pasteArray(ADnoteParameters &a, int section); @@ -317,8 +317,8 @@ class ADnoteParameters:public PresetsArray float getUnisonFrequencySpreadCents(int nvoice) const; static const rtosc::Ports &ports; void defaults(int n); //n is the nvoice - void add2XMLsection(XMLwrapper *xml, int n); - void getfromXMLsection(XMLwrapper *xml, int n); + void add2XMLsection(XMLwrapper& xml, int n); + void getfromXMLsection(XMLwrapper& xml, int n); private: void EnableVoice(const SYNTH_T &synth, int nvoice); diff --git a/src/Params/Controller.cpp b/src/Params/Controller.cpp @@ -384,90 +384,90 @@ void Controller::setparameternumber(unsigned int type, int value) -void Controller::add2XML(XMLwrapper *xml) +void Controller::add2XML(XMLwrapper& xml) { - xml->addpar("pitchwheel_bendrange", pitchwheel.bendrange); - xml->addpar("pitchwheel_bendrange_down", pitchwheel.bendrange_down); - xml->addparbool("pitchwheel_split", pitchwheel.is_split); - - xml->addparbool("expression_receive", expression.receive); - xml->addpar("panning_depth", panning.depth); - xml->addpar("filter_cutoff_depth", filtercutoff.depth); - xml->addpar("filter_q_depth", filterq.depth); - xml->addpar("bandwidth_depth", bandwidth.depth); - xml->addpar("mod_wheel_depth", modwheel.depth); - xml->addparbool("mod_wheel_exponential", modwheel.exponential); - xml->addparbool("fm_amp_receive", fmamp.receive); - xml->addparbool("volume_receive", volume.receive); - xml->addparbool("sustain_receive", sustain.receive); - - xml->addparbool("portamento_receive", portamento.receive); - xml->addpar("portamento_time", portamento.time); - xml->addpar("portamento_pitchthresh", portamento.pitchthresh); - xml->addpar("portamento_pitchthreshtype", portamento.pitchthreshtype); - xml->addpar("portamento_portamento", portamento.portamento); - xml->addpar("portamento_updowntimestretch", portamento.updowntimestretch); - xml->addpar("portamento_proportional", portamento.proportional); - xml->addpar("portamento_proprate", portamento.propRate); - xml->addpar("portamento_propdepth", portamento.propDepth); - - xml->addpar("resonance_center_depth", resonancecenter.depth); - xml->addpar("resonance_bandwidth_depth", resonancebandwidth.depth); + xml.addpar("pitchwheel_bendrange", pitchwheel.bendrange); + xml.addpar("pitchwheel_bendrange_down", pitchwheel.bendrange_down); + xml.addparbool("pitchwheel_split", pitchwheel.is_split); + + xml.addparbool("expression_receive", expression.receive); + xml.addpar("panning_depth", panning.depth); + xml.addpar("filter_cutoff_depth", filtercutoff.depth); + xml.addpar("filter_q_depth", filterq.depth); + xml.addpar("bandwidth_depth", bandwidth.depth); + xml.addpar("mod_wheel_depth", modwheel.depth); + xml.addparbool("mod_wheel_exponential", modwheel.exponential); + xml.addparbool("fm_amp_receive", fmamp.receive); + xml.addparbool("volume_receive", volume.receive); + xml.addparbool("sustain_receive", sustain.receive); + + xml.addparbool("portamento_receive", portamento.receive); + xml.addpar("portamento_time", portamento.time); + xml.addpar("portamento_pitchthresh", portamento.pitchthresh); + xml.addpar("portamento_pitchthreshtype", portamento.pitchthreshtype); + xml.addpar("portamento_portamento", portamento.portamento); + xml.addpar("portamento_updowntimestretch", portamento.updowntimestretch); + xml.addpar("portamento_proportional", portamento.proportional); + xml.addpar("portamento_proprate", portamento.propRate); + xml.addpar("portamento_propdepth", portamento.propDepth); + + xml.addpar("resonance_center_depth", resonancecenter.depth); + xml.addpar("resonance_bandwidth_depth", resonancebandwidth.depth); } -void Controller::getfromXML(XMLwrapper *xml) +void Controller::getfromXML(XMLwrapper& xml) { - pitchwheel.bendrange = xml->getpar("pitchwheel_bendrange", + pitchwheel.bendrange = xml.getpar("pitchwheel_bendrange", pitchwheel.bendrange, -6400, 6400); - pitchwheel.bendrange_down = xml->getpar("pitchwheel_bendrange_down", + pitchwheel.bendrange_down = xml.getpar("pitchwheel_bendrange_down", pitchwheel.bendrange_down, -6400, 6400); - pitchwheel.is_split = xml->getparbool("pitchwheel_split", + pitchwheel.is_split = xml.getparbool("pitchwheel_split", pitchwheel.is_split); - expression.receive = xml->getparbool("expression_receive", + expression.receive = xml.getparbool("expression_receive", expression.receive); - panning.depth = xml->getpar127("panning_depth", panning.depth); - filtercutoff.depth = xml->getpar127("filter_cutoff_depth", + panning.depth = xml.getpar127("panning_depth", panning.depth); + filtercutoff.depth = xml.getpar127("filter_cutoff_depth", filtercutoff.depth); - filterq.depth = xml->getpar127("filter_q_depth", filterq.depth); - bandwidth.depth = xml->getpar127("bandwidth_depth", bandwidth.depth); - modwheel.depth = xml->getpar127("mod_wheel_depth", modwheel.depth); - modwheel.exponential = xml->getparbool("mod_wheel_exponential", + filterq.depth = xml.getpar127("filter_q_depth", filterq.depth); + bandwidth.depth = xml.getpar127("bandwidth_depth", bandwidth.depth); + modwheel.depth = xml.getpar127("mod_wheel_depth", modwheel.depth); + modwheel.exponential = xml.getparbool("mod_wheel_exponential", modwheel.exponential); - fmamp.receive = xml->getparbool("fm_amp_receive", + fmamp.receive = xml.getparbool("fm_amp_receive", fmamp.receive); - volume.receive = xml->getparbool("volume_receive", + volume.receive = xml.getparbool("volume_receive", volume.receive); - sustain.receive = xml->getparbool("sustain_receive", + sustain.receive = xml.getparbool("sustain_receive", sustain.receive); - portamento.receive = xml->getparbool("portamento_receive", + portamento.receive = xml.getparbool("portamento_receive", portamento.receive); - portamento.time = xml->getpar127("portamento_time", + portamento.time = xml.getpar127("portamento_time", portamento.time); - portamento.pitchthresh = xml->getpar127("portamento_pitchthresh", + portamento.pitchthresh = xml.getpar127("portamento_pitchthresh", portamento.pitchthresh); - portamento.pitchthreshtype = xml->getpar127("portamento_pitchthreshtype", + portamento.pitchthreshtype = xml.getpar127("portamento_pitchthreshtype", portamento.pitchthreshtype); - portamento.portamento = xml->getpar127("portamento_portamento", + portamento.portamento = xml.getpar127("portamento_portamento", portamento.portamento); - portamento.updowntimestretch = xml->getpar127( + portamento.updowntimestretch = xml.getpar127( "portamento_updowntimestretch", portamento.updowntimestretch); - portamento.proportional = xml->getpar127("portamento_proportional", + portamento.proportional = xml.getpar127("portamento_proportional", portamento.proportional); - portamento.propRate = xml->getpar127("portamento_proprate", + portamento.propRate = xml.getpar127("portamento_proprate", portamento.propRate); - portamento.propDepth = xml->getpar127("portamento_propdepth", + portamento.propDepth = xml.getpar127("portamento_propdepth", portamento.propDepth); - resonancecenter.depth = xml->getpar127("resonance_center_depth", + resonancecenter.depth = xml.getpar127("resonance_center_depth", resonancecenter.depth); - resonancebandwidth.depth = xml->getpar127("resonance_bandwidth_depth", + resonancebandwidth.depth = xml.getpar127("resonance_bandwidth_depth", resonancebandwidth.depth); } diff --git a/src/Params/Controller.h b/src/Params/Controller.h @@ -35,9 +35,9 @@ class Controller ~Controller(); void resetall(); - void add2XML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); void defaults(); - void getfromXML(XMLwrapper *xml); + void getfromXML(XMLwrapper& xml); //Controllers functions void setpitchwheel(int value); diff --git a/src/Params/EnvelopeParams.cpp b/src/Params/EnvelopeParams.cpp @@ -304,58 +304,58 @@ void EnvelopeParams::converttofree() -void EnvelopeParams::add2XML(XMLwrapper *xml) +void EnvelopeParams::add2XML(XMLwrapper& xml) { - xml->addparbool("free_mode", Pfreemode); - xml->addpar("env_points", Penvpoints); - xml->addpar("env_sustain", Penvsustain); - xml->addpar("env_stretch", Penvstretch); - xml->addparbool("forced_release", Pforcedrelease); - xml->addparbool("linear_envelope", Plinearenvelope); - xml->addpar("A_dt", PA_dt); - xml->addpar("D_dt", PD_dt); - xml->addpar("R_dt", PR_dt); - xml->addpar("A_val", PA_val); - xml->addpar("D_val", PD_val); - xml->addpar("S_val", PS_val); - xml->addpar("R_val", PR_val); - - if((Pfreemode != 0) || (!xml->minimal)) + xml.addparbool("free_mode", Pfreemode); + xml.addpar("env_points", Penvpoints); + xml.addpar("env_sustain", Penvsustain); + xml.addpar("env_stretch", Penvstretch); + xml.addparbool("forced_release", Pforcedrelease); + xml.addparbool("linear_envelope", Plinearenvelope); + xml.addpar("A_dt", PA_dt); + xml.addpar("D_dt", PD_dt); + xml.addpar("R_dt", PR_dt); + xml.addpar("A_val", PA_val); + xml.addpar("D_val", PD_val); + xml.addpar("S_val", PS_val); + xml.addpar("R_val", PR_val); + + if((Pfreemode != 0) || (!xml.minimal)) for(int i = 0; i < Penvpoints; ++i) { - xml->beginbranch("POINT", i); + xml.beginbranch("POINT", i); if(i != 0) - xml->addpar("dt", Penvdt[i]); - xml->addpar("val", Penvval[i]); - xml->endbranch(); + xml.addpar("dt", Penvdt[i]); + xml.addpar("val", Penvval[i]); + xml.endbranch(); } } -void EnvelopeParams::getfromXML(XMLwrapper *xml) +void EnvelopeParams::getfromXML(XMLwrapper& xml) { - Pfreemode = xml->getparbool("free_mode", Pfreemode); - Penvpoints = xml->getpar127("env_points", Penvpoints); - Penvsustain = xml->getpar127("env_sustain", Penvsustain); - Penvstretch = xml->getpar127("env_stretch", Penvstretch); - Pforcedrelease = xml->getparbool("forced_release", Pforcedrelease); - Plinearenvelope = xml->getparbool("linear_envelope", Plinearenvelope); - - PA_dt = xml->getpar127("A_dt", PA_dt); - PD_dt = xml->getpar127("D_dt", PD_dt); - PR_dt = xml->getpar127("R_dt", PR_dt); - PA_val = xml->getpar127("A_val", PA_val); - PD_val = xml->getpar127("D_val", PD_val); - PS_val = xml->getpar127("S_val", PS_val); - PR_val = xml->getpar127("R_val", PR_val); + Pfreemode = xml.getparbool("free_mode", Pfreemode); + Penvpoints = xml.getpar127("env_points", Penvpoints); + Penvsustain = xml.getpar127("env_sustain", Penvsustain); + Penvstretch = xml.getpar127("env_stretch", Penvstretch); + Pforcedrelease = xml.getparbool("forced_release", Pforcedrelease); + Plinearenvelope = xml.getparbool("linear_envelope", Plinearenvelope); + + PA_dt = xml.getpar127("A_dt", PA_dt); + PD_dt = xml.getpar127("D_dt", PD_dt); + PR_dt = xml.getpar127("R_dt", PR_dt); + PA_val = xml.getpar127("A_val", PA_val); + PD_val = xml.getpar127("D_val", PD_val); + PS_val = xml.getpar127("S_val", PS_val); + PR_val = xml.getpar127("R_val", PR_val); for(int i = 0; i < Penvpoints; ++i) { - if(xml->enterbranch("POINT", i) == 0) + if(xml.enterbranch("POINT", i) == 0) continue; if(i != 0) - Penvdt[i] = xml->getpar127("dt", Penvdt[i]); - Penvval[i] = xml->getpar127("val", Penvval[i]); - xml->exitbranch(); + Penvdt[i] = xml.getpar127("dt", Penvdt[i]); + Penvval[i] = xml.getpar127("val", Penvval[i]); + xml.exitbranch(); } if(!Pfreemode) diff --git a/src/Params/EnvelopeParams.h b/src/Params/EnvelopeParams.h @@ -46,9 +46,9 @@ class EnvelopeParams:public Presets void ASRinit_bw(char A_val, char A_dt, char R_val, char R_dt); void converttofree(); - void add2XML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); void defaults(); - void getfromXML(XMLwrapper *xml); + void getfromXML(XMLwrapper& xml); float getdt(char i) const; static float dt(char val); diff --git a/src/Params/FilterParams.cpp b/src/Params/FilterParams.cpp @@ -309,114 +309,114 @@ float FilterParams::getformantq(unsigned char q) -void FilterParams::add2XMLsection(XMLwrapper *xml, int n) +void FilterParams::add2XMLsection(XMLwrapper& xml, int n) { int nvowel = n; for(int nformant = 0; nformant < FF_MAX_FORMANTS; ++nformant) { - xml->beginbranch("FORMANT", nformant); - xml->addpar("freq", Pvowels[nvowel].formants[nformant].freq); - xml->addpar("amp", Pvowels[nvowel].formants[nformant].amp); - xml->addpar("q", Pvowels[nvowel].formants[nformant].q); - xml->endbranch(); + xml.beginbranch("FORMANT", nformant); + xml.addpar("freq", Pvowels[nvowel].formants[nformant].freq); + xml.addpar("amp", Pvowels[nvowel].formants[nformant].amp); + xml.addpar("q", Pvowels[nvowel].formants[nformant].q); + xml.endbranch(); } } -void FilterParams::add2XML(XMLwrapper *xml) +void FilterParams::add2XML(XMLwrapper& xml) { //filter parameters - xml->addpar("category", Pcategory); - xml->addpar("type", Ptype); - xml->addpar("freq", Pfreq); - xml->addpar("q", Pq); - xml->addpar("stages", Pstages); - xml->addpar("freq_track", Pfreqtrack); - xml->addpar("gain", Pgain); + xml.addpar("category", Pcategory); + xml.addpar("type", Ptype); + xml.addpar("freq", Pfreq); + xml.addpar("q", Pq); + xml.addpar("stages", Pstages); + xml.addpar("freq_track", Pfreqtrack); + xml.addpar("gain", Pgain); //formant filter parameters - if((Pcategory == 1) || (!xml->minimal)) { - xml->beginbranch("FORMANT_FILTER"); - xml->addpar("num_formants", Pnumformants); - xml->addpar("formant_slowness", Pformantslowness); - xml->addpar("vowel_clearness", Pvowelclearness); - xml->addpar("center_freq", Pcenterfreq); - xml->addpar("octaves_freq", Poctavesfreq); + if((Pcategory == 1) || (!xml.minimal)) { + xml.beginbranch("FORMANT_FILTER"); + xml.addpar("num_formants", Pnumformants); + xml.addpar("formant_slowness", Pformantslowness); + xml.addpar("vowel_clearness", Pvowelclearness); + xml.addpar("center_freq", Pcenterfreq); + xml.addpar("octaves_freq", Poctavesfreq); for(int nvowel = 0; nvowel < FF_MAX_VOWELS; ++nvowel) { - xml->beginbranch("VOWEL", nvowel); + xml.beginbranch("VOWEL", nvowel); add2XMLsection(xml, nvowel); - xml->endbranch(); + xml.endbranch(); } - xml->addpar("sequence_size", Psequencesize); - xml->addpar("sequence_stretch", Psequencestretch); - xml->addparbool("sequence_reversed", Psequencereversed); + xml.addpar("sequence_size", Psequencesize); + xml.addpar("sequence_stretch", Psequencestretch); + xml.addparbool("sequence_reversed", Psequencereversed); for(int nseq = 0; nseq < FF_MAX_SEQUENCE; ++nseq) { - xml->beginbranch("SEQUENCE_POS", nseq); - xml->addpar("vowel_id", Psequence[nseq].nvowel); - xml->endbranch(); + xml.beginbranch("SEQUENCE_POS", nseq); + xml.addpar("vowel_id", Psequence[nseq].nvowel); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); } } -void FilterParams::getfromXMLsection(XMLwrapper *xml, int n) +void FilterParams::getfromXMLsection(XMLwrapper& xml, int n) { int nvowel = n; for(int nformant = 0; nformant < FF_MAX_FORMANTS; ++nformant) { - if(xml->enterbranch("FORMANT", nformant) == 0) + if(xml.enterbranch("FORMANT", nformant) == 0) continue; - Pvowels[nvowel].formants[nformant].freq = xml->getpar127( + Pvowels[nvowel].formants[nformant].freq = xml.getpar127( "freq", Pvowels[nvowel ].formants[nformant].freq); - Pvowels[nvowel].formants[nformant].amp = xml->getpar127( + Pvowels[nvowel].formants[nformant].amp = xml.getpar127( "amp", Pvowels[nvowel ].formants[nformant].amp); Pvowels[nvowel].formants[nformant].q = - xml->getpar127("q", Pvowels[nvowel].formants[nformant].q); - xml->exitbranch(); + xml.getpar127("q", Pvowels[nvowel].formants[nformant].q); + xml.exitbranch(); } } -void FilterParams::getfromXML(XMLwrapper *xml) +void FilterParams::getfromXML(XMLwrapper& xml) { //filter parameters - Pcategory = xml->getpar127("category", Pcategory); - Ptype = xml->getpar127("type", Ptype); - Pfreq = xml->getpar127("freq", Pfreq); - Pq = xml->getpar127("q", Pq); - Pstages = xml->getpar127("stages", Pstages); - Pfreqtrack = xml->getpar127("freq_track", Pfreqtrack); - Pgain = xml->getpar127("gain", Pgain); + Pcategory = xml.getpar127("category", Pcategory); + Ptype = xml.getpar127("type", Ptype); + Pfreq = xml.getpar127("freq", Pfreq); + Pq = xml.getpar127("q", Pq); + Pstages = xml.getpar127("stages", Pstages); + Pfreqtrack = xml.getpar127("freq_track", Pfreqtrack); + Pgain = xml.getpar127("gain", Pgain); //formant filter parameters - if(xml->enterbranch("FORMANT_FILTER")) { - Pnumformants = xml->getpar127("num_formants", Pnumformants); - Pformantslowness = xml->getpar127("formant_slowness", Pformantslowness); - Pvowelclearness = xml->getpar127("vowel_clearness", Pvowelclearness); - Pcenterfreq = xml->getpar127("center_freq", Pcenterfreq); - Poctavesfreq = xml->getpar127("octaves_freq", Poctavesfreq); + if(xml.enterbranch("FORMANT_FILTER")) { + Pnumformants = xml.getpar127("num_formants", Pnumformants); + Pformantslowness = xml.getpar127("formant_slowness", Pformantslowness); + Pvowelclearness = xml.getpar127("vowel_clearness", Pvowelclearness); + Pcenterfreq = xml.getpar127("center_freq", Pcenterfreq); + Poctavesfreq = xml.getpar127("octaves_freq", Poctavesfreq); for(int nvowel = 0; nvowel < FF_MAX_VOWELS; ++nvowel) { - if(xml->enterbranch("VOWEL", nvowel) == 0) + if(xml.enterbranch("VOWEL", nvowel) == 0) continue; getfromXMLsection(xml, nvowel); - xml->exitbranch(); + xml.exitbranch(); } - Psequencesize = xml->getpar127("sequence_size", Psequencesize); - Psequencestretch = xml->getpar127("sequence_stretch", Psequencestretch); - Psequencereversed = xml->getparbool("sequence_reversed", + Psequencesize = xml.getpar127("sequence_size", Psequencesize); + Psequencestretch = xml.getpar127("sequence_stretch", Psequencestretch); + Psequencereversed = xml.getparbool("sequence_reversed", Psequencereversed); for(int nseq = 0; nseq < FF_MAX_SEQUENCE; ++nseq) { - if(xml->enterbranch("SEQUENCE_POS", nseq) == 0) + if(xml.enterbranch("SEQUENCE_POS", nseq) == 0) continue; - Psequence[nseq].nvowel = xml->getpar("vowel_id", + Psequence[nseq].nvowel = xml.getpar("vowel_id", Psequence[nseq].nvowel, 0, FF_MAX_VOWELS - 1); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } } diff --git a/src/Params/FilterParams.h b/src/Params/FilterParams.h @@ -36,11 +36,11 @@ class FilterParams:public PresetsArray unsigned char Pq_); ~FilterParams(); - void add2XML(XMLwrapper *xml); - void add2XMLsection(XMLwrapper *xml, int n); + void add2XML(XMLwrapper& xml); + void add2XMLsection(XMLwrapper& xml, int n); void defaults(); - void getfromXML(XMLwrapper *xml); - void getfromXMLsection(XMLwrapper *xml, int n); + void getfromXML(XMLwrapper& xml); + void getfromXMLsection(XMLwrapper& xml, int n); void paste(FilterParams &); void pasteArray(FilterParams &, int section); diff --git a/src/Params/LFOParams.cpp b/src/Params/LFOParams.cpp @@ -116,30 +116,30 @@ void LFOParams::defaults() } -void LFOParams::add2XML(XMLwrapper *xml) +void LFOParams::add2XML(XMLwrapper& xml) { - xml->addparreal("freq", Pfreq); - xml->addpar("intensity", Pintensity); - xml->addpar("start_phase", Pstartphase); - xml->addpar("lfo_type", PLFOtype); - xml->addpar("randomness_amplitude", Prandomness); - xml->addpar("randomness_frequency", Pfreqrand); - xml->addpar("delay", Pdelay); - xml->addpar("stretch", Pstretch); - xml->addparbool("continous", Pcontinous); + xml.addparreal("freq", Pfreq); + xml.addpar("intensity", Pintensity); + xml.addpar("start_phase", Pstartphase); + xml.addpar("lfo_type", PLFOtype); + xml.addpar("randomness_amplitude", Prandomness); + xml.addpar("randomness_frequency", Pfreqrand); + xml.addpar("delay", Pdelay); + xml.addpar("stretch", Pstretch); + xml.addparbool("continous", Pcontinous); } -void LFOParams::getfromXML(XMLwrapper *xml) +void LFOParams::getfromXML(XMLwrapper& xml) { - Pfreq = xml->getparreal("freq", Pfreq, 0.0f, 1.0f); - Pintensity = xml->getpar127("intensity", Pintensity); - Pstartphase = xml->getpar127("start_phase", Pstartphase); - PLFOtype = xml->getpar127("lfo_type", PLFOtype); - Prandomness = xml->getpar127("randomness_amplitude", Prandomness); - Pfreqrand = xml->getpar127("randomness_frequency", Pfreqrand); - Pdelay = xml->getpar127("delay", Pdelay); - Pstretch = xml->getpar127("stretch", Pstretch); - Pcontinous = xml->getparbool("continous", Pcontinous); + Pfreq = xml.getparreal("freq", Pfreq, 0.0f, 1.0f); + Pintensity = xml.getpar127("intensity", Pintensity); + Pstartphase = xml.getpar127("start_phase", Pstartphase); + PLFOtype = xml.getpar127("lfo_type", PLFOtype); + Prandomness = xml.getpar127("randomness_amplitude", Prandomness); + Pfreqrand = xml.getpar127("randomness_frequency", Pfreqrand); + Pdelay = xml.getpar127("delay", Pdelay); + Pstretch = xml.getpar127("stretch", Pstretch); + Pcontinous = xml.getparbool("continous", Pcontinous); } #define COPY(y) this->y=x.y diff --git a/src/Params/LFOParams.h b/src/Params/LFOParams.h @@ -50,10 +50,10 @@ class LFOParams:public Presets char fel_); ~LFOParams(); - void add2XML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); void defaults(); /**Loads the LFO from the xml*/ - void getfromXML(XMLwrapper *xml); + void getfromXML(XMLwrapper& xml); void paste(LFOParams &); /* MIDI Parameters*/ diff --git a/src/Params/PADnoteParameters.cpp b/src/Params/PADnoteParameters.cpp @@ -901,221 +901,221 @@ void PADnoteParameters::export2wav(std::string basefilename) } } -void PADnoteParameters::add2XML(XMLwrapper *xml) +void PADnoteParameters::add2XML(XMLwrapper& xml) { - xml->setPadSynth(true); - - xml->addparbool("stereo", PStereo); - xml->addpar("mode", Pmode); - xml->addpar("bandwidth", Pbandwidth); - xml->addpar("bandwidth_scale", Pbwscale); - - xml->beginbranch("HARMONIC_PROFILE"); - xml->addpar("base_type", Php.base.type); - xml->addpar("base_par1", Php.base.par1); - xml->addpar("frequency_multiplier", Php.freqmult); - xml->addpar("modulator_par1", Php.modulator.par1); - xml->addpar("modulator_frequency", Php.modulator.freq); - xml->addpar("width", Php.width); - xml->addpar("amplitude_multiplier_type", Php.amp.type); - xml->addpar("amplitude_multiplier_mode", Php.amp.mode); - xml->addpar("amplitude_multiplier_par1", Php.amp.par1); - xml->addpar("amplitude_multiplier_par2", Php.amp.par2); - xml->addparbool("autoscale", Php.autoscale); - xml->addpar("one_half", Php.onehalf); - xml->endbranch(); - - xml->beginbranch("OSCIL"); + xml.setPadSynth(true); + + xml.addparbool("stereo", PStereo); + xml.addpar("mode", Pmode); + xml.addpar("bandwidth", Pbandwidth); + xml.addpar("bandwidth_scale", Pbwscale); + + xml.beginbranch("HARMONIC_PROFILE"); + xml.addpar("base_type", Php.base.type); + xml.addpar("base_par1", Php.base.par1); + xml.addpar("frequency_multiplier", Php.freqmult); + xml.addpar("modulator_par1", Php.modulator.par1); + xml.addpar("modulator_frequency", Php.modulator.freq); + xml.addpar("width", Php.width); + xml.addpar("amplitude_multiplier_type", Php.amp.type); + xml.addpar("amplitude_multiplier_mode", Php.amp.mode); + xml.addpar("amplitude_multiplier_par1", Php.amp.par1); + xml.addpar("amplitude_multiplier_par2", Php.amp.par2); + xml.addparbool("autoscale", Php.autoscale); + xml.addpar("one_half", Php.onehalf); + xml.endbranch(); + + xml.beginbranch("OSCIL"); oscilgen->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("RESONANCE"); + xml.beginbranch("RESONANCE"); resonance->add2XML(xml); - xml->endbranch(); - - xml->beginbranch("HARMONIC_POSITION"); - xml->addpar("type", Phrpos.type); - xml->addpar("parameter1", Phrpos.par1); - xml->addpar("parameter2", Phrpos.par2); - xml->addpar("parameter3", Phrpos.par3); - xml->endbranch(); - - xml->beginbranch("SAMPLE_QUALITY"); - xml->addpar("samplesize", Pquality.samplesize); - xml->addpar("basenote", Pquality.basenote); - xml->addpar("octaves", Pquality.oct); - xml->addpar("samples_per_octave", Pquality.smpoct); - xml->endbranch(); - - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addpar("volume", PVolume); - xml->addpar("panning", PPanning); - xml->addpar("velocity_sensing", PAmpVelocityScaleFunction); - xml->addpar("fadein_adjustment", Fadein_adjustment); - xml->addpar("punch_strength", PPunchStrength); - xml->addpar("punch_time", PPunchTime); - xml->addpar("punch_stretch", PPunchStretch); - xml->addpar("punch_velocity_sensing", PPunchVelocitySensing); - - xml->beginbranch("AMPLITUDE_ENVELOPE"); + xml.endbranch(); + + xml.beginbranch("HARMONIC_POSITION"); + xml.addpar("type", Phrpos.type); + xml.addpar("parameter1", Phrpos.par1); + xml.addpar("parameter2", Phrpos.par2); + xml.addpar("parameter3", Phrpos.par3); + xml.endbranch(); + + xml.beginbranch("SAMPLE_QUALITY"); + xml.addpar("samplesize", Pquality.samplesize); + xml.addpar("basenote", Pquality.basenote); + xml.addpar("octaves", Pquality.oct); + xml.addpar("samples_per_octave", Pquality.smpoct); + xml.endbranch(); + + xml.beginbranch("AMPLITUDE_PARAMETERS"); + xml.addpar("volume", PVolume); + xml.addpar("panning", PPanning); + xml.addpar("velocity_sensing", PAmpVelocityScaleFunction); + xml.addpar("fadein_adjustment", Fadein_adjustment); + xml.addpar("punch_strength", PPunchStrength); + xml.addpar("punch_time", PPunchTime); + xml.addpar("punch_stretch", PPunchStretch); + xml.addpar("punch_velocity_sensing", PPunchVelocitySensing); + + xml.beginbranch("AMPLITUDE_ENVELOPE"); AmpEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("AMPLITUDE_LFO"); + xml.beginbranch("AMPLITUDE_LFO"); AmpLfo->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addpar("fixed_freq", Pfixedfreq); - xml->addpar("fixed_freq_et", PfixedfreqET); - xml->addpar("detune", PDetune); - xml->addpar("coarse_detune", PCoarseDetune); - xml->addpar("detune_type", PDetuneType); + xml.beginbranch("FREQUENCY_PARAMETERS"); + xml.addpar("fixed_freq", Pfixedfreq); + xml.addpar("fixed_freq_et", PfixedfreqET); + xml.addpar("detune", PDetune); + xml.addpar("coarse_detune", PCoarseDetune); + xml.addpar("detune_type", PDetuneType); - xml->beginbranch("FREQUENCY_ENVELOPE"); + xml.beginbranch("FREQUENCY_ENVELOPE"); FreqEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("FREQUENCY_LFO"); + xml.beginbranch("FREQUENCY_LFO"); FreqLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); + xml.endbranch(); + xml.endbranch(); - xml->beginbranch("FILTER_PARAMETERS"); - xml->addpar("velocity_sensing_amplitude", PFilterVelocityScale); - xml->addpar("velocity_sensing", PFilterVelocityScaleFunction); + xml.beginbranch("FILTER_PARAMETERS"); + xml.addpar("velocity_sensing_amplitude", PFilterVelocityScale); + xml.addpar("velocity_sensing", PFilterVelocityScaleFunction); - xml->beginbranch("FILTER"); + xml.beginbranch("FILTER"); GlobalFilter->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("FILTER_ENVELOPE"); + xml.beginbranch("FILTER_ENVELOPE"); FilterEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("FILTER_LFO"); + xml.beginbranch("FILTER_LFO"); FilterLfo->add2XML(xml); - xml->endbranch(); - xml->endbranch(); + xml.endbranch(); + xml.endbranch(); } -void PADnoteParameters::getfromXML(XMLwrapper *xml) +void PADnoteParameters::getfromXML(XMLwrapper& xml) { - PStereo = xml->getparbool("stereo", PStereo); - Pmode = xml->getpar127("mode", 0); - Pbandwidth = xml->getpar("bandwidth", Pbandwidth, 0, 1000); - Pbwscale = xml->getpar127("bandwidth_scale", Pbwscale); - - if(xml->enterbranch("HARMONIC_PROFILE")) { - Php.base.type = xml->getpar127("base_type", Php.base.type); - Php.base.par1 = xml->getpar127("base_par1", Php.base.par1); - Php.freqmult = xml->getpar127("frequency_multiplier", + PStereo = xml.getparbool("stereo", PStereo); + Pmode = xml.getpar127("mode", 0); + Pbandwidth = xml.getpar("bandwidth", Pbandwidth, 0, 1000); + Pbwscale = xml.getpar127("bandwidth_scale", Pbwscale); + + if(xml.enterbranch("HARMONIC_PROFILE")) { + Php.base.type = xml.getpar127("base_type", Php.base.type); + Php.base.par1 = xml.getpar127("base_par1", Php.base.par1); + Php.freqmult = xml.getpar127("frequency_multiplier", Php.freqmult); - Php.modulator.par1 = xml->getpar127("modulator_par1", + Php.modulator.par1 = xml.getpar127("modulator_par1", Php.modulator.par1); - Php.modulator.freq = xml->getpar127("modulator_frequency", + Php.modulator.freq = xml.getpar127("modulator_frequency", Php.modulator.freq); - Php.width = xml->getpar127("width", Php.width); - Php.amp.type = xml->getpar127("amplitude_multiplier_type", + Php.width = xml.getpar127("width", Php.width); + Php.amp.type = xml.getpar127("amplitude_multiplier_type", Php.amp.type); - Php.amp.mode = xml->getpar127("amplitude_multiplier_mode", + Php.amp.mode = xml.getpar127("amplitude_multiplier_mode", Php.amp.mode); - Php.amp.par1 = xml->getpar127("amplitude_multiplier_par1", + Php.amp.par1 = xml.getpar127("amplitude_multiplier_par1", Php.amp.par1); - Php.amp.par2 = xml->getpar127("amplitude_multiplier_par2", + Php.amp.par2 = xml.getpar127("amplitude_multiplier_par2", Php.amp.par2); - Php.autoscale = xml->getparbool("autoscale", Php.autoscale); - Php.onehalf = xml->getpar127("one_half", Php.onehalf); - xml->exitbranch(); + Php.autoscale = xml.getparbool("autoscale", Php.autoscale); + Php.onehalf = xml.getpar127("one_half", Php.onehalf); + xml.exitbranch(); } - if(xml->enterbranch("OSCIL")) { + if(xml.enterbranch("OSCIL")) { oscilgen->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("RESONANCE")) { + if(xml.enterbranch("RESONANCE")) { resonance->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("HARMONIC_POSITION")) { - Phrpos.type = xml->getpar127("type", Phrpos.type); - Phrpos.par1 = xml->getpar("parameter1", Phrpos.par1, 0, 255); - Phrpos.par2 = xml->getpar("parameter2", Phrpos.par2, 0, 255); - Phrpos.par3 = xml->getpar("parameter3", Phrpos.par3, 0, 255); - xml->exitbranch(); + if(xml.enterbranch("HARMONIC_POSITION")) { + Phrpos.type = xml.getpar127("type", Phrpos.type); + Phrpos.par1 = xml.getpar("parameter1", Phrpos.par1, 0, 255); + Phrpos.par2 = xml.getpar("parameter2", Phrpos.par2, 0, 255); + Phrpos.par3 = xml.getpar("parameter3", Phrpos.par3, 0, 255); + xml.exitbranch(); } - if(xml->enterbranch("SAMPLE_QUALITY")) { - Pquality.samplesize = xml->getpar127("samplesize", Pquality.samplesize); - Pquality.basenote = xml->getpar127("basenote", Pquality.basenote); - Pquality.oct = xml->getpar127("octaves", Pquality.oct); - Pquality.smpoct = xml->getpar127("samples_per_octave", + if(xml.enterbranch("SAMPLE_QUALITY")) { + Pquality.samplesize = xml.getpar127("samplesize", Pquality.samplesize); + Pquality.basenote = xml.getpar127("basenote", Pquality.basenote); + Pquality.oct = xml.getpar127("octaves", Pquality.oct); + Pquality.smpoct = xml.getpar127("samples_per_octave", Pquality.smpoct); - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - PVolume = xml->getpar127("volume", PVolume); - PPanning = xml->getpar127("panning", PPanning); - PAmpVelocityScaleFunction = xml->getpar127("velocity_sensing", + if(xml.enterbranch("AMPLITUDE_PARAMETERS")) { + PVolume = xml.getpar127("volume", PVolume); + PPanning = xml.getpar127("panning", PPanning); + PAmpVelocityScaleFunction = xml.getpar127("velocity_sensing", PAmpVelocityScaleFunction); - Fadein_adjustment = xml->getpar127("fadein_adjustment", Fadein_adjustment); - PPunchStrength = xml->getpar127("punch_strength", PPunchStrength); - PPunchTime = xml->getpar127("punch_time", PPunchTime); - PPunchStretch = xml->getpar127("punch_stretch", PPunchStretch); - PPunchVelocitySensing = xml->getpar127("punch_velocity_sensing", + Fadein_adjustment = xml.getpar127("fadein_adjustment", Fadein_adjustment); + PPunchStrength = xml.getpar127("punch_strength", PPunchStrength); + PPunchTime = xml.getpar127("punch_time", PPunchTime); + PPunchStretch = xml.getpar127("punch_stretch", PPunchStretch); + PPunchVelocitySensing = xml.getpar127("punch_velocity_sensing", PPunchVelocitySensing); - xml->enterbranch("AMPLITUDE_ENVELOPE"); + xml.enterbranch("AMPLITUDE_ENVELOPE"); AmpEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); - xml->enterbranch("AMPLITUDE_LFO"); + xml.enterbranch("AMPLITUDE_LFO"); AmpLfo->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - Pfixedfreq = xml->getpar127("fixed_freq", Pfixedfreq); - PfixedfreqET = xml->getpar127("fixed_freq_et", PfixedfreqET); - PDetune = xml->getpar("detune", PDetune, 0, 16383); - PCoarseDetune = xml->getpar("coarse_detune", PCoarseDetune, 0, 16383); - PDetuneType = xml->getpar127("detune_type", PDetuneType); + if(xml.enterbranch("FREQUENCY_PARAMETERS")) { + Pfixedfreq = xml.getpar127("fixed_freq", Pfixedfreq); + PfixedfreqET = xml.getpar127("fixed_freq_et", PfixedfreqET); + PDetune = xml.getpar("detune", PDetune, 0, 16383); + PCoarseDetune = xml.getpar("coarse_detune", PCoarseDetune, 0, 16383); + PDetuneType = xml.getpar127("detune_type", PDetuneType); - xml->enterbranch("FREQUENCY_ENVELOPE"); + xml.enterbranch("FREQUENCY_ENVELOPE"); FreqEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); - xml->enterbranch("FREQUENCY_LFO"); + xml.enterbranch("FREQUENCY_LFO"); FreqLfo->getfromXML(xml); - xml->exitbranch(); - xml->exitbranch(); + xml.exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("FILTER_PARAMETERS")) { - PFilterVelocityScale = xml->getpar127("velocity_sensing_amplitude", + if(xml.enterbranch("FILTER_PARAMETERS")) { + PFilterVelocityScale = xml.getpar127("velocity_sensing_amplitude", PFilterVelocityScale); - PFilterVelocityScaleFunction = xml->getpar127( + PFilterVelocityScaleFunction = xml.getpar127( "velocity_sensing", PFilterVelocityScaleFunction); - xml->enterbranch("FILTER"); + xml.enterbranch("FILTER"); GlobalFilter->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); - xml->enterbranch("FILTER_ENVELOPE"); + xml.enterbranch("FILTER_ENVELOPE"); FilterEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); - xml->enterbranch("FILTER_LFO"); + xml.enterbranch("FILTER_LFO"); FilterLfo->getfromXML(xml); - xml->exitbranch(); - xml->exitbranch(); + xml.exitbranch(); + xml.exitbranch(); } } diff --git a/src/Params/PADnoteParameters.h b/src/Params/PADnoteParameters.h @@ -46,8 +46,8 @@ class PADnoteParameters:public Presets ~PADnoteParameters(); void defaults(); - void add2XML(XMLwrapper *xml); - void getfromXML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); + void getfromXML(XMLwrapper& xml); //returns a value between 0.0f-1.0f that represents the estimation perceived bandwidth float getprofile(float *smp, int size); diff --git a/src/Params/Presets.cpp b/src/Params/Presets.cpp @@ -55,7 +55,7 @@ void Presets::copy(PresetsStore &ps, const char *name) strcpy(type, "Plfo"); xml.beginbranch(type); - add2XML(&xml); + add2XML(xml); xml.endbranch(); if(name == NULL) diff --git a/src/Params/Presets.h b/src/Params/Presets.h @@ -44,7 +44,7 @@ class Presets protected: void setpresettype(const char *type); private: - virtual void add2XML(XMLwrapper *xml) = 0; + virtual void add2XML(XMLwrapper& xml) = 0; //virtual void getfromXML(XMLwrapper *xml) = 0; //virtual void defaults() = 0; }; diff --git a/src/Params/PresetsArray.cpp b/src/Params/PresetsArray.cpp @@ -61,9 +61,9 @@ void PresetsArray::copy(PresetsStore &ps, int nelement, const char *name) xml.beginbranch(type); if(nelement == -1) - add2XML(&xml); + add2XML(xml); else - add2XMLsection(&xml, nelement); + add2XMLsection(xml, nelement); xml.endbranch(); if(name == NULL) diff --git a/src/Params/PresetsArray.h b/src/Params/PresetsArray.h @@ -42,7 +42,7 @@ class PresetsArray:public Presets protected: void setpresettype(const char *type); private: - virtual void add2XMLsection(XMLwrapper *xml, int n) = 0; + virtual void add2XMLsection(XMLwrapper& xml, int n) = 0; //virtual void getfromXMLsection(XMLwrapper *xml, int n) = 0; //virtual void defaults() = 0; //virtual void defaults(int n) = 0; diff --git a/src/Params/SUBnoteParameters.cpp b/src/Params/SUBnoteParameters.cpp @@ -202,80 +202,80 @@ SUBnoteParameters::~SUBnoteParameters() -void SUBnoteParameters::add2XML(XMLwrapper *xml) +void SUBnoteParameters::add2XML(XMLwrapper& xml) { - xml->addpar("num_stages", Pnumstages); - xml->addpar("harmonic_mag_type", Phmagtype); - xml->addpar("start", Pstart); + xml.addpar("num_stages", Pnumstages); + xml.addpar("harmonic_mag_type", Phmagtype); + xml.addpar("start", Pstart); - xml->beginbranch("HARMONICS"); + xml.beginbranch("HARMONICS"); for(int i = 0; i < MAX_SUB_HARMONICS; ++i) { - if((Phmag[i] == 0) && (xml->minimal)) + if((Phmag[i] == 0) && (xml.minimal)) continue; - xml->beginbranch("HARMONIC", i); - xml->addpar("mag", Phmag[i]); - xml->addpar("relbw", Phrelbw[i]); - xml->endbranch(); + xml.beginbranch("HARMONIC", i); + xml.addpar("mag", Phmag[i]); + xml.addpar("relbw", Phrelbw[i]); + xml.endbranch(); } - xml->endbranch(); - - xml->beginbranch("AMPLITUDE_PARAMETERS"); - xml->addparbool("stereo", Pstereo); - xml->addpar("volume", PVolume); - xml->addpar("panning", PPanning); - xml->addpar("velocity_sensing", PAmpVelocityScaleFunction); - xml->beginbranch("AMPLITUDE_ENVELOPE"); + xml.endbranch(); + + xml.beginbranch("AMPLITUDE_PARAMETERS"); + xml.addparbool("stereo", Pstereo); + xml.addpar("volume", PVolume); + xml.addpar("panning", PPanning); + xml.addpar("velocity_sensing", PAmpVelocityScaleFunction); + xml.beginbranch("AMPLITUDE_ENVELOPE"); AmpEnvelope->add2XML(xml); - xml->endbranch(); - xml->endbranch(); - - xml->beginbranch("FREQUENCY_PARAMETERS"); - xml->addparbool("fixed_freq", Pfixedfreq); - xml->addpar("fixed_freq_et", PfixedfreqET); - - xml->addpar("detune", PDetune); - xml->addpar("coarse_detune", PCoarseDetune); - xml->addpar("overtone_spread_type", POvertoneSpread.type); - xml->addpar("overtone_spread_par1", POvertoneSpread.par1); - xml->addpar("overtone_spread_par2", POvertoneSpread.par2); - xml->addpar("overtone_spread_par3", POvertoneSpread.par3); - xml->addpar("detune_type", PDetuneType); - - xml->addpar("bandwidth", Pbandwidth); - xml->addpar("bandwidth_scale", Pbwscale); - - xml->addparbool("freq_envelope_enabled", PFreqEnvelopeEnabled); - if((PFreqEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FREQUENCY_ENVELOPE"); + xml.endbranch(); + xml.endbranch(); + + xml.beginbranch("FREQUENCY_PARAMETERS"); + xml.addparbool("fixed_freq", Pfixedfreq); + xml.addpar("fixed_freq_et", PfixedfreqET); + + xml.addpar("detune", PDetune); + xml.addpar("coarse_detune", PCoarseDetune); + xml.addpar("overtone_spread_type", POvertoneSpread.type); + xml.addpar("overtone_spread_par1", POvertoneSpread.par1); + xml.addpar("overtone_spread_par2", POvertoneSpread.par2); + xml.addpar("overtone_spread_par3", POvertoneSpread.par3); + xml.addpar("detune_type", PDetuneType); + + xml.addpar("bandwidth", Pbandwidth); + xml.addpar("bandwidth_scale", Pbwscale); + + xml.addparbool("freq_envelope_enabled", PFreqEnvelopeEnabled); + if((PFreqEnvelopeEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("FREQUENCY_ENVELOPE"); FreqEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->addparbool("band_width_envelope_enabled", PBandWidthEnvelopeEnabled); - if((PBandWidthEnvelopeEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("BANDWIDTH_ENVELOPE"); + xml.addparbool("band_width_envelope_enabled", PBandWidthEnvelopeEnabled); + if((PBandWidthEnvelopeEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("BANDWIDTH_ENVELOPE"); BandWidthEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); - xml->beginbranch("FILTER_PARAMETERS"); - xml->addparbool("enabled", PGlobalFilterEnabled); - if((PGlobalFilterEnabled != 0) || (!xml->minimal)) { - xml->beginbranch("FILTER"); + xml.beginbranch("FILTER_PARAMETERS"); + xml.addparbool("enabled", PGlobalFilterEnabled); + if((PGlobalFilterEnabled != 0) || (!xml.minimal)) { + xml.beginbranch("FILTER"); GlobalFilter->add2XML(xml); - xml->endbranch(); + xml.endbranch(); - xml->addpar("filter_velocity_sensing", + xml.addpar("filter_velocity_sensing", PGlobalFilterVelocityScaleFunction); - xml->addpar("filter_velocity_sensing_amplitude", + xml.addpar("filter_velocity_sensing_amplitude", PGlobalFilterVelocityScale); - xml->beginbranch("FILTER_ENVELOPE"); + xml.beginbranch("FILTER_ENVELOPE"); GlobalFilterEnvelope->add2XML(xml); - xml->endbranch(); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); } @@ -389,94 +389,94 @@ void SUBnoteParameters::paste(SUBnoteParameters &sub) doPaste(Pstart); } -void SUBnoteParameters::getfromXML(XMLwrapper *xml) +void SUBnoteParameters::getfromXML(XMLwrapper& xml) { - Pnumstages = xml->getpar127("num_stages", Pnumstages); - Phmagtype = xml->getpar127("harmonic_mag_type", Phmagtype); - Pstart = xml->getpar127("start", Pstart); + Pnumstages = xml.getpar127("num_stages", Pnumstages); + Phmagtype = xml.getpar127("harmonic_mag_type", Phmagtype); + Pstart = xml.getpar127("start", Pstart); - if(xml->enterbranch("HARMONICS")) { + if(xml.enterbranch("HARMONICS")) { Phmag[0] = 0; for(int i = 0; i < MAX_SUB_HARMONICS; ++i) { - if(xml->enterbranch("HARMONIC", i) == 0) + if(xml.enterbranch("HARMONIC", i) == 0) continue; - Phmag[i] = xml->getpar127("mag", Phmag[i]); - Phrelbw[i] = xml->getpar127("relbw", Phrelbw[i]); - xml->exitbranch(); + Phmag[i] = xml.getpar127("mag", Phmag[i]); + Phrelbw[i] = xml.getpar127("relbw", Phrelbw[i]); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("AMPLITUDE_PARAMETERS")) { - Pstereo = xml->getparbool("stereo", Pstereo); - PVolume = xml->getpar127("volume", PVolume); - PPanning = xml->getpar127("panning", PPanning); - PAmpVelocityScaleFunction = xml->getpar127("velocity_sensing", + if(xml.enterbranch("AMPLITUDE_PARAMETERS")) { + Pstereo = xml.getparbool("stereo", Pstereo); + PVolume = xml.getpar127("volume", PVolume); + PPanning = xml.getpar127("panning", PPanning); + PAmpVelocityScaleFunction = xml.getpar127("velocity_sensing", PAmpVelocityScaleFunction); - if(xml->enterbranch("AMPLITUDE_ENVELOPE")) { + if(xml.enterbranch("AMPLITUDE_ENVELOPE")) { AmpEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("FREQUENCY_PARAMETERS")) { - Pfixedfreq = xml->getparbool("fixed_freq", Pfixedfreq); - PfixedfreqET = xml->getpar127("fixed_freq_et", PfixedfreqET); + if(xml.enterbranch("FREQUENCY_PARAMETERS")) { + Pfixedfreq = xml.getparbool("fixed_freq", Pfixedfreq); + PfixedfreqET = xml.getpar127("fixed_freq_et", PfixedfreqET); - PDetune = xml->getpar("detune", PDetune, 0, 16383); - PCoarseDetune = xml->getpar("coarse_detune", PCoarseDetune, 0, 16383); + PDetune = xml.getpar("detune", PDetune, 0, 16383); + PCoarseDetune = xml.getpar("coarse_detune", PCoarseDetune, 0, 16383); POvertoneSpread.type = - xml->getpar127("overtone_spread_type", POvertoneSpread.type); + xml.getpar127("overtone_spread_type", POvertoneSpread.type); POvertoneSpread.par1 = - xml->getpar("overtone_spread_par1", POvertoneSpread.par1, 0, 255); + xml.getpar("overtone_spread_par1", POvertoneSpread.par1, 0, 255); POvertoneSpread.par2 = - xml->getpar("overtone_spread_par2", POvertoneSpread.par2, 0, 255); + xml.getpar("overtone_spread_par2", POvertoneSpread.par2, 0, 255); POvertoneSpread.par3 = - xml->getpar("overtone_spread_par3", POvertoneSpread.par3, 0, 255); + xml.getpar("overtone_spread_par3", POvertoneSpread.par3, 0, 255); updateFrequencyMultipliers(); - PDetuneType = xml->getpar127("detune_type", PDetuneType); + PDetuneType = xml.getpar127("detune_type", PDetuneType); - Pbandwidth = xml->getpar127("bandwidth", Pbandwidth); - Pbwscale = xml->getpar127("bandwidth_scale", Pbwscale); + Pbandwidth = xml.getpar127("bandwidth", Pbandwidth); + Pbwscale = xml.getpar127("bandwidth_scale", Pbwscale); - PFreqEnvelopeEnabled = xml->getparbool("freq_envelope_enabled", + PFreqEnvelopeEnabled = xml.getparbool("freq_envelope_enabled", PFreqEnvelopeEnabled); - if(xml->enterbranch("FREQUENCY_ENVELOPE")) { + if(xml.enterbranch("FREQUENCY_ENVELOPE")) { FreqEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - PBandWidthEnvelopeEnabled = xml->getparbool( + PBandWidthEnvelopeEnabled = xml.getparbool( "band_width_envelope_enabled", PBandWidthEnvelopeEnabled); - if(xml->enterbranch("BANDWIDTH_ENVELOPE")) { + if(xml.enterbranch("BANDWIDTH_ENVELOPE")) { BandWidthEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } - if(xml->enterbranch("FILTER_PARAMETERS")) { - PGlobalFilterEnabled = xml->getparbool("enabled", PGlobalFilterEnabled); - if(xml->enterbranch("FILTER")) { + if(xml.enterbranch("FILTER_PARAMETERS")) { + PGlobalFilterEnabled = xml.getparbool("enabled", PGlobalFilterEnabled); + if(xml.enterbranch("FILTER")) { GlobalFilter->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - PGlobalFilterVelocityScaleFunction = xml->getpar127( + PGlobalFilterVelocityScaleFunction = xml.getpar127( "filter_velocity_sensing", PGlobalFilterVelocityScaleFunction); - PGlobalFilterVelocityScale = xml->getpar127( + PGlobalFilterVelocityScale = xml.getpar127( "filter_velocity_sensing_amplitude", PGlobalFilterVelocityScale); - if(xml->enterbranch("FILTER_ENVELOPE")) { + if(xml.enterbranch("FILTER_ENVELOPE")) { GlobalFilterEnvelope->getfromXML(xml); - xml->exitbranch(); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } } diff --git a/src/Params/SUBnoteParameters.h b/src/Params/SUBnoteParameters.h @@ -32,9 +32,9 @@ class SUBnoteParameters:public Presets SUBnoteParameters(); ~SUBnoteParameters(); - void add2XML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); void defaults(); - void getfromXML(XMLwrapper *xml); + void getfromXML(XMLwrapper& xml); void updateFrequencyMultipliers(void); void paste(SUBnoteParameters &sub); diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp @@ -1227,161 +1227,161 @@ void OscilGen::paste(OscilGen &o) } #undef COPY -void OscilGen::add2XML(XMLwrapper *xml) +void OscilGen::add2XML(XMLwrapper& xml) { - xml->addpar("harmonic_mag_type", Phmagtype); + xml.addpar("harmonic_mag_type", Phmagtype); - xml->addpar("base_function", Pcurrentbasefunc); - xml->addpar("base_function_par", Pbasefuncpar); - xml->addpar("base_function_modulation", Pbasefuncmodulation); - xml->addpar("base_function_modulation_par1", Pbasefuncmodulationpar1); - xml->addpar("base_function_modulation_par2", Pbasefuncmodulationpar2); - xml->addpar("base_function_modulation_par3", Pbasefuncmodulationpar3); + xml.addpar("base_function", Pcurrentbasefunc); + xml.addpar("base_function_par", Pbasefuncpar); + xml.addpar("base_function_modulation", Pbasefuncmodulation); + xml.addpar("base_function_modulation_par1", Pbasefuncmodulationpar1); + xml.addpar("base_function_modulation_par2", Pbasefuncmodulationpar2); + xml.addpar("base_function_modulation_par3", Pbasefuncmodulationpar3); - xml->addpar("modulation", Pmodulation); - xml->addpar("modulation_par1", Pmodulationpar1); - xml->addpar("modulation_par2", Pmodulationpar2); - xml->addpar("modulation_par3", Pmodulationpar3); + xml.addpar("modulation", Pmodulation); + xml.addpar("modulation_par1", Pmodulationpar1); + xml.addpar("modulation_par2", Pmodulationpar2); + xml.addpar("modulation_par3", Pmodulationpar3); - xml->addpar("wave_shaping", Pwaveshaping); - xml->addpar("wave_shaping_function", Pwaveshapingfunction); + xml.addpar("wave_shaping", Pwaveshaping); + xml.addpar("wave_shaping_function", Pwaveshapingfunction); - xml->addpar("filter_type", Pfiltertype); - xml->addpar("filter_par1", Pfilterpar1); - xml->addpar("filter_par2", Pfilterpar2); - xml->addpar("filter_before_wave_shaping", Pfilterbeforews); + xml.addpar("filter_type", Pfiltertype); + xml.addpar("filter_par1", Pfilterpar1); + xml.addpar("filter_par2", Pfilterpar2); + xml.addpar("filter_before_wave_shaping", Pfilterbeforews); - xml->addpar("spectrum_adjust_type", Psatype); - xml->addpar("spectrum_adjust_par", Psapar); + xml.addpar("spectrum_adjust_type", Psatype); + xml.addpar("spectrum_adjust_par", Psapar); - xml->addpar("rand", Prand); - xml->addpar("amp_rand_type", Pamprandtype); - xml->addpar("amp_rand_power", Pamprandpower); + xml.addpar("rand", Prand); + xml.addpar("amp_rand_type", Pamprandtype); + xml.addpar("amp_rand_power", Pamprandpower); - xml->addpar("harmonic_shift", Pharmonicshift); - xml->addparbool("harmonic_shift_first", Pharmonicshiftfirst); + xml.addpar("harmonic_shift", Pharmonicshift); + xml.addparbool("harmonic_shift_first", Pharmonicshiftfirst); - xml->addpar("adaptive_harmonics", Padaptiveharmonics); - xml->addpar("adaptive_harmonics_base_frequency", Padaptiveharmonicsbasefreq); - xml->addpar("adaptive_harmonics_power", Padaptiveharmonicspower); + xml.addpar("adaptive_harmonics", Padaptiveharmonics); + xml.addpar("adaptive_harmonics_base_frequency", Padaptiveharmonicsbasefreq); + xml.addpar("adaptive_harmonics_power", Padaptiveharmonicspower); - xml->beginbranch("HARMONICS"); + xml.beginbranch("HARMONICS"); for(int n = 0; n < MAX_AD_HARMONICS; ++n) { if((Phmag[n] == 64) && (Phphase[n] == 64)) continue; - xml->beginbranch("HARMONIC", n + 1); - xml->addpar("mag", Phmag[n]); - xml->addpar("phase", Phphase[n]); - xml->endbranch(); + xml.beginbranch("HARMONIC", n + 1); + xml.addpar("mag", Phmag[n]); + xml.addpar("phase", Phphase[n]); + xml.endbranch(); } - xml->endbranch(); + xml.endbranch(); if(Pcurrentbasefunc == 127) { normalize(basefuncFFTfreqs, synth.oscilsize); - xml->beginbranch("BASE_FUNCTION"); + xml.beginbranch("BASE_FUNCTION"); for(int i = 1; i < synth.oscilsize / 2; ++i) { float xc = basefuncFFTfreqs[i].real(); float xs = basefuncFFTfreqs[i].imag(); if((fabs(xs) > 1e-6f) || (fabs(xc) > 1e-6f)) { - xml->beginbranch("BF_HARMONIC", i); - xml->addparreal("cos", xc); - xml->addparreal("sin", xs); - xml->endbranch(); + xml.beginbranch("BF_HARMONIC", i); + xml.addparreal("cos", xc); + xml.addparreal("sin", xs); + xml.endbranch(); } } - xml->endbranch(); + xml.endbranch(); } } -void OscilGen::getfromXML(XMLwrapper *xml) +void OscilGen::getfromXML(XMLwrapper& xml) { - Phmagtype = xml->getpar127("harmonic_mag_type", Phmagtype); + Phmagtype = xml.getpar127("harmonic_mag_type", Phmagtype); - Pcurrentbasefunc = xml->getpar127("base_function", Pcurrentbasefunc); - Pbasefuncpar = xml->getpar127("base_function_par", Pbasefuncpar); + Pcurrentbasefunc = xml.getpar127("base_function", Pcurrentbasefunc); + Pbasefuncpar = xml.getpar127("base_function_par", Pbasefuncpar); - Pbasefuncmodulation = xml->getpar127("base_function_modulation", + Pbasefuncmodulation = xml.getpar127("base_function_modulation", Pbasefuncmodulation); - Pbasefuncmodulationpar1 = xml->getpar127("base_function_modulation_par1", + Pbasefuncmodulationpar1 = xml.getpar127("base_function_modulation_par1", Pbasefuncmodulationpar1); - Pbasefuncmodulationpar2 = xml->getpar127("base_function_modulation_par2", + Pbasefuncmodulationpar2 = xml.getpar127("base_function_modulation_par2", Pbasefuncmodulationpar2); - Pbasefuncmodulationpar3 = xml->getpar127("base_function_modulation_par3", + Pbasefuncmodulationpar3 = xml.getpar127("base_function_modulation_par3", Pbasefuncmodulationpar3); - Pmodulation = xml->getpar127("modulation", Pmodulation); - Pmodulationpar1 = xml->getpar127("modulation_par1", + Pmodulation = xml.getpar127("modulation", Pmodulation); + Pmodulationpar1 = xml.getpar127("modulation_par1", Pmodulationpar1); - Pmodulationpar2 = xml->getpar127("modulation_par2", + Pmodulationpar2 = xml.getpar127("modulation_par2", Pmodulationpar2); - Pmodulationpar3 = xml->getpar127("modulation_par3", + Pmodulationpar3 = xml.getpar127("modulation_par3", Pmodulationpar3); - Pwaveshaping = xml->getpar127("wave_shaping", Pwaveshaping); - Pwaveshapingfunction = xml->getpar127("wave_shaping_function", + Pwaveshaping = xml.getpar127("wave_shaping", Pwaveshaping); + Pwaveshapingfunction = xml.getpar127("wave_shaping_function", Pwaveshapingfunction); - Pfiltertype = xml->getpar127("filter_type", Pfiltertype); - Pfilterpar1 = xml->getpar127("filter_par1", Pfilterpar1); - Pfilterpar2 = xml->getpar127("filter_par2", Pfilterpar2); - Pfilterbeforews = xml->getpar127("filter_before_wave_shaping", + Pfiltertype = xml.getpar127("filter_type", Pfiltertype); + Pfilterpar1 = xml.getpar127("filter_par1", Pfilterpar1); + Pfilterpar2 = xml.getpar127("filter_par2", Pfilterpar2); + Pfilterbeforews = xml.getpar127("filter_before_wave_shaping", Pfilterbeforews); - Psatype = xml->getpar127("spectrum_adjust_type", Psatype); - Psapar = xml->getpar127("spectrum_adjust_par", Psapar); + Psatype = xml.getpar127("spectrum_adjust_type", Psatype); + Psapar = xml.getpar127("spectrum_adjust_par", Psapar); - Prand = xml->getpar127("rand", Prand); - Pamprandtype = xml->getpar127("amp_rand_type", Pamprandtype); - Pamprandpower = xml->getpar127("amp_rand_power", Pamprandpower); + Prand = xml.getpar127("rand", Prand); + Pamprandtype = xml.getpar127("amp_rand_type", Pamprandtype); + Pamprandpower = xml.getpar127("amp_rand_power", Pamprandpower); - Pharmonicshift = xml->getpar("harmonic_shift", + Pharmonicshift = xml.getpar("harmonic_shift", Pharmonicshift, -64, 64); - Pharmonicshiftfirst = xml->getparbool("harmonic_shift_first", + Pharmonicshiftfirst = xml.getparbool("harmonic_shift_first", Pharmonicshiftfirst); - Padaptiveharmonics = xml->getpar("adaptive_harmonics", + Padaptiveharmonics = xml.getpar("adaptive_harmonics", Padaptiveharmonics, 0, 127); - Padaptiveharmonicsbasefreq = xml->getpar( + Padaptiveharmonicsbasefreq = xml.getpar( "adaptive_harmonics_base_frequency", Padaptiveharmonicsbasefreq, 0, 255); - Padaptiveharmonicspower = xml->getpar("adaptive_harmonics_power", + Padaptiveharmonicspower = xml.getpar("adaptive_harmonics_power", Padaptiveharmonicspower, 0, 200); - if(xml->enterbranch("HARMONICS")) { + if(xml.enterbranch("HARMONICS")) { Phmag[0] = 64; Phphase[0] = 64; for(int n = 0; n < MAX_AD_HARMONICS; ++n) { - if(xml->enterbranch("HARMONIC", n + 1) == 0) + if(xml.enterbranch("HARMONIC", n + 1) == 0) continue; - Phmag[n] = xml->getpar127("mag", 64); - Phphase[n] = xml->getpar127("phase", 64); - xml->exitbranch(); + Phmag[n] = xml.getpar127("mag", 64); + Phphase[n] = xml.getpar127("phase", 64); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); } if(Pcurrentbasefunc != 0) changebasefunction(); - if(xml->enterbranch("BASE_FUNCTION")) { + if(xml.enterbranch("BASE_FUNCTION")) { for(int i = 1; i < synth.oscilsize / 2; ++i) - if(xml->enterbranch("BF_HARMONIC", i)) { + if(xml.enterbranch("BF_HARMONIC", i)) { basefuncFFTfreqs[i] = - std::complex<float>(xml->getparreal("cos", 0.0f), - xml->getparreal("sin", 0.0f)); - xml->exitbranch(); + std::complex<float>(xml.getparreal("cos", 0.0f), + xml.getparreal("sin", 0.0f)); + xml.exitbranch(); } - xml->exitbranch(); + xml.exitbranch(); clearDC(basefuncFFTfreqs); normalize(basefuncFFTfreqs, synth.oscilsize); diff --git a/src/Synth/OscilGen.h b/src/Synth/OscilGen.h @@ -52,9 +52,9 @@ class OscilGen:public Presets void useasbase(); void paste(OscilGen &o); - void add2XML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); void defaults(); - void getfromXML(XMLwrapper *xml); + void getfromXML(XMLwrapper& xml); void convert2sine(); diff --git a/src/Synth/Resonance.cpp b/src/Synth/Resonance.cpp @@ -267,39 +267,39 @@ void Resonance::paste(Resonance &r) } #undef COPY -void Resonance::add2XML(XMLwrapper *xml) +void Resonance::add2XML(XMLwrapper& xml) { - xml->addparbool("enabled", Penabled); + xml.addparbool("enabled", Penabled); - if((Penabled == 0) && (xml->minimal)) + if((Penabled == 0) && (xml.minimal)) return; - xml->addpar("max_db", PmaxdB); - xml->addpar("center_freq", Pcenterfreq); - xml->addpar("octaves_freq", Poctavesfreq); - xml->addparbool("protect_fundamental_frequency", Pprotectthefundamental); - xml->addpar("resonance_points", N_RES_POINTS); + xml.addpar("max_db", PmaxdB); + xml.addpar("center_freq", Pcenterfreq); + xml.addpar("octaves_freq", Poctavesfreq); + xml.addparbool("protect_fundamental_frequency", Pprotectthefundamental); + xml.addpar("resonance_points", N_RES_POINTS); for(int i = 0; i < N_RES_POINTS; ++i) { - xml->beginbranch("RESPOINT", i); - xml->addpar("val", Prespoints[i]); - xml->endbranch(); + xml.beginbranch("RESPOINT", i); + xml.addpar("val", Prespoints[i]); + xml.endbranch(); } } -void Resonance::getfromXML(XMLwrapper *xml) +void Resonance::getfromXML(XMLwrapper& xml) { - Penabled = xml->getparbool("enabled", Penabled); + Penabled = xml.getparbool("enabled", Penabled); - PmaxdB = xml->getpar127("max_db", PmaxdB); - Pcenterfreq = xml->getpar127("center_freq", Pcenterfreq); - Poctavesfreq = xml->getpar127("octaves_freq", Poctavesfreq); - Pprotectthefundamental = xml->getparbool("protect_fundamental_frequency", + PmaxdB = xml.getpar127("max_db", PmaxdB); + Pcenterfreq = xml.getpar127("center_freq", Pcenterfreq); + Poctavesfreq = xml.getpar127("octaves_freq", Poctavesfreq); + Pprotectthefundamental = xml.getparbool("protect_fundamental_frequency", Pprotectthefundamental); for(int i = 0; i < N_RES_POINTS; ++i) { - if(xml->enterbranch("RESPOINT", i) == 0) + if(xml.enterbranch("RESPOINT", i) == 0) continue; - Prespoints[i] = xml->getpar127("val", Prespoints[i]); - xml->exitbranch(); + Prespoints[i] = xml.getpar127("val", Prespoints[i]); + xml.exitbranch(); } } diff --git a/src/Synth/Resonance.h b/src/Synth/Resonance.h @@ -43,9 +43,9 @@ class Resonance:public Presets void zero(void); void paste(Resonance &r); - void add2XML(XMLwrapper *xml); + void add2XML(XMLwrapper& xml); void defaults(void); - void getfromXML(XMLwrapper *xml); + void getfromXML(XMLwrapper& xml); //TODO remove unused methods diff --git a/src/Tests/AdNoteTest.h b/src/Tests/AdNoteTest.h @@ -74,17 +74,17 @@ class AdNoteTest:public CxxTest::TestSuite //Assert defaults TS_ASSERT(!defaultPreset->VoicePar[1].Enabled); - XMLwrapper *wrap = new XMLwrapper(); + XMLwrapper wrap; cout << string(SOURCE_DIR) + string("/guitar-adnote.xmz") << endl; - wrap->loadXMLfile(string(SOURCE_DIR) + wrap.loadXMLfile(string(SOURCE_DIR) + string("/guitar-adnote.xmz")); - TS_ASSERT(wrap->enterbranch("MASTER")); - TS_ASSERT(wrap->enterbranch("PART", 0)); - TS_ASSERT(wrap->enterbranch("INSTRUMENT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT_ITEM", 0)); - TS_ASSERT(wrap->enterbranch("ADD_SYNTH_PARAMETERS")); + TS_ASSERT(wrap.enterbranch("MASTER")); + TS_ASSERT(wrap.enterbranch("PART", 0)); + TS_ASSERT(wrap.enterbranch("INSTRUMENT")); + TS_ASSERT(wrap.enterbranch("INSTRUMENT_KIT")); + TS_ASSERT(wrap.enterbranch("INSTRUMENT_KIT_ITEM", 0)); + TS_ASSERT(wrap.enterbranch("ADD_SYNTH_PARAMETERS")); defaultPreset->getfromXML(wrap); //defaultPreset->defaults(); @@ -102,7 +102,6 @@ class AdNoteTest:public CxxTest::TestSuite note = new ADnote(defaultPreset, pars); - delete wrap; } void tearDown() { diff --git a/src/Tests/MemoryStressTest.h b/src/Tests/MemoryStressTest.h @@ -63,14 +63,14 @@ class AdNoteTest:public CxxTest::TestSuite std::string instrument_filename = std::string(SOURCE_DIR) + "/guitar-adnote.xmz"; std::cout << instrument_filename << std::endl; - XMLwrapper *wrap = new XMLwrapper(); - wrap->loadXMLfile(instrument_filename); - TS_ASSERT(wrap->enterbranch("MASTER")); - TS_ASSERT(wrap->enterbranch("PART", 0)); - TS_ASSERT(wrap->enterbranch("INSTRUMENT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT_ITEM", 0)); - TS_ASSERT(wrap->enterbranch("ADD_SYNTH_PARAMETERS")); + XMLwrapper wrap; + wrap.loadXMLfile(instrument_filename); + TS_ASSERT(wrap.enterbranch("MASTER")); + TS_ASSERT(wrap.enterbranch("PART", 0)); + TS_ASSERT(wrap.enterbranch("INSTRUMENT")); + TS_ASSERT(wrap.enterbranch("INSTRUMENT_KIT")); + TS_ASSERT(wrap.enterbranch("INSTRUMENT_KIT_ITEM", 0)); + TS_ASSERT(wrap.enterbranch("ADD_SYNTH_PARAMETERS")); defaultPreset->getfromXML(wrap); //verify xml was loaded @@ -78,7 +78,6 @@ class AdNoteTest:public CxxTest::TestSuite controller = new Controller(*synth); - delete wrap; } void tearDown() { diff --git a/src/Tests/MicrotonalTest.h b/src/Tests/MicrotonalTest.h @@ -82,7 +82,7 @@ class MicrotonalTest:public CxxTest::TestSuite //seems to exist from MICROTONAL being on the //top of the stack xml.beginbranch("MICROTONAL"); - testMicro->add2XML(&xml); + testMicro->add2XML(xml); xml.endbranch(); xml.endbranch(); @@ -97,7 +97,7 @@ class MicrotonalTest:public CxxTest::TestSuite TS_ASSERT(xml.enterbranch("Dummy")); TS_ASSERT(xml.enterbranch("MICROTONAL")); - other.getfromXML(&xml); + other.getfromXML(xml); xml.exitbranch(); xml.exitbranch(); char *tmpo = xml.getXMLdata(); diff --git a/src/Tests/OscilGenTest.h b/src/Tests/OscilGenTest.h @@ -56,19 +56,18 @@ class OscilGenTest:public CxxTest::TestSuite //Assert defaults [TODO] - XMLwrapper *wrap = new XMLwrapper(); - wrap->loadXMLfile(string(SOURCE_DIR) + XMLwrapper wrap; + wrap.loadXMLfile(string(SOURCE_DIR) + string("/guitar-adnote.xmz")); - TS_ASSERT(wrap->enterbranch("MASTER")); - TS_ASSERT(wrap->enterbranch("PART", 0)); - TS_ASSERT(wrap->enterbranch("INSTRUMENT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT_ITEM", 0)); - TS_ASSERT(wrap->enterbranch("ADD_SYNTH_PARAMETERS")); - TS_ASSERT(wrap->enterbranch("VOICE", 0)); - TS_ASSERT(wrap->enterbranch("OSCIL")); + TS_ASSERT(wrap.enterbranch("MASTER")); + TS_ASSERT(wrap.enterbranch("PART", 0)); + TS_ASSERT(wrap.enterbranch("INSTRUMENT")); + TS_ASSERT(wrap.enterbranch("INSTRUMENT_KIT")); + TS_ASSERT(wrap.enterbranch("INSTRUMENT_KIT_ITEM", 0)); + TS_ASSERT(wrap.enterbranch("ADD_SYNTH_PARAMETERS")); + TS_ASSERT(wrap.enterbranch("VOICE", 0)); + TS_ASSERT(wrap.enterbranch("OSCIL")); oscil->getfromXML(wrap); - delete wrap; //verify xml was loaded [TODO] diff --git a/src/Tests/PadNoteTest.h b/src/Tests/PadNoteTest.h @@ -95,7 +95,7 @@ class PadNoteTest:public CxxTest::TestSuite TS_ASSERT(wrap.enterbranch("INSTRUMENT_KIT")); TS_ASSERT(wrap.enterbranch("INSTRUMENT_KIT_ITEM", 0)); TS_ASSERT(wrap.enterbranch("PAD_SYNTH_PARAMETERS")); - pars->getfromXML(&wrap); + pars->getfromXML(wrap); //defaultPreset->defaults(); diff --git a/src/Tests/SubNoteTest.h b/src/Tests/SubNoteTest.h @@ -67,15 +67,15 @@ class SubNoteTest:public CxxTest::TestSuite //prepare the default settings SUBnoteParameters *defaultPreset = new SUBnoteParameters(); - XMLwrapper *wrap = new XMLwrapper(); - wrap->loadXMLfile(string(SOURCE_DIR) + XMLwrapper wrap; + wrap.loadXMLfile(string(SOURCE_DIR) + string("/guitar-adnote.xmz")); - TS_ASSERT(wrap->enterbranch("MASTER")); - TS_ASSERT(wrap->enterbranch("PART", 1)); - TS_ASSERT(wrap->enterbranch("INSTRUMENT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT")); - TS_ASSERT(wrap->enterbranch("INSTRUMENT_KIT_ITEM", 0)); - TS_ASSERT(wrap->enterbranch("SUB_SYNTH_PARAMETERS")); + TS_ASSERT(wrap.enterbranch("MASTER")); + TS_ASSERT(wrap.enterbranch("PART", 1)); + TS_ASSERT(wrap.enterbranch("INSTRUMENT")); + TS_ASSERT(wrap.enterbranch("INSTRUMENT_KIT")); + TS_ASSERT(wrap.enterbranch("INSTRUMENT_KIT_ITEM", 0)); + TS_ASSERT(wrap.enterbranch("SUB_SYNTH_PARAMETERS")); defaultPreset->getfromXML(wrap); controller = new Controller(*synth); @@ -86,7 +86,6 @@ class SubNoteTest:public CxxTest::TestSuite SynthParams pars{memory, *controller, *synth, *time, freq, 120, 0, testnote, false}; note = new SUBnote(defaultPreset, pars); - delete wrap; delete defaultPreset; }