zynaddsubfx

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

commit 8c7e101ca41aec6bdca083e1a0afff6861f9b962
parent 03565744f6ff4bb56deb67c07bb35d043728c07b
Author: paulnasca <paulnasca>
Date:   Tue, 28 Sep 2004 16:05:35 +0000

*** empty log message ***

Diffstat:
MChangeLog | 2++
Msrc/Misc/Master.C | 26++++++++++++++++++++++++++
Msrc/Misc/Master.h | 6++++++
Msrc/Misc/XMLwrapper.C | 1+
Msrc/Misc/XMLwrapper.h | 1+
Msrc/main.C | 12++++++++++++
6 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -715,3 +715,5 @@ 27 Sep 2004 - Corectat un mic bug la salvare in xml la parametrul FMcoarseDetune din adnote - La VST, daca incerc sa inchid fereastra principala, se minimizeaza - Eliminate setarile cu indice '0' (zero) +28 Sep 2004 - Adaugata salvarea tuturor parametrilor in hostul VST + diff --git a/src/Misc/Master.C b/src/Misc/Master.C @@ -597,6 +597,32 @@ void Master::add2XML(XMLwrapper *xml){ }; +int Master::getalldata(char **data){ + XMLwrapper *xml=new XMLwrapper(); + + xml->beginbranch("MASTER"); + add2XML(xml); + xml->endbranch(); + + *data=xml->getXMLdata(); + delete (xml); + return(strlen(*data)+1); +}; + +void Master::putalldata(char *data,int size){ + XMLwrapper *xml=new XMLwrapper(); + if (!xml->putXMLdata(data)) { + delete(xml); + return; + }; + + if (xml->enterbranch("MASTER")==0) return; + getfromXML(xml); + xml->exitbranch(); + + delete(xml); +}; + int Master::saveXML(char *filename){ XMLwrapper *xml=new XMLwrapper(); diff --git a/src/Misc/Master.h b/src/Misc/Master.h @@ -50,6 +50,7 @@ class Master{ void defaults(); + //loads all settings from a XML file //returns 0 for ok or -1 if there is an error int loadXML(char *filename); @@ -57,6 +58,11 @@ class Master{ void getfromXML(XMLwrapper *xml); + //get all data to a newly allocated array (used for VST) + //returns the datasize + int getalldata(char **data); + //put all data from the *data array to zynaddsubfx parameters (used for VST) + void putalldata(char *data,int size); diff --git a/src/Misc/XMLwrapper.C b/src/Misc/XMLwrapper.C @@ -85,6 +85,7 @@ XMLwrapper::XMLwrapper(){ mxmlElementSetAttr(root,"version-major","1"); mxmlElementSetAttr(root,"version-minor","1"); + mxmlElementSetAttr(root,"ZynAddSubFX-author","Nasca Octavian Paul"); //make the empty branch that will contain the information parameters info=addparams0("INFORMATION"); diff --git a/src/Misc/XMLwrapper.h b/src/Misc/XMLwrapper.h @@ -46,6 +46,7 @@ class XMLwrapper{ int saveXMLfile(char *filename); //returns the new allocated string that contains the XML data (used for clipboard) + //the string is NULL terminated char *getXMLdata(); //add simple parameter (name and value) diff --git a/src/main.C b/src/main.C @@ -556,6 +556,8 @@ VSTSynth::VSTSynth (audioMasterCallback audioMaster):AudioEffectX(audioMaster,1, // hasClip(false); isSynth(true); + + programsAreChunks(true); }; @@ -629,5 +631,15 @@ long VSTSynth::processEvents(VstEvents *events){ return(1); }; + +long VSTSynth::getChunk(void** data){ + int size=0; + size=vmaster->getalldata(data); + return(size); +}; + +long VSTSynth::setChunk(void *data,long size){ + vmaster->putalldata(data,size); +}; #endif