zynaddsubfx

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

commit 84ddf9c0132b6be8d685f01c6444edd8bc49bb0f
parent a5da527fd57e4d73a11a8863e1a998ccad495517
Author: paulnasca <paulnasca>
Date:   Sun, 15 Aug 2004 20:02:15 +0000

*** empty log message ***

Diffstat:
MChangeLog | 4++++
Msrc/Effects/EffectMgr.C | 1+
Msrc/Effects/EffectMgr.h | 3++-
Msrc/Misc/Master.C | 39---------------------------------------
Msrc/Misc/Master.h | 2+-
Msrc/Misc/Part.C | 37-------------------------------------
Msrc/Misc/Part.h | 1-
Msrc/Misc/XMLwrapper.C | 32++++++++++++++++++++++++++++++++
Msrc/Misc/XMLwrapper.h | 6++++++
Msrc/Params/ADnoteParameters.C | 13++-----------
Msrc/Params/ADnoteParameters.h | 4++--
Msrc/Params/FilterParams.C | 3++-
Msrc/Params/FilterParams.h | 3++-
Msrc/Params/Makefile | 2+-
Msrc/Params/PADnoteParameters.C | 5+++--
Msrc/Params/PADnoteParameters.h | 3++-
Msrc/Params/Presets.C | 20+++++++++++++++++++-
Msrc/Params/Presets.h | 5++++-
Asrc/Params/PresetsStore.C | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/Params/PresetsStore.h | 43+++++++++++++++++++++++++++++++++++++++++++
Msrc/Params/SUBnoteParameters.C | 3++-
Msrc/Params/SUBnoteParameters.h | 3++-
Msrc/Synth/Resonance.C | 3++-
Msrc/Synth/Resonance.h | 3++-
Msrc/UI/ADnoteUI.fl | 112+++++++++++++++++++++++++++++++++++++++++++++++++------------------------------
Msrc/UI/BankUI.fl | 10+++++-----
Msrc/UI/EffUI.fl | 12+++++++++---
Msrc/UI/EnvelopeUI.fl | 17+++++++++--------
Msrc/UI/FilterUI.fl | 56+++++++++++++++++++++++++++++++++++++++++++++++++-------
Msrc/UI/LFOUI.fl | 48++++++++++++++++++++++++++----------------------
Msrc/UI/MasterUI.fl | 86++++++++++++++++++++++---------------------------------------------------------
Msrc/UI/OscilGenUI.fl | 13++++++++-----
Msrc/UI/PADnoteUI.fl | 22++++++++++++++++++----
Msrc/UI/PartUI.fl | 80++++++++++++++-----------------------------------------------------------------
Msrc/UI/PresetsUI.fl | 45+++++++++++++++++++++++++++++++++++++--------
Msrc/UI/ResonanceUI.fl | 69+++++++++++++++++++++++++++++++++++++++++++++++++++------------------
Msrc/UI/SUBnoteUI.fl | 23++++++++++++++++++-----
Msrc/main.C | 3++-
38 files changed, 528 insertions(+), 361 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -685,4 +685,8 @@ - Corectata o mica eroare la OscilGen care facea daca adaptive harmonics e activ si phase randomness>0 sa rezulte si aleatorism in amplitudinile armonicelor - Inceput sa scriu Presets/Clipboard - Merge partial partea de Copy in clipboard +15 Aug 2004 - Corectata o eroare in main.c la pitch bend + - Scos Swap/Copy la efecte si la PartUI si vechiul Copy/Paste de la ADnote voice + - Merge clipboardul la Oscil, Resonance, Filter si partial la ADsynth,SUBSynth si PADsynth (am de facut actualizarea la Filter si SUB/PADsynth) + \ No newline at end of file diff --git a/src/Effects/EffectMgr.C b/src/Effects/EffectMgr.C @@ -25,6 +25,7 @@ #include "EffectMgr.h" EffectMgr::EffectMgr(int insertion_,pthread_mutex_t *mutex_){ + setpresettype("Peffect"); efx=NULL; nefx=0; insertion=insertion_; diff --git a/src/Effects/EffectMgr.h b/src/Effects/EffectMgr.h @@ -37,9 +37,10 @@ #include "../Misc/Buffer.h" #include "../Misc/XMLwrapper.h" #include "../Params/FilterParams.h" +#include "../Params/Presets.h" -class EffectMgr{ +class EffectMgr:public Presets{ public: EffectMgr(int insertion_,pthread_mutex_t *mutex_); ~EffectMgr(); diff --git a/src/Misc/Master.C b/src/Misc/Master.C @@ -536,45 +536,6 @@ void Master::vuresetpeaks(){ /* - * Swap 2 effect (effect1<->effect2) - */ -void Master::swapcopyeffects(int what,int type,int neff1,int neff2){ - EffectMgr *eff1,*eff2; - FilterParams tmpfilterparams(0,64,64); - if (neff1==neff2) return;//to swap a effect with itself or copy to itself is meaningless - - if (type==0) { - eff1=sysefx[neff1]; - eff2=sysefx[neff2]; - } else { - eff1=insefx[neff1]; - eff2=insefx[neff2]; - }; - - //get the eff2 parameters (it is needef for swapping) - unsigned char effect=eff2->geteffect(); - unsigned char preset=eff2->getpreset(); - unsigned char par[128]; - for (int i=0;i<128;i++) par[i]=eff2->geteffectpar(i); - if (eff2->filterpars!=NULL) tmpfilterparams.getfromFilterParams(eff2->filterpars); - - //copy the eff1 to eff2 - eff2->changeeffect(eff1->geteffect()); - eff2->changepreset_nolock(eff1->getpreset()); - for (int i=0;i<128;i++) eff2->seteffectpar_nolock(i,eff1->geteffectpar(i)); - if (eff2->filterpars!=NULL) eff2->filterpars->getfromFilterParams(eff1->filterpars); - - if (what==0){//if swapping is needed, copy the saved parameters to eff1 - eff1->changeeffect(effect); - eff1->changepreset_nolock(preset); - for (int i=0;i<128;i++) eff1->seteffectpar_nolock(i,par[i]); - if (eff1->filterpars!=NULL) eff1->filterpars->getfromFilterParams(&tmpfilterparams); - }; -}; - - - -/* * Get the effect volume for the system effect */ void Master::saveloadbuf(Buffer *buf){ diff --git a/src/Misc/Master.h b/src/Misc/Master.h @@ -101,7 +101,7 @@ class Master{ //effects EffectMgr *sysefx[NUM_SYS_EFX];//system EffectMgr *insefx[NUM_INS_EFX];//insertion - void swapcopyeffects(int what,int type,int neff1,int neff2); +// void swapcopyeffects(int what,int type,int neff1,int neff2); //HDD recorder Recorder HDDRecorder; diff --git a/src/Misc/Part.C b/src/Misc/Part.C @@ -628,43 +628,6 @@ void Part::setkititemstatus(int kititem,int Penabled_){ }; -/* - * Swap the item with other or copy the item to another item - */ -void Part::swapcopyitem(int item1, int item2, int mode){ - if (item1==item2) return; - if ((item1>=NUM_KIT_ITEMS) || (item2>=NUM_KIT_ITEMS)) return; - - int e1=kit[item1].Penabled; - int e2=kit[item2].Penabled; - - if ((e1==0) && (e2==0)) return;//both items are disabled - if ((e1==0)&&(mode==0)) {//copy a null item to a existent item - setkititemstatus (item2,0);//delete item 2 - }; - - if (e1==0) setkititemstatus(item1,1); - if (e2==0) setkititemstatus(item2,1); - - Buffer tmpbuf; - if (mode!=0){//swap - tmpbuf.changemode(1); - tmpbuf.changeminimal(0); - saveloadbufkititem(&tmpbuf,item2,1); - }; - - slbuf.changemode(1);//write to buffer - slbuf.changeminimal(0); - saveloadbufkititem(&slbuf,item1,1); - - slbuf.changemode(0);//read from buffer - saveloadbufkititem(&slbuf,item2,1); - - if (mode!=0){//swap - tmpbuf.changemode(0); - saveloadbufkititem(&tmpbuf,item1,1); - }; -}; void Part::saveloadbufkititem(Buffer *buf,unsigned char item,int saveitem0){ diff --git a/src/Misc/Part.h b/src/Misc/Part.h @@ -77,7 +77,6 @@ class Part{ void saveloadbufkititem(Buffer *buf,unsigned char item,int saveitem0); - void swapcopyitem(int item1,int item2,int mode); void cleanup(); diff --git a/src/Misc/XMLwrapper.C b/src/Misc/XMLwrapper.C @@ -123,6 +123,16 @@ int XMLwrapper::saveXMLfile(char *filename){ return(result); }; +char *XMLwrapper::getXMLdata(){ + xml_k=0; + ZERO(tabs,STACKSIZE+2); + char *xmldata=mxmlSaveAllocString(tree,XMLwrapper_whitespace_callback); + + return(xmldata); + +}; + + int XMLwrapper::dosavefile(char *filename,int compression,char *xmldata){ if (compression==0){ FILE *file; @@ -215,6 +225,7 @@ int XMLwrapper::loadXMLfile(const char *filename){ return(0); }; + char *XMLwrapper::doloadfile(const char *filename){ char *xmldata=NULL; int filesize=-1; @@ -256,6 +267,27 @@ char *XMLwrapper::doloadfile(const char *filename){ }; }; +bool XMLwrapper::putXMLdata(char *xmldata){ + if (tree!=NULL) mxmlDelete(tree); + tree=NULL; + + ZERO(&parentstack,(int)sizeof(parentstack)); + ZERO(&values,(int)sizeof(values)); + + stackpos=0; + + if (xmldata==NULL) return (false); + + root=tree=mxmlLoadString(NULL,xmldata,MXML_OPAQUE_CALLBACK); + + if (tree==NULL) return(false); + + node=root=mxmlFindElement(tree,tree,"ZynAddSubFX-data",NULL,NULL,MXML_DESCEND); + if (root==NULL) return (false);; + push(root); + + return(true); +}; diff --git a/src/Misc/XMLwrapper.h b/src/Misc/XMLwrapper.h @@ -44,6 +44,9 @@ class XMLwrapper{ //returns 0 if ok or -1 if the file cannot be saved int saveXMLfile(char *filename); + + //returns the new allocated string that contains the XML data (used for clipboard) + char *getXMLdata(); //add simple parameter (name and value) void addpar(char *name,int val); @@ -70,6 +73,9 @@ class XMLwrapper{ //returns 0 if ok or -1 if the file cannot be loaded int loadXMLfile(const char *filename); + //used by the clipboard + bool putXMLdata(char *xmldata); + //enter into the branch //returns 1 if is ok, or 0 otherwise int enterbranch(char *name); diff --git a/src/Params/ADnoteParameters.C b/src/Params/ADnoteParameters.C @@ -26,7 +26,8 @@ #include "ADnoteParameters.h" -ADnoteParameters::ADnoteParameters(FFTwrapper *fft_){ +ADnoteParameters::ADnoteParameters(FFTwrapper *fft_):Presets(){ + setpresettype("Padsyth"); fft=fft_; GlobalPar.FreqEnvelope=new EnvelopeParams(0,0); @@ -202,16 +203,6 @@ ADnoteParameters::~ADnoteParameters(){ }; }; -void ADnoteParameters::copypastevoice(int n,int what){ - if (what==0){//copy - clipboardbuf.changemode(1);//write to buffer - clipboardbuf.changeminimal(0); - saveloadbufvoice(&clipboardbuf,n); - } else {//paste - clipboardbuf.changemode(0);//read from buffer - saveloadbufvoice(&clipboardbuf,n); - }; -}; /* * Save or load the voice parameters to/from the buffer diff --git a/src/Params/ADnoteParameters.h b/src/Params/ADnoteParameters.h @@ -33,6 +33,7 @@ #include "../Misc/Util.h" #include "../Misc/XMLwrapper.h" #include "../DSP/FFTwrapper.h" +#include "Presets.h" enum FMTYPE{NONE,MORPH,RING_MOD,PHASE_MOD,FREQ_MOD,PITCH_MOD}; @@ -252,7 +253,7 @@ EnvelopeParams *FMAmpEnvelope; }; -class ADnoteParameters/*:public Presets*/{ +class ADnoteParameters:public Presets{ public: ADnoteParameters(FFTwrapper *fft_); ~ADnoteParameters(); @@ -267,7 +268,6 @@ class ADnoteParameters/*:public Presets*/{ void saveloadbuf(Buffer *buf); void saveloadbufvoice(Buffer *buf,unsigned char nvoice); - void copypastevoice(int n,int what); private: void EnableVoice(int nvoice); void KillVoice(int nvoice); diff --git a/src/Params/FilterParams.C b/src/Params/FilterParams.C @@ -25,7 +25,8 @@ #include <stdlib.h> #include "FilterParams.h" -FilterParams::FilterParams(unsigned char Ptype_,unsigned char Pfreq_,unsigned char Pq_){ +FilterParams::FilterParams(unsigned char Ptype_,unsigned char Pfreq_,unsigned char Pq_):Presets(){ + setpresettype("Pfilter"); Dtype=Ptype_; Dfreq=Pfreq_; Dq=Pq_; diff --git a/src/Params/FilterParams.h b/src/Params/FilterParams.h @@ -26,8 +26,9 @@ #include "../globals.h" #include "../Misc/Buffer.h" #include "../Misc/XMLwrapper.h" +#include "Presets.h" -class FilterParams{ +class FilterParams:public Presets{ public: FilterParams(unsigned char Ptype_,unsigned char Pfreq,unsigned char Pq_); ~FilterParams(); diff --git a/src/Params/Makefile b/src/Params/Makefile @@ -1,7 +1,7 @@ include ../Makefile.inc objects=ADnoteParameters.o EnvelopeParams.o FilterParams.o \ - LFOParams.o SUBnoteParameters.o PADnoteParameters.o Controller.o Presets.o + LFOParams.o SUBnoteParameters.o PADnoteParameters.o Controller.o Presets.o PresetsStore.o all: $(objects) diff --git a/src/Params/PADnoteParameters.C b/src/Params/PADnoteParameters.C @@ -22,9 +22,10 @@ #include <math.h> #include "PADnoteParameters.h" -PADnoteParameters::PADnoteParameters(FFTwrapper *fft_,pthread_mutex_t *mutex_){ +PADnoteParameters::PADnoteParameters(FFTwrapper *fft_,pthread_mutex_t *mutex_):Presets(){ + setpresettype("Ppadsyth"); + fft=fft_; - mutex=mutex_; resonance=new Resonance(); diff --git a/src/Params/PADnoteParameters.h b/src/Params/PADnoteParameters.h @@ -33,9 +33,10 @@ #include "EnvelopeParams.h" #include "LFOParams.h" #include "FilterParams.h" +#include "Presets.h" -class PADnoteParameters{ +class PADnoteParameters:public Presets{ public: PADnoteParameters(FFTwrapper *fft_,pthread_mutex_t *mutex_); ~PADnoteParameters(); diff --git a/src/Params/Presets.C b/src/Params/Presets.C @@ -42,11 +42,29 @@ void Presets::copyclipboard(){ add2XML(xml); xml->endbranch(); - xml->saveXMLfile("clipboard"); + presetsstore.copyclipboard(xml,type); delete(xml); }; + void Presets::pasteclipboard(){ + if (!checkclipboardtype()) return; + XMLwrapper *xml=new XMLwrapper(); + if (!presetsstore.pasteclipboard(xml)) { + delete(xml); + return; + }; + + if (xml->enterbranch(type)==0) return; + getfromXML(xml); + xml->exitbranch(); + + delete(xml); + +}; + +bool Presets::checkclipboardtype(){ + return(presetsstore.checkclipboardtype(type)); }; diff --git a/src/Params/Presets.h b/src/Params/Presets.h @@ -24,14 +24,17 @@ #define PRESETS_H #include "../Misc/XMLwrapper.h" -#define MAX_PRESETTYPE_SIZE 20 + +#include "PresetsStore.h" class Presets{ public: Presets(); virtual ~Presets(); + void copyclipboard(); void pasteclipboard(); + bool checkclipboardtype(); char type[MAX_PRESETTYPE_SIZE]; protected: diff --git a/src/Params/PresetsStore.C b/src/Params/PresetsStore.C @@ -0,0 +1,55 @@ +/* + ZynAddSubFX - a software synthesizer + + PresetsStore.C - Presets and Clipboard store + Copyright (C) 2002-2004 Nasca Octavian Paul + Author: Nasca Octavian Paul + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License (version 2) for more details. + + You should have received a copy of the GNU General Public License (version 2) + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ +#include <stdlib.h> +#include <string.h> + +#include "PresetsStore.h" + +PresetsStore presetsstore; + +PresetsStore::PresetsStore(){ + clipboard.data=NULL; + clipboard.type[0]=0;; +}; + +PresetsStore::~PresetsStore(){ + if (clipboard.data!=NULL) delete (clipboard.data); +}; + +void PresetsStore::copyclipboard(XMLwrapper *xml,char *type){ + strcpy(clipboard.type,type); + if (clipboard.data!=NULL) delete (clipboard.data); + clipboard.data=xml->getXMLdata(); +}; + +bool PresetsStore::pasteclipboard(XMLwrapper *xml){ + if (clipboard.data!=NULL) xml->putXMLdata(clipboard.data); + else return(false); + return(true); +}; + +bool PresetsStore::checkclipboardtype(char *type){ + return(strcmp(type,clipboard.type)==0); +}; + + + diff --git a/src/Params/PresetsStore.h b/src/Params/PresetsStore.h @@ -0,0 +1,43 @@ +/* + ZynAddSubFX - a software synthesizer + + PresetsStore.C - Presets and Clipboard store + Copyright (C) 2002-2004 Nasca Octavian Paul + Author: Nasca Octavian Paul + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License (version 2) for more details. + + You should have received a copy of the GNU General Public License (version 2) + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + +#include "../Misc/XMLwrapper.h" +#define MAX_PRESETTYPE_SIZE 30 + +class PresetsStore{ + public: + PresetsStore(); + ~PresetsStore(); + void copyclipboard(XMLwrapper *xml,char *type); + bool pasteclipboard(XMLwrapper *xml); + bool checkclipboardtype(char *type); + + private: + struct { + char *data; + char type[MAX_PRESETTYPE_SIZE]; + } clipboard; + +}; + +extern PresetsStore presetsstore; + diff --git a/src/Params/SUBnoteParameters.C b/src/Params/SUBnoteParameters.C @@ -24,7 +24,8 @@ #include "SUBnoteParameters.h" #include <stdio.h> -SUBnoteParameters::SUBnoteParameters(){ +SUBnoteParameters::SUBnoteParameters():Presets(){ + setpresettype("Psubsyth"); AmpEnvelope=new EnvelopeParams(64,1); AmpEnvelope->ADSRinit_dB(0,40,127,25); FreqEnvelope=new EnvelopeParams(64,0); diff --git a/src/Params/SUBnoteParameters.h b/src/Params/SUBnoteParameters.h @@ -28,8 +28,9 @@ #include "../Misc/XMLwrapper.h" #include "EnvelopeParams.h" #include "FilterParams.h" +#include "Presets.h" -class SUBnoteParameters{ +class SUBnoteParameters:public Presets{ public: SUBnoteParameters(); ~SUBnoteParameters(); diff --git a/src/Synth/Resonance.C b/src/Synth/Resonance.C @@ -26,7 +26,8 @@ #include <stdio.h> -Resonance::Resonance(){ +Resonance::Resonance():Presets(){ + setpresettype("Presonance"); defaults(); }; diff --git a/src/Synth/Resonance.h b/src/Synth/Resonance.h @@ -25,10 +25,11 @@ #include "../globals.h" #include "../Misc/Util.h" #include "../Misc/XMLwrapper.h" +#include "../Params/Presets.h" #define N_RES_POINTS 256 -class Resonance{ +class Resonance:public Presets{ public: Resonance(); ~Resonance(); diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl @@ -47,6 +47,9 @@ decl {\#include "FilterUI.h"} {public decl {\#include "OscilGenUI.h"} {public } +decl {\#include "PresetsUI.h"} {public +} + class ADvoicelistitem {: {public Fl_Group} } { Function {make_window()} {private @@ -737,8 +740,7 @@ hide(); if (oscedit!=NULL) { delete(oscedit); }; -//delete (ADnoteVoiceParameters);} {selected - } +//delete (ADnoteVoiceParameters);} {} } decl {int nvoice;} {} decl {ADnoteParameters *pars;} {} @@ -748,12 +750,13 @@ if (oscedit!=NULL) { decl {Master *master;} {} } -class ADnoteUI {} { - Function {make_window()} {private +class ADnoteUI {open : {public PresetsUI_} +} { + Function {make_window()} {open private } { Fl_Window ADnoteGlobalParameters { label {ADsynth Global Parameters of the Instrument} - xywh {112 194 535 405} type Double hide + xywh {66 187 535 405} type Double hide } { Fl_Group {} { label FREQUENCY @@ -765,36 +768,34 @@ class ADnoteUI {} { code0 {o->init(pars->GlobalPar.FreqEnvelope);} class EnvelopeUI } {} - Fl_Counter {} { + Fl_Counter octave { label Octave callback {int k=(int) o->value(); if (k<0) k+=16; pars->GlobalPar.PCoarseDetune = k*1024+ pars->GlobalPar.PCoarseDetune%1024;} tooltip Octave xywh {470 275 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 12 - code0 {int k=pars->GlobalPar.PCoarseDetune/1024;} - code1 {if (k>=8) k-=16;} + code0 {int k=pars->GlobalPar.PCoarseDetune/1024;if (k>=8) k-=16;} code2 {o->value(k);} } - Fl_Counter {} { + Fl_Counter coarsedet { label {Coarse det.} callback {int k=(int) o->value(); if (k<0) k+=1024; pars->GlobalPar.PCoarseDetune = k+ (pars->GlobalPar.PCoarseDetune/1024)*1024;} tooltip {Coarse Detune} xywh {455 345 60 20} labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 12 - code0 {int k=pars->GlobalPar.PCoarseDetune%1024;} - code1 {if (k>=512) k-=1024;} + code0 {int k=pars->GlobalPar.PCoarseDetune%1024;if (k>=512) k-=1024;} code2 {o->value(k);} code3 {o->lstep(10);} } - Fl_Group {} { - label {Frequency LFO} open + Fl_Group freqlfo { + label {Frequency LFO} open selected xywh {215 295 230 70} box FLAT_BOX color 47 align 144 code0 {o->init(pars->GlobalPar.FreqLfo);} class LFOUI } {} - Fl_Slider {} { + Fl_Slider freq { callback {pars->GlobalPar.PDetune=(int)o->value()+8192; detunevalueoutput->do_callback();} tooltip {Fine Detune (cents)} xywh {60 275 390 15} type {Horz Knob} box FLAT_BOX minimum -8192 maximum 8191 step 1 @@ -806,7 +807,7 @@ detunevalueoutput->do_callback();} xywh {12 275 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10 code0 {o->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune));} } - Fl_Choice {} { + Fl_Choice detunetype { label {Detune Type} callback {pars->GlobalPar.PDetuneType=(int) o->value()+1; detunevalueoutput->do_callback();} open @@ -819,47 +820,47 @@ detunevalueoutput->do_callback();} open label AMPLITUDE xywh {5 5 240 250} box THIN_UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 16 align 17 } { - Fl_Value_Slider {} { + Fl_Value_Slider volume { label Vol callback {pars->GlobalPar.PVolume=(int)o->value();} tooltip Volume xywh {10 30 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1 code0 {o->value(pars->GlobalPar.PVolume);} } - Fl_Value_Slider {} { + Fl_Value_Slider vsns { label {V.Sns} callback {pars->GlobalPar.PAmpVelocityScaleFunction=(int) o->value();} tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 50 160 15} type {Horz Knob} box FLAT_BOX labelsize 12 align 8 maximum 127 step 1 code0 {o->value(pars->GlobalPar.PAmpVelocityScaleFunction);} } - Fl_Dial {} { + Fl_Dial pan { label Pan callback {pars->GlobalPar.PPanning=(int) o->value();} tooltip {Panning (leftmost is Random)} xywh {210 25 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 code0 {o->value(pars->GlobalPar.PPanning);} class WidgetPDial } - Fl_Dial {} { + Fl_Dial pstr { label {P.Str.} callback {pars->GlobalPar.PPunchStrength=(int) o->value();} tooltip {Punch Strength} xywh {125 227 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1 code0 {o->value(pars->GlobalPar.PPunchStrength);} class WidgetPDial } - Fl_Dial {} { + Fl_Dial pt { label {P.t.} callback {pars->GlobalPar.PPunchTime=(int) o->value();} tooltip {Punch Time (duration)} xywh {155 227 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1 code0 {o->value(pars->GlobalPar.PPunchTime);} class WidgetPDial } - Fl_Dial {} { + Fl_Dial pstc { label {P.Stc.} callback {pars->GlobalPar.PPunchStretch=(int) o->value();} tooltip {Punch Stretch} xywh {185 227 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1 code0 {o->value(pars->GlobalPar.PPunchStretch);} class WidgetPDial } - Fl_Dial {} { + Fl_Dial pvel { label {P.Vel.} callback {pars->GlobalPar.PPunchVelocitySensing=(int) o->value();} tooltip {Punch Velocity Sensing} xywh {215 227 25 25} box ROUND_UP_BOX labelsize 11 align 1 maximum 127 step 1 @@ -872,13 +873,13 @@ detunevalueoutput->do_callback();} open code0 {o->init(pars->GlobalPar.AmpEnvelope);} class EnvelopeUI } {} - Fl_Group {} { + Fl_Group amplfo { label {Amplitude LFO} open xywh {10 145 230 70} box FLAT_BOX color 47 align 144 code0 {o->init(pars->GlobalPar.AmpLfo);} class LFOUI } {} - Fl_Check_Button {} { + Fl_Check_Button rndgrp { label {Rnd Grp} callback {pars->GlobalPar.Hrandgrouping=(int) o->value();} tooltip {How the Harmonic Amplitude is applied to voices that use the same oscillator} xywh {70 225 40 25} down_box DOWN_BOX labelsize 10 align 148 @@ -895,7 +896,7 @@ detunevalueoutput->do_callback();} open code0 {o->init(pars->GlobalPar.FilterEnvelope);} class EnvelopeUI } {} - Fl_Group {} { + Fl_Group filterlfo { label {Filter LFO} open xywh {250 180 230 70} box FLAT_BOX color 47 align 144 code0 {o->init(pars->GlobalPar.FilterLfo);} @@ -908,7 +909,7 @@ detunevalueoutput->do_callback();} open class FilterUI } {} } - Fl_Check_Button {} { + Fl_Check_Button stereo { label Stereo callback {pars->GlobalPar.PStereo=(int) o->value();} xywh {5 220 65 35} box ENGRAVED_BOX down_box DOWN_BOX labelfont 1 labelsize 12 @@ -930,7 +931,7 @@ ADnoteVoiceList->show();} Fl_Button {} { label Close callback {ADnoteGlobalParameters->hide();} - xywh {430 375 100 25} box THIN_UP_BOX + xywh {470 375 60 25} box THIN_UP_BOX } Fl_Button {} { label Resonance @@ -938,6 +939,16 @@ ADnoteVoiceList->show();} resui->resonancewindow->show();} tooltip Resonance xywh {309 375 86 25} box THIN_UP_BOX } + Fl_Button {} { + label C + callback {presetsui->copy(pars);} + xywh {405 380 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } + Fl_Button {} { + label P + callback {presetsui->paste(pars,this);} + xywh {435 380 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } } Fl_Window ADnoteVoiceList { label {ADsynth Voices list} @@ -1010,22 +1021,6 @@ ADnoteVoice->redraw();} callback {ADnoteVoice->hide();} xywh {300 530 195 25} box THIN_UP_BOX labelfont 1 } - Fl_Button {} { - label Copy - callback {pthread_mutex_lock(&master->mutex); - pars->copypastevoice(nvoice,0); -pthread_mutex_unlock(&master->mutex);} - tooltip {Copy the voice to clipboard} xywh {655 530 50 20} box THIN_UP_BOX - } - Fl_Button {} { - label Paste - callback {pthread_mutex_lock(&master->mutex); - pars->copypastevoice(nvoice,1); -pthread_mutex_unlock(&master->mutex); - -currentvoicecounter->do_callback();} - tooltip {Paste the voice from the clipboard} xywh {710 530 50 20} box THIN_UP_BOX - } } } Function {ADnoteUI(ADnoteParameters *parameters,Master *master_)} {} { @@ -1044,6 +1039,37 @@ delete(ADnoteGlobalParameters); delete(ADnoteVoice); delete(resui);} {} } + Function {refresh()} {} { + code {volume->value(pars->GlobalPar.PVolume); +vsns->value(pars->GlobalPar.PAmpVelocityScaleFunction); +pan->value(pars->GlobalPar.PPanning); + +stereo->value(pars->GlobalPar.PStereo); +rndgrp->value(pars->GlobalPar.Hrandgrouping); + +pstr->value(pars->GlobalPar.PPunchStrength); +pt->value(pars->GlobalPar.PPunchTime); +pstc->value(pars->GlobalPar.PPunchStretch); +pvel->value(pars->GlobalPar.PPunchVelocitySensing); + +detunevalueoutput->value(getdetune(pars->GlobalPar.PDetuneType,0,pars->GlobalPar.PDetune)); +freq->value(pars->GlobalPar.PDetune-8192); + +int k=pars->GlobalPar.PCoarseDetune/1024;if (k>=8) k-=16; +octave->value(k); + +detunetype->value(pars->GlobalPar.PDetuneType-1); +k=pars->GlobalPar.PCoarseDetune%1024;if (k>=512) k-=1024; +coarsedet->value(k); +amplfo->refresh(); +freqlfo->refresh(); +filterlfo->refresh(); + +for (int i=0;i<NUM_VOICES;i++) voicelistitem[i]->refreshlist(); + +resui->refresh(); +currentvoicecounter->do_callback();} {} + } decl {ADnoteParameters *pars;} {} decl {ResonanceUI *resui;} {} decl {Master *master;} {} diff --git a/src/UI/BankUI.fl b/src/UI/BankUI.fl @@ -83,15 +83,15 @@ label(bank->getnamenumbered(nslot));} {} decl {BankProcess_ *bp;} {} } -class BankUI {open : {public BankProcess_} +class BankUI {: {public BankProcess_} } { - Function {make_window()} {open + Function {make_window()} {selected } { Fl_Window bankuiwindow { - label Bank selected - xywh {4 64 785 575} type Double + label Bank + xywh {4 64 785 575} type Double hide code0 {o->label(bank->bankfiletitle);} - code1 {if (bank->bankfiletitle==NULL) o->label ("Choose a bank from the bank list on the left (or go to settings if to configure the bank location) or choose 'New Bank...' to make a new bank.");} visible + code1 {if (bank->bankfiletitle==NULL) o->label ("Choose a bank from the bank list on the left (or go to settings if to configure the bank location) or choose 'New Bank...' to make a new bank.");} } { Fl_Button {} { label Close diff --git a/src/UI/EffUI.fl b/src/UI/EffUI.fl @@ -33,6 +33,9 @@ decl {\#include "../Misc/Util.h"} {public decl {\#include "../Effects/EffectMgr.h"} {public } +decl {\#include "PresetsUI.h"} {public +} + class EQGraph {: {public Fl_Box} } { Function {EQGraph(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { @@ -152,7 +155,7 @@ return(log(freq/20.0)/log(1000.0));} {} decl {int maxdB;} {} } -class EffUI {: {public Fl_Group} +class EffUI {: {public Fl_Group,public PresetsUI_} } { Function {EffUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { code {eff=NULL; @@ -172,8 +175,7 @@ effdynamicfilterwindow->hide();//delete (effdynamicfilterwindow); if (filterwindow!=NULL){ filterwindow->hide(); delete(filterwindow); -};} {selected - } +};} {} } Function {make_null_window()} {} { Fl_Window effnullwindow { @@ -1410,6 +1412,10 @@ switch(eff->geteffect()){ this->show();} {} } + Function {refresh()} {} { + code {refresh(eff);} {selected + } + } decl {EffectMgr *eff;} {} decl {int eqband;} {} } diff --git a/src/UI/EnvelopeUI.fl b/src/UI/EnvelopeUI.fl @@ -192,18 +192,18 @@ return(1);} {} } } -class EnvelopeUI {: {public Fl_Group} +class EnvelopeUI {open : {public Fl_Group} } { Function {EnvelopeUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { code {env=NULL;} {} } - Function {~EnvelopeUI()} {} { + Function {~EnvelopeUI()} {open + } { code {envwindow->hide(); hide(); freemodeeditwindow->hide(); //delete (envwindow); -delete (freemodeeditwindow);} {selected - } +delete (freemodeeditwindow);} {} } Function {make_freemode_edit_window()} {} { Fl_Window freemodeeditwindow { @@ -320,8 +320,8 @@ envfree->redraw();} } Function {make_ADSR_window()} {} { Fl_Window envADSR { - xywh {440 55 205 70} type Double color 50 labelfont 1 hide - class Fl_Group + xywh {440 55 205 70} type Double color 50 labelfont 1 + class Fl_Group visible } { Fl_Group {} { label {Amplitude Envelope} @@ -527,7 +527,7 @@ freeedit->redraw();} } } Function {make_ASRbw_window()} {} { - Fl_Window envASRbw { + Fl_Window envASRbw {selected xywh {431 279 210 70} type Double hide class Fl_Group } { @@ -656,7 +656,8 @@ if (env->Pfreemode!=0){ freeedit->setpair(freeeditsmall); };} {} } - Function {reinit()} {} { + Function {reinit()} {open + } { code {if (env->Pfreemode!=0){ int answer=fl_ask("Disable the free mode of the Envelope?"); if (env->Pfreemode!=0) freemodebutton->value(1); diff --git a/src/UI/FilterUI.fl b/src/UI/FilterUI.fl @@ -33,6 +33,9 @@ decl {\#include <FL/fl_draw.H>} {public decl {\#include <FL/fl_ask.H>} {public } +decl {\#include "PresetsUI.h"} {public +} + class FormantFilterGraph {: {public Fl_Box} } { Function {FormantFilterGraph(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { @@ -146,7 +149,7 @@ for (i=1;i<lx;i++){ decl {REALTYPE *graphpoints;} {} } -class FilterUI {: {public Fl_Group} +class FilterUI {: {public Fl_Group,PresetsUI_} } { Function {FilterUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} { code {pars=NULL; @@ -159,12 +162,11 @@ nvowel=0;nformant=0;nseqpos=0;} {} formantparswindow->hide(); hide(); //delete (filterui); -delete (formantparswindow);} {selected - } +delete (formantparswindow);} {} } Function {make_window()} {} { Fl_Window filterui { - xywh {268 122 275 75} type Double color 50 labelfont 1 hide + xywh {211 312 275 75} type Double color 50 labelfont 1 hide class Fl_Group } { Fl_Group filterparamswindow { @@ -239,7 +241,7 @@ pars->changed=true;} xywh {164 164 100 20} labelfont 1 labelsize 10 } } - Fl_Choice {} { + Fl_Choice filtertype { label Category callback {switchcategory((int)o->value()); pars->changed=true;} @@ -266,7 +268,7 @@ pars->changed=true;} code0 {o->value(pars->Pfreq);} class WidgetPDial } - Fl_Dial {} { + Fl_Dial qdial { label Q callback {pars->Pq=(int)o->value(); formantfiltergraph->redraw();} @@ -303,7 +305,7 @@ pars->changed=true;} class WidgetPDial } Fl_Choice stcounter { - label Stages + label St callback {pars->Pstages=(int)o->value(); formantfiltergraph->redraw(); pars->changed=true;} open @@ -317,6 +319,16 @@ pars->changed=true;} open callback {formantparswindow->show();} xywh {15 40 50 25} box PLASTIC_UP_BOX labelfont 1 labelsize 12 } + Fl_Button {} { + label C + callback {presetsui->copy(pars);} + xywh {186 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 + } + Fl_Button {} { + label P + callback {presetsui->paste(pars,this);} + xywh {203 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7 + } } } Function {make_formant_window()} {} { @@ -496,6 +508,36 @@ if (nseqpos<pars->Psequencesize) vowel_counter->activate(); vowel_counter->value(pars->Psequence[nseqpos].nvowel);} {} } + Function {refresh()} {} { + code {update_formant_window(); +formantfiltergraph->redraw(); + +if (pars->Pcategory==0) svfiltertypechoice->value(pars->Ptype); +if (pars->Pcategory==2) analogfiltertypechoice->value(pars->Ptype); + +filtertype->value(pars->Pcategory); + +cfreqdial->value(pars->Pfreq); +qdial->value(pars->Pq); + +/* +if (velsnsamp!=NULL) { + velsnsamp=&pars->PFilterVelocityScale; + vsnsadial->value(pars->PFilterVelocityScale); +}; +if (velsns!=NULL) { + velsns=&pars->PFilterVelocityScaleFunction; + vsnsdial->value(*velsns); +}; + +*/ + +freqtrdial->value(pars->Pfreqtrack); +gaindial->value(pars->Pgain); + +stcounter->value(pars->Pstages);} {selected + } + } Function {init(FilterParams *filterpars_,unsigned char *velsnsamp_,unsigned char *velsns_)} {} { code {pars=filterpars_; velsnsamp=velsnsamp_; diff --git a/src/UI/LFOUI.fl b/src/UI/LFOUI.fl @@ -41,58 +41,51 @@ class LFOUI {: {public Fl_Group} Function {~LFOUI()} {} { code {lfoui->hide(); hide(); -//delete (lfoui);} {selected - } +//delete (lfoui);} {} } Function {make_window()} {} { Fl_Window lfoui { - xywh {212 373 230 70} type Double color 50 labelfont 1 hide + xywh {66 328 230 70} type Double color 50 labelfont 1 hide class Fl_Group } { Fl_Group lfoparamswindow { label LFO xywh {0 0 230 70} box PLASTIC_UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 11 align 17 } { - Fl_Dial {} { + Fl_Dial freq { label {Freq.} callback {pars->Pfreq=o->value();} tooltip {LFO Frequency} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 11 step 1e-05 - code0 {o->value(pars->Pfreq);} class WidgetPDial } - Fl_Dial {} { + Fl_Dial intensity { label Depth callback {pars->Pintensity=(int)o->value();} tooltip {LFO Amount} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 - code0 {o->value(pars->Pintensity);} class WidgetPDial } - Fl_Dial {} { + Fl_Dial delay { label Delay callback {pars->Pdelay=(int)o->value();} tooltip {LFO delay} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 - code0 {o->value(pars->Pdelay);} class WidgetPDial } - Fl_Dial {} { + Fl_Dial startphase { label Start callback {pars->Pstartphase=(int)o->value();} tooltip {LFO Startphase (leftmost is Random)} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 11 maximum 127 step 1 - code0 {o->value(pars->Pstartphase);} class WidgetPDial } - Fl_Dial {} { + Fl_Dial randomness { label {A.R.} callback {pars->Prandomness=(int)o->value();} tooltip {LFO Amplitude Randomness} xywh {180 7 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->Prandomness);} class WidgetPDial } - Fl_Choice {} { + Fl_Choice LFOtype { label Type callback {pars->PLFOtype=(int)o->value();} tooltip {LFO function} xywh {180 40 45 15} down_box BORDER_BOX labelsize 10 align 2 textsize 8 - code0 {o->value(pars->PLFOtype);} } { menuitem {} { label SINE @@ -123,38 +116,49 @@ hide(); xywh {70 70 100 20} labelfont 1 labelsize 10 } } - Fl_Check_Button {} { + Fl_Check_Button continous { label {C.} callback {pars->Pcontinous=(int)o->value();} tooltip {Continous LFO} xywh {150 13 25 15} down_box DOWN_BOX labelsize 11 - code0 {o->value(pars->Pcontinous);} } - Fl_Dial {} { + Fl_Dial freqrand { label {F.R.} callback {pars->Pfreqrand=(int)o->value();} tooltip {LFO Frequency Randomness} xywh {205 7 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->Pfreqrand);} class WidgetPDial } - Fl_Dial {} { + Fl_Dial stretch { label {Str.} callback {pars->Pstretch=(int)o->value();} tooltip {LFO stretch} xywh {150 30 20 20} box ROUND_UP_BOX labelsize 10 maximum 127 step 1 - code0 {o->value(pars->Pstretch);} class WidgetPDial } } } } + Function {refresh()} {} { + code {freq->value(pars->Pfreq); +intensity->value(pars->Pintensity); +startphase->value(pars->Pstartphase); +delay->value(pars->Pdelay); +continous->value(pars->Pcontinous); +stretch->value(pars->Pstretch); +randomness->value(pars->Prandomness); +freqrand->value(pars->Pfreqrand); +LFOtype->value(pars->PLFOtype);} {} + } Function {init(LFOParams *lfopars_)} {} { code {pars=lfopars_; make_window(); end(); +refresh(); + lfoui->resize(this->x(),this->y(),this->w(),this->h()); -lfoparamswindow->label(this->label());} {} +lfoparamswindow->label(this->label());} {selected + } } decl {LFOParams *pars;} {} } diff --git a/src/UI/MasterUI.fl b/src/UI/MasterUI.fl @@ -778,7 +778,7 @@ pthread_mutex_unlock(&master->mutex);} xywh {0 80 390 160} } { Fl_Group {} { - label {System Effects} open + label {System Effects} open selected xywh {0 100 390 140} box ENGRAVED_FRAME labeltype EMBOSSED_LABEL labelsize 20 align 25 } { Fl_Counter syseffnocounter { @@ -851,24 +851,22 @@ syseffectui->refresh(master->sysefx[nsyseff]);} xywh {95 120 75 20} box THIN_UP_BOX labelfont 1 labelsize 12 } Fl_Button {} { - label {Swap/Copy...} - callback {swapefftype=0;//system effect -swapwitheffectcounter->do_callback(); -swapeffwindow->show();} - xywh {200 125 70 15} box THIN_UP_BOX labelfont 1 labelsize 10 + label C + callback {presetsui->copy(master->sysefx[nsyseff]);} + xywh {215 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } + Fl_Button {} { + label P + callback {pthread_mutex_lock(&master->mutex); +presetsui->paste(master->sysefx[nsyseff],syseffectui); +pthread_mutex_unlock(&master->mutex);} + xywh {245 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 } } Fl_Group {} { label {Insertion Effects} xywh {0 100 390 140} box ENGRAVED_FRAME labeltype EMBOSSED_LABEL labelsize 20 align 25 hide } { - Fl_Button {} { - label {Swap/Copy...} - callback {swapefftype=1;//insert effect -swapwitheffectcounter->do_callback(); -swapeffwindow->show();} - xywh {200 125 70 15} box THIN_UP_BOX labelfont 1 labelsize 10 - } Fl_Counter inseffnocounter { label {Ins.Effect No.} callback {ninseff=(int) o->value(); @@ -965,6 +963,18 @@ master->insefx[ninseff]->cleanup();} open code1 {char tmp[50]; for (int i=0;i<NUM_MIDI_PARTS;i++) {sprintf(tmp,"Part %2d",i);o->add(tmp);};} code3 {o->value(master->Pinsparts[ninseff]+2);} } {} + Fl_Button {} { + label C + callback {presetsui->copy(master->insefx[ninseff]);} + xywh {215 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } + Fl_Button {} { + label P + callback {pthread_mutex_lock(&master->mutex); +presetsui->paste(master->insefx[ninseff],inseffectui); +pthread_mutex_unlock(&master->mutex);} + xywh {245 124 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } } } Fl_Button {} { @@ -1115,53 +1125,6 @@ GNU General Public License for details.} xywh {5 5 110 35} labelsize 10 align 192 } } - Fl_Window swapeffwindow { - label {Swap/Copy effect} - xywh {581 329 205 100} type Double hide modal - } { - Fl_Counter swapwitheffectcounter { - label {Swap with effect/Copy to:} - callback {if (swapefftype==0) o->maximum(NUM_SYS_EFX-1); - else o->maximum(NUM_INS_EFX-1);} - xywh {65 30 75 20} type Simple labelfont 1 labelsize 12 align 1 minimum 0 maximum 127 step 1 textfont 1 - } - Fl_Button {} { - label Swap - callback {int neff2=(int) swapwitheffectcounter->value(); -int tmp=0; -if (swapefftype==0) { - pthread_mutex_lock(&master->mutex); - master->swapcopyeffects(0,swapefftype,nsyseff,neff2); - pthread_mutex_unlock(&master->mutex); - tmp=nsyseff; - syseffnocounter->value(neff2);syseffnocounter->do_callback(); - syseffnocounter->value(tmp);syseffnocounter->do_callback(); - }else{ - pthread_mutex_lock(&master->mutex); - master->swapcopyeffects(0,swapefftype,ninseff,neff2); - pthread_mutex_unlock(&master->mutex); - tmp=ninseff; - inseffnocounter->value(neff2);inseffnocounter->do_callback(); - inseffnocounter->value(tmp);inseffnocounter->do_callback(); - }; -swapeffwindow->hide();} - xywh {15 60 55 25} box THIN_UP_BOX labelfont 1 - } - Fl_Button {} { - label Cancel - callback {swapeffwindow->hide();} - xywh {140 60 55 25} box THIN_UP_BOX labelfont 1 - } - Fl_Button {} { - label Copy - callback {pthread_mutex_lock(&master->mutex); -if (swapefftype==0) master->swapcopyeffects(1,swapefftype,nsyseff,(int) swapwitheffectcounter->value()); - else master->swapcopyeffects(1,swapefftype,ninseff,(int) swapwitheffectcounter->value()); -pthread_mutex_unlock(&master->mutex); -swapeffwindow->hide();} - xywh {75 60 55 25} box THIN_UP_BOX labelfont 1 - } - } Fl_Window panelwindow { label {ZynAddSubFX Panel} xywh {4 20 630 635} type Double hide @@ -1247,8 +1210,7 @@ delete (bankui); delete (configui); delete (sequi); -delete(presetsui);} {selected - } +delete(presetsui);} {} } decl {Master *master;} {} decl {MicrotonalUI *microtonalui;} {} diff --git a/src/UI/OscilGenUI.fl b/src/UI/OscilGenUI.fl @@ -337,10 +337,9 @@ if (oscil->Phmag[n]==64) mag->selection_color(0); decl {Master *master;} {} } -class OscilEditor {open +class OscilEditor {: {public PresetsUI_} } { - Function {make_window()} {open - } { + Function {make_window()} {} { Fl_Window osceditUI { label {ADsynth Oscillator Editor} xywh {4 91 745 600} type Double hide @@ -992,6 +991,7 @@ refresh();} } Fl_Button {} { label P + callback {presetsui->paste(oscil,this);} selected xywh {710 545 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 } } @@ -1054,9 +1054,12 @@ adhrpow->value(oscil->Padaptiveharmonicspower); for (int i=0;i<MAX_AD_HARMONICS;i++) h[i]->refresh(); +pthread_mutex_lock(&master->mutex); + oscil->prepare(); +pthread_mutex_unlock(&master->mutex); + basefuncdisplaygroup->redraw(); -oscildisplaygroup->redraw(); -oldosc->redraw();} {} +redrawoscil();} {} } Function {redrawoscil()} {} { code {oscildisplaygroup->redraw(); diff --git a/src/UI/PADnoteUI.fl b/src/UI/PADnoteUI.fl @@ -43,6 +43,9 @@ decl {\#include "FilterUI.h"} {public decl {\#include "OscilGenUI.h"} {public } +decl {\#include "PresetsUI.h"} {public +} + class PADnoteHarmonicProfile {: {public Fl_Box} } { Function {PADnoteHarmonicProfile(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { @@ -207,10 +210,11 @@ for (int i=0;i<lx;i++){ } } -class PADnoteUI {} { +class PADnoteUI {: {public PresetsUI_} +} { Function {make_window()} {} { Fl_Window padnotewindow { - label {PAD synth Parameters} + label {PAD synth Parameters} selected xywh {76 165 535 450} type Double hide } { Fl_Tabs {} { @@ -718,7 +722,7 @@ if (pars->Pmode==0){ hprofile->color(48); }; -cbwidget->do_callback();} selected +cbwidget->do_callback();} xywh {220 305 90 20} down_box BORDER_BOX labelfont 1 labelsize 10 labelcolor 0 align 5 textsize 12 code0 {o->value(pars->Pmode);} } { @@ -923,7 +927,17 @@ o->color(FL_GRAY);} Fl_Button {} { label Close callback {padnotewindow->hide();} - xywh {300 405 195 40} box THIN_UP_BOX labelsize 20 + xywh {320 405 175 40} box THIN_UP_BOX labelsize 20 + } + Fl_Button {} { + label C + callback {presetsui->copy(pars);} + xywh {240 430 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } + Fl_Button {} { + label P + callback {presetsui->paste(pars,this);} + xywh {270 430 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 } } } diff --git a/src/UI/PartUI.fl b/src/UI/PartUI.fl @@ -707,6 +707,18 @@ if (x==2) part->partefx[ninseff]->setdryonly(true); tooltip {if the effect is not used (is bypassed)} xywh {90 110 60 15} down_box DOWN_BOX labelsize 12 code0 {int x=part->Pefxbypass[ninseff];o->value(x);} } + Fl_Button {} { + label C + callback {presetsui->copy(part->partefx[ninseff]);} + xywh {90 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } + Fl_Button {} { + label P + callback {pthread_mutex_lock(&master->mutex); +presetsui->paste(part->partefx[ninseff],inseffectui); +pthread_mutex_unlock(&master->mutex);} + xywh {120 127 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } } Fl_Window instrumentkitlist { label {Instrument Kit} @@ -750,12 +762,6 @@ if (x==2) part->partefx[ninseff]->setdryonly(true); label SUBsynth xywh {470 0 60 15} labelfont 1 labelsize 12 align 18 } - Fl_Button swapcopybutton { - label {Swap/Copy...} - callback {swapwindow->show();} - xywh {200 350 75 15} box THIN_UP_BOX labelfont 1 labelsize 10 - code0 {if (part->Pkitmode==0) o->deactivate();} - } Fl_Check_Button protectthekitcheck { label {Protect the kit} callback {part->disablekitloading=(int) o->value();} @@ -768,15 +774,13 @@ if (x==2) part->partefx[ninseff]->setdryonly(true); callback {part->Pkitmode=(int) o->value(); if (part->Pkitmode==0) { kitlist->deactivate(); - swapcopybutton->deactivate(); protectthekitcheck->value(0); protectthekitcheck->do_callback(); protectthekitcheck->deactivate(); } else { kitlist->activate(); - swapcopybutton->activate(); protectthekitcheck->activate(); -};} +};} selected xywh {35 350 70 15} down_box BORDER_BOX labelsize 12 textfont 1 textsize 12 code0 {o->value(part->Pkitmode);} } { @@ -808,67 +812,11 @@ if (part->Pkitmode==0) { xywh {540 0 60 15} labelfont 1 labelsize 12 align 18 } } - Fl_Window swapwindow { - label {Swap/Copy item} - xywh {384 262 205 100} type Double hide modal - } { - Fl_Counter swap2counter { - label to - xywh {110 20 75 20} type Simple labelfont 1 labelsize 12 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1 - code0 {o->maximum(NUM_KIT_ITEMS);} - } - Fl_Button {} { - label Swap - callback {int item1=(int) swap1counter->value(); -int item2=(int) swap2counter->value(); - -pthread_mutex_lock(&master->mutex); - part->swapcopyitem(item1,item2,1); -pthread_mutex_unlock(&master->mutex); - -swapwindow->hide(); -showparameters(0,-1); - -for (int i=0;i<NUM_KIT_ITEMS;i++) partkititem[i]->refresh(); - -adsynenabledcheck->value(part->kit[0].Padenabled); -subsynenabledcheck->value(part->kit[0].Psubenabled);} - xywh {15 60 55 25} box THIN_UP_BOX labelfont 1 - } - Fl_Button {} { - label Copy - callback {int item1=(int) swap1counter->value(); -int item2=(int) swap2counter->value(); - -pthread_mutex_lock(&master->mutex); - part->swapcopyitem(item1,item2,0); -pthread_mutex_unlock(&master->mutex); - -swapwindow->hide(); -showparameters(0,-1); - -for (int i=0;i<NUM_KIT_ITEMS;i++) partkititem[i]->refresh(); - -adsynenabledcheck->value(part->kit[0].Padenabled); -subsynenabledcheck->value(part->kit[0].Psubenabled);} - xywh {75 60 55 25} box THIN_UP_BOX labelfont 1 - } - Fl_Button {} { - label Cancel - callback {swapwindow->hide();} - xywh {140 60 55 25} box THIN_UP_BOX labelfont 1 - } - Fl_Counter swap1counter { - label from - xywh {15 20 75 20} type Simple labelfont 1 labelsize 12 align 1 minimum 0 maximum 127 step 1 textfont 1 - code0 {o->maximum(NUM_KIT_ITEMS);} - } - } Fl_Window instrumenteditwindow { label {Instrument Edit} xywh {182 214 395 360} type Double hide } { - Fl_Group {} {selected + Fl_Group {} { xywh {0 220 395 110} box ENGRAVED_FRAME } { Fl_Group {} { diff --git a/src/UI/PresetsUI.fl b/src/UI/PresetsUI.fl @@ -8,6 +8,14 @@ decl {\#include <stdlib.h>} {public decl {\#include "../Params/Presets.h"} {public } +class PresetsUI_ {open +} { + Function {refresh()} {open return_type {virtual void} + } {} + Function {~PresetsUI_()} {open return_type virtual + } {} +} + class PresetsUI {open } { Function {PresetsUI()} {} { @@ -37,12 +45,12 @@ pastewin->hide();delete(pastewin);} {} label {Copy to Clipboard} callback {p->copyclipboard(); copywin->hide();} - xywh {25 270 90 40} box THIN_UP_BOX align 192 + xywh {25 270 90 35} box THIN_UP_BOX align 192 } Fl_Button {} { label Cancel callback {copywin->hide();} - xywh {160 270 80 40} box THIN_UP_BOX align 192 + xywh {160 270 80 35} box THIN_UP_BOX align 192 } Fl_Box {} { label {Type:} @@ -56,21 +64,24 @@ copywin->hide();} label {Paste from Clipboard/Preset} xywh {516 204 265 315} type Double box PLASTIC_THIN_UP_BOX color 238 hide modal } { - Fl_Browser {} { + Fl_Browser {} {selected xywh {10 30 245 205} type Hold } Fl_Button {} { label {Paste from Preset} xywh {50 240 160 20} box THIN_UP_BOX } - Fl_Button {} { + Fl_Button pastebutton { label {Paste from Clipboard} - xywh {25 270 90 40} box THIN_UP_BOX align 192 + callback {p->pasteclipboard(); +pastewin->hide(); +pui->refresh();} + xywh {25 270 90 35} box THIN_UP_BOX align 192 } Fl_Button {} { label Cancel callback {pastewin->hide();} - xywh {160 270 80 40} box THIN_UP_BOX align 192 + xywh {160 270 80 35} box THIN_UP_BOX align 192 } Fl_Box {} { label {Type:} @@ -84,17 +95,35 @@ copywin->hide();} Function {copy(Presets *p)} {open } { code {this->p=p; +this->pui=NULL; bool but=(Fl::event_button()!=FL_LEFT_MOUSE); if (but) p->copyclipboard(); else { copytypetext->label(&p->type[1]); copywin->show(); - };} {selected - } + };} {} + } + Function {paste(Presets *p,PresetsUI_ *pui)} {open + } { + code {this->p=p; +this->pui=pui; +bool but=(Fl::event_button()!=FL_LEFT_MOUSE); + +if (but) { + p->pasteclipboard(); + pui->refresh(); +} else { + pastetypetext->label(&p->type[1]); + if (p->checkclipboardtype()) pastebutton->activate(); + else pastebutton->deactivate(); + pastewin->show(); + };} {} } decl {Presets *p;} {public } + decl {PresetsUI_ *pui;} {public + } } decl {PresetsUI *presetsui;} {public diff --git a/src/UI/ResonanceUI.fl b/src/UI/ResonanceUI.fl @@ -29,6 +29,9 @@ decl {\#include "../Synth/Resonance.h"} {public decl {\#include "WidgetPDial.h"} {public } +decl {\#include "PresetsUI.h"} {public +} + class ResonanceGraph {: {public Fl_Box} } { Function {ResonanceGraph(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} { @@ -172,20 +175,21 @@ return(1);} {} decl {Fl_Widget *cbwidget;} {} } -class ResonanceUI {} { +class ResonanceUI {: PresetsUI_ +} { Function {make_window()} {} { Fl_Window resonancewindow { - label Resonance selected - xywh {32 300 780 305} type Double hide + label Resonance + xywh {45 259 780 305} type Double hide } { Fl_Value_Output khzvalue { label kHz - xywh {480 264 45 18} align 8 minimum 0.001 maximum 48 step 0.01 textfont 1 + xywh {415 264 45 18} align 8 minimum 0.001 maximum 48 step 0.01 textfont 1 code0 {//this widget must be before the calling widgets} } Fl_Value_Output dbvalue { label dB - xywh {480 282 45 18} align 8 minimum -150 maximum 150 step 0.1 textfont 1 + xywh {415 282 45 18} align 8 minimum -150 maximum 150 step 0.1 textfont 1 code0 {//this widget must be before the calling widgets} } Fl_Group {} { @@ -197,7 +201,7 @@ class ResonanceUI {} { Fl_Button {} { label Close callback {resonancewindow->hide();} - xywh {681 270 93 27} box THIN_UP_BOX + xywh {690 270 84 27} box THIN_UP_BOX } Fl_Button {} { label Zero @@ -205,23 +209,23 @@ class ResonanceUI {} { respar->setpoint(i,64); resonancewindow->redraw(); redrawPADnoteApply();} - tooltip {Clear the resonance function} xywh {556 264 66 15} box THIN_UP_BOX labelfont 1 + tooltip {Clear the resonance function} xywh {491 264 66 15} box THIN_UP_BOX labelfont 1 } Fl_Button {} { label Smooth callback {respar->smooth(); resonancewindow->redraw(); redrawPADnoteApply();} - tooltip {Smooth the resonance function} xywh {556 282 66 18} box THIN_UP_BOX labelfont 1 + tooltip {Smooth the resonance function} xywh {491 282 66 18} box THIN_UP_BOX labelfont 1 } - Fl_Check_Button {} { + Fl_Check_Button enabled { label Enable callback {respar->Penabled=(int) o->value(); redrawPADnoteApply();} xywh {6 270 78 27} box THIN_UP_BOX down_box DOWN_BOX code0 {o->value(respar->Penabled);} } - Fl_Roller {} { + Fl_Roller maxdb { callback {maxdbvo->value(o->value()); respar->PmaxdB=(int) o->value(); redrawPADnoteApply();} @@ -254,27 +258,27 @@ redrawPADnoteApply();} callback {respar->randomize(1); resonancewindow->redraw(); redrawPADnoteApply();} - tooltip {Randomize the resonance function} xywh {631 276 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 + tooltip {Randomize the resonance function} xywh {566 276 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 } Fl_Button {} { label RND1 callback {respar->randomize(0); resonancewindow->redraw(); redrawPADnoteApply();} - tooltip {Randomize the resonance function} xywh {631 264 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 + tooltip {Randomize the resonance function} xywh {566 264 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 } Fl_Button {} { label RND3 callback {respar->randomize(2); resonancewindow->redraw(); redrawPADnoteApply();} - tooltip {Randomize the resonance function} xywh {631 288 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 + tooltip {Randomize the resonance function} xywh {566 288 42 12} box THIN_UP_BOX labelfont 1 labelsize 10 } - Fl_Check_Button {} { + Fl_Check_Button p1st { label {P.1st} callback {respar->Pprotectthefundamental=(int) o->value(); redrawPADnoteApply();} - tooltip {Protect the fundamental frequency (do not damp the first harmonic)} xywh {430 285 45 15} down_box DOWN_BOX labelsize 10 + tooltip {Protect the fundamental frequency (do not damp the first harmonic)} xywh {365 285 45 15} down_box DOWN_BOX labelsize 10 code0 {o->value(respar->Pprotectthefundamental);} } Fl_Button {} { @@ -285,9 +289,9 @@ if (Fl::event_button()==FL_LEFT_MOUSE) type=0; respar->interpolatepeaks(type); resonancewindow->redraw(); redrawPADnoteApply();} - tooltip {Interpolate the peaks} xywh {430 265 46 15} box THIN_UP_BOX labelfont 1 labelsize 10 + tooltip {Interpolate the peaks} xywh {365 265 46 15} box THIN_UP_BOX labelfont 1 labelsize 10 } - Fl_Dial {} { + Fl_Dial centerfreq { label {C.f.} callback {respar->Pcenterfreq=(int)o->value(); centerfreqvo->do_callback(); @@ -297,7 +301,7 @@ redrawPADnoteApply();} code0 {o->value(respar->Pcenterfreq);} class WidgetPDial } - Fl_Dial {} { + Fl_Dial octavesfreq { label {Oct.} callback {respar->Poctavesfreq=(int)o->value(); octavesfreqvo->do_callback(); @@ -307,6 +311,16 @@ redrawPADnoteApply();} code0 {o->value(respar->Poctavesfreq);} class WidgetPDial } + Fl_Button {} { + label C + callback {presetsui->copy(respar);} + xywh {625 275 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } + Fl_Button {} { + label P + callback {presetsui->paste(respar,this);} + xywh {655 275 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } } } Function {ResonanceUI(Resonance *respar_)} {} { @@ -324,6 +338,25 @@ make_window();} {} code {this->cbwidget=cbwidget; rg->setcbwidget(cbwidget);} {} } + Function {refresh()} {} { + code {redrawPADnoteApply(); + +enabled->value(respar->Penabled); + +maxdb->value(respar->PmaxdB); +maxdbvo->value(respar->PmaxdB); + +centerfreqvo->value(respar->getcenterfreq()/1000.0); +octavesfreqvo->value(respar->getoctavesfreq()); + +centerfreq->value(respar->Pcenterfreq); +octavesfreq->value(respar->Poctavesfreq); + +p1st->value(respar->Pprotectthefundamental); + +rg->redraw();} {selected + } + } decl {Resonance *respar;} {public } decl {ResonanceGraph *rg;} {} diff --git a/src/UI/SUBnoteUI.fl b/src/UI/SUBnoteUI.fl @@ -33,6 +33,9 @@ decl {\#include "../Misc/Util.h"} {public decl {\#include "../Params/SUBnoteParameters.h"} {public } +decl {\#include "PresetsUI.h"} {public +} + class SUBnoteharmonic {: {public Fl_Group} } { Function {make_window()} {private @@ -95,10 +98,11 @@ hide(); decl {int n;} {} } -class SUBnoteUI {} { +class SUBnoteUI {: {public PresetsUI_} +} { Function {make_window()} {} { Fl_Window SUBparameters { - label {SUBsynth Parameters} + label {SUBsynth Parameters} selected xywh {4 225 735 390} type Double hide } { Fl_Scroll {} { @@ -112,7 +116,7 @@ class SUBnoteUI {} { Fl_Button {} { label Close callback {SUBparameters->hide();} - xywh {590 365 140 20} box THIN_UP_BOX labelfont 1 labelsize 12 + xywh {625 365 105 20} box THIN_UP_BOX labelfont 1 labelsize 12 } Fl_Group {} { label AMPLITUDE @@ -363,6 +367,16 @@ globalfiltergroup->redraw();} xywh {445 145 85 20} down_box DOWN_BOX labelfont 1 labelsize 12 code0 {o->value(pars->PGlobalFilterEnabled);} } + Fl_Button {} { + label C + callback {presetsui->copy(pars);} + xywh {540 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } + Fl_Button {} { + label P + callback {presetsui->paste(pars,this);} + xywh {570 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 12 labelcolor 7 + } } } Function {SUBnoteUI(SUBnoteParameters *parameters)} {} { @@ -372,8 +386,7 @@ make_window();} {} Function {~SUBnoteUI()} {} { code {//for (int i=0;i<MAX_SUB_HARMONICS;i++) delete (h[i]); SUBparameters->hide(); -delete(SUBparameters);} {selected - } +delete(SUBparameters);} {} } decl {SUBnoteParameters *pars;} {} decl {SUBnoteharmonic *h[MAX_SUB_HARMONICS];} {} diff --git a/src/main.C b/src/main.C @@ -620,7 +620,8 @@ long VSTSynth::processEvents(VstEvents *events){ case 0xB: cntl=Midi->getcontroller(data[1]&0x7f); vmaster->SetController(cmdchan,cntl,data[2]&0x7f); break; - case 0xC: vmaster->SetController(cmdchan,C_pitchwheel,data[1]&0x7f+(data[2]&0x7f)*128); +// case 0xE: vmaster->SetController(cmdchan,C_pitchwheel,data[1]&0x7f+(data[2]&0x7f)*128); + case 0xE: vmaster->SetController(cmdchan,C_pitchwheel,data[1]+data[2]*128); break; }; pthread_mutex_unlock(&vmaster->mutex);