commit e09475c83ba671d0802c3a144289d8b897657d56
parent 79af20aaae1c91d3c0441ab71764a1ca2792300c
Author: fundamental <[email protected]>
Date: Tue, 6 Aug 2013 14:42:59 -0400
Add working widget relocation
This makes the transitions between adnote voices nearly unnoticable
Diffstat:
15 files changed, 149 insertions(+), 124 deletions(-)
diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl
@@ -79,7 +79,7 @@ class ADvoicelistitem {open : {public Fl_Osc_Group}
Function {make_window()} {open private
} {
Fl_Window ADnoteVoiceListItem {open
- private xywh {340 881 615 100} type Double box UP_FRAME
+ private xywh {346 881 615 100} type Double box UP_FRAME
class Fl_Osc_Group visible
} {
Fl_Box {} {
@@ -213,9 +213,9 @@ class ADvoiceUI {open : {public Fl_Group}
class Fl_Osc_Group visible
} {
Fl_Box {} {
- label label selected
+ label label
xywh {25 25 35 16}
- code0 {ADnoteVoiceParameters->base = loc;}
+ code0 {ADnoteVoiceParameters->base = base+"voice"+to_s(nvoice)+"/";}
code1 {ADnoteVoiceParameters->osc = osc_i;}
}
Fl_Group voiceparametersgroup {open
@@ -235,7 +235,7 @@ class ADvoiceUI {open : {public Fl_Group}
Fl_Group voiceFMfreqenvgroup {
label {ADSynth Modulator - Frequency Envelope}
xywh {540 300 210 70} box FLAT_BOX color 51 align 144
- code0 {o->init(ENV_ASR, osc_i, loc + "FMFreqEnvelope/");}
+ code0 {o->init(ENV_ASR, osc_i, loc, "FMFreqEnvelope/");}
class EnvelopeUI
} {}
Fl_Check_Button {} {
@@ -302,7 +302,7 @@ o->redraw();}
label {ADSynth Modulator - Amplitude Envelope} open
xywh {540 145 205 70} box FLAT_BOX color 51 align 144
code0 {o->init(//pars->VoicePar[nvoice].FMAmpEnvelope,
- ENV_ADSR, osc_i, loc + "FMAmpEnvelope/");}
+ ENV_ADSR, osc_i, loc, "FMAmpEnvelope/");}
class EnvelopeUI
} {}
Fl_Check_Button {} {
@@ -434,7 +434,7 @@ o->redraw();}
label {ADSynth Voice - Frequency Envelope} open
xywh {10 305 205 70} box FLAT_BOX color 51 align 144
code0 {o->init(//pars->VoicePar[nvoice].FreqEnvelope,
- ENV_ASR, osc_i, loc + "FreqEnvelope/");}
+ ENV_ASR, osc_i, loc, "FreqEnvelope/");}
class EnvelopeUI
} {}
Fl_Check_Button {} {
@@ -449,7 +449,7 @@ o->redraw();}
Fl_Group voicefreqlfogroup {
label {Frequency LFO } open
xywh {220 305 230 70} box FLAT_BOX color 47 align 144
- code0 {o->init(osc_i, loc+"FreqLfo/");}
+ code0 {o->init(osc_i, loc,"FreqLfo/");}
class LFOUI
} {}
Fl_Check_Button {} {
@@ -635,7 +635,7 @@ voiceonbutton->redraw();} open
label {ADSynth Voice - Amplitude Envelope} open
xywh {10 105 205 70} box FLAT_BOX color 51 align 144
code0 {o->init(//pars->VoicePar[nvoice].AmpEnvelope,
- ENV_ADSR, osc_i, loc + "AmpEnvelope/");}
+ ENV_ADSR, osc_i, loc, "AmpEnvelope/");}
class EnvelopeUI
} {}
Fl_Dial {} {
@@ -656,7 +656,7 @@ o->redraw();}
Fl_Group voiceamplfogroup {
label {Amplitude LFO } open
xywh {10 180 230 75} box FLAT_BOX color 47 align 144
- code0 {o->init(osc_i, loc + "AmpLfo/");}
+ code0 {o->init(osc_i, loc, "AmpLfo/");}
class LFOUI
} {}
Fl_Check_Button {} {
@@ -682,14 +682,14 @@ o->redraw();}
Fl_Group {} {
label {ADsynth Voice - Filter} open
xywh {250 30 275 75} box FLAT_BOX color 50 align 144
- code0 {o->init("", osc_i, loc + "VoiceFilter/");}
+ code0 {o->init("", osc_i, loc, "VoiceFilter/");}
class FilterUI
} {}
Fl_Group voicefilterenvgroup {
label {ADSynth Voice - Filter Envelope} open
xywh {250 115 275 70} box FLAT_BOX color 51 align 144
code0 {o->init(//pars->VoicePar[nvoice].FilterEnvelope,
- ENV_ADSR_FILTER, osc_i, loc + "FilterEnvelope/");}
+ ENV_ADSR_FILTER, osc_i, loc, "FilterEnvelope/");}
class EnvelopeUI
} {}
Fl_Check_Button {} {
@@ -704,7 +704,7 @@ o->redraw();}
Fl_Group voicefilterlfogroup {
label {Filter LFO } open
xywh {250 190 230 70} box FLAT_BOX color 47 align 144
- code0 {o->init(osc_i, loc + "FilterLfo/");}
+ code0 {o->init(osc_i, loc, "FilterLfo/");}
class LFOUI
} {}
Fl_Check_Button {} {
@@ -794,7 +794,8 @@ oscedit=NULL;} {}
assert(!loc_.empty());
pars=parameters;
nvoice=nvoice_;
-loc=loc_;
+loc=loc_+"voice"+to_s(nvoice)+"/";
+base = loc_;
osc_i=osc_;
make_window();
end();
@@ -807,6 +808,12 @@ hide();
delete(oscedit);
//delete (ADnoteVoiceParameters);} {}
}
+ Function {change_voice(int nvoice_)} {open
+ } {
+ code {nvoice = nvoice_;
+ADnoteVoiceParameters->rebase(base+"voice"+to_s(nvoice)+"/");} {selected
+ }
+ }
decl {int nvoice;} {private local
}
decl {ADnoteParameters *pars;} {private local
@@ -819,6 +826,8 @@ delete(oscedit);
}
decl {std::string loc;} {private local
}
+ decl {std::string base;} {private local
+ }
decl {Fl_Osc_Interface *osc_i;} {private local
}
}
@@ -829,7 +838,7 @@ class ADnoteUI {open : {public PresetsUI_}
} {
Fl_Window ADnoteGlobalParameters {
label {ADsynth Global Parameters of the Instrument} open
- xywh {682 551 540 430} type Double
+ xywh {688 551 540 430} type Double
class Fl_Osc_Window visible
} {
Fl_Box {} {
@@ -843,7 +852,7 @@ class ADnoteUI {open : {public PresetsUI_}
Fl_Group freqenv {
label {ADSynth Global - Frequency Envelope} open
xywh {10 320 205 70} box FLAT_BOX color 51 align 144
- code0 {o->init(ENV_ASR, osc, loc + "global/FreqEnvelope/");}
+ code0 {o->init(ENV_ASR, osc, loc, "global/FreqEnvelope/");}
class EnvelopeUI
} {}
Fl_Counter octave {
@@ -862,7 +871,7 @@ class ADnoteUI {open : {public PresetsUI_}
Fl_Group freqlfo {
label {Frequency LFO } open
xywh {220 320 230 70} box FLAT_BOX color 47 align 144
- code0 {o->init(osc, loc + "global/FreqLfo/");}
+ code0 {o->init(osc, loc, "global/FreqLfo/");}
class LFOUI
} {}
Fl_Slider detune {
@@ -948,13 +957,13 @@ for (int i=0;i<NUM_VOICES;i++){
Fl_Group ampenv {
label {ADSynth Global - Amplitude Envelope} open
xywh {10 75 205 70} box FLAT_BOX color 51 align 144
- code0 {o->init(ENV_ADSR, osc, loc + "global/AmpEnvelope/");}
+ code0 {o->init(ENV_ADSR, osc, loc, "global/AmpEnvelope/");}
class EnvelopeUI
} {}
Fl_Group amplfo {
label {Amplitude LFO } open
xywh {10 150 230 70} box FLAT_BOX color 47 align 144
- code0 {o->init(osc, loc + "global/AmpLfo/");}
+ code0 {o->init(osc, loc, "global/AmpLfo/");}
class LFOUI
} {}
Fl_Check_Button rndgrp {
@@ -971,20 +980,20 @@ for (int i=0;i<NUM_VOICES;i++){
Fl_Group filterenv {
label {ADSynth Global - Filter Envelope} open
xywh {255 118 275 70} box FLAT_BOX color 51 align 144
- code0 {o->init(ENV_ADSR_FILTER, osc, loc + "global/FilterEnvelope/");}
+ code0 {o->init(ENV_ADSR_FILTER, osc, loc, "global/FilterEnvelope/");}
class EnvelopeUI
} {}
Fl_Group filterlfo {
label {Filter LFO} open
xywh {255 195 230 70} box FLAT_BOX color 47 align 144
- code0 {o->init(osc, loc + "global/FilterLfo/");}
+ code0 {o->init(osc, loc, "global/FilterLfo/");}
class LFOUI
} {}
Fl_Group filterui {
label {ADsynth Global - Filter} open
xywh {255 35 275 75} box FLAT_BOX color 50 align 144
code0 {o->init(loc + "global/PFilter",
- osc, loc + "global/GlobalFilter/");}
+ osc, loc, "global/GlobalFilter/");}
class FilterUI
} {}
}
@@ -1031,7 +1040,7 @@ resui->resonancewindow->show();}
}
Fl_Window ADnoteVoice {
label {ADsynth Voice Parameters} open
- xywh {42 361 765 620} type Double
+ xywh {48 361 765 620} type Double
class Fl_Osc_Window visible
} {
Fl_Box {} {
@@ -1041,7 +1050,7 @@ resui->resonancewindow->show();}
}
Fl_Group advoice {open
xywh {0 0 765 585}
- code0 {o->init(pars,nvoice,loc+"voice"+to_s(nvoice)+"/", osc);/*Here*/}
+ code0 {o->init(pars,nvoice,loc, osc);}
code1 {o->show();}
class ADvoiceUI
} {}
@@ -1053,6 +1062,7 @@ resui->resonancewindow->show();}
Fl_Counter currentvoicecounter {
label {Current Voice}
callback {nvoice=(int)o->value()-1;
+/*
advoice->hide();
ADnoteVoice->remove(advoice);
delete advoice;
@@ -1060,7 +1070,9 @@ advoice=new ADvoiceUI(0,0,765,585);
ADnoteVoice->add(advoice);
advoice->init(pars,nvoice,loc+"voice"+to_s(nvoice)+"/", osc);
advoice->show();
-ADnoteVoice->redraw();}
+ADnoteVoice->redraw();
+*/
+advoice->change_voice(nvoice);}
xywh {10 590 130 25} type Simple labelfont 1 align 8 minimum 0 maximum 2 step 1 value 1 textfont 1 textsize 13
code0 {o->bounds(1,NUM_VOICES);}
}
diff --git a/src/UI/EffUI.fl b/src/UI/EffUI.fl
@@ -1271,7 +1271,7 @@ refresh(eff);}
Fl_Group {} {
label {DynFilter effect - Filter}
xywh {5 5 275 75} box FLAT_BOX color 50 align 144
- code0 {o->init("",osc, loc + "Filter/");}
+ code0 {o->init("",osc, loc, "Filter/");}
code1 {o->use_for_dynamic_filter();}
class FilterUI
} {}
diff --git a/src/UI/EnvelopeUI.fl b/src/UI/EnvelopeUI.fl
@@ -53,9 +53,9 @@ decl {\#include "common.H"} {public local
decl {\#include "EnvelopeFreeEdit.h"} {public local
}
-class EnvelopeUI {open : {public Fl_Group,PresetsUI_}
+class EnvelopeUI {open : {public Fl_Osc_Group,PresetsUI_}
} {
- Function {EnvelopeUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
+ Function {EnvelopeUI(int x,int y, int w, int h, const char *label=0):Fl_Osc_Group(x,y,w,h,label)} {} {
code {
freemodeeditwindow=NULL;
envADSR=NULL;
@@ -81,7 +81,7 @@ delete (freemodeeditwindow);} {}
label C
callback {/*presetsui->copy(env);*/}
xywh {465 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
- code0 {freemodeeditwindow->osc = osc; freemodeeditwindow->base = loc;}
+ code0 {freemodeeditwindow->osc = osc; freemodeeditwindow->base = loc();}
}
Fl_Button {} {
label P
@@ -191,7 +191,6 @@ envfree->redraw();}
label P
callback {/*presetsui->paste(env,this);*/}
xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
- code0 {envADSR->osc = osc; envADSR->base = loc;}
}
Fl_Dial e1adt {
label {A.dt}
@@ -262,7 +261,6 @@ envfree->redraw();}
label C
callback {/*presetsui->copy(env);*/}
xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
- code0 {envASR->osc = osc; envASR->base = loc;}
}
Fl_Button {} {
label P
@@ -337,7 +335,6 @@ envfree->redraw();}
label P
callback {/*presetsui->paste(env,this);*/}
xywh {237 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
- code0 {envADSRfilter->osc = osc; envADSRfilter->base = loc;}
}
Fl_Dial e3aval {
label {A.val}
@@ -417,7 +414,6 @@ envfree->redraw();}
label C
callback {/*presetsui->copy(env);*/}
xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
- code0 {envASRbw->osc = osc; envASRbw->base = loc;}
}
Fl_Button {} {
label P
@@ -488,7 +484,6 @@ envfree->redraw();}
label E
callback {freemodeeditwindow->show();}
xywh {185 5 15 15} labelfont 1 labelsize 10
- code0 {envfree->osc = osc; envfree->base = loc;}
}
Fl_Box freeeditsmall {
label Envelope
@@ -510,11 +505,12 @@ envfree->redraw();}
}
}
}
- Function {init(int env_type, Fl_Osc_Interface *osc_, std::string loc_)} {open selected
+ Function {init(int env_type, Fl_Osc_Interface *osc_, std::string base_, std::string ext_)} {open selected
} {
code {
- osc = osc_;
- loc = loc_;
+ osc = osc_;
+ base = base_;
+ ext = ext_;
Envmode = env_type;
Pfreemode = false;
Penvsustain = false;
@@ -523,7 +519,6 @@ envfree->redraw();}
Pforcedrelease = 0;
Plinearenvelope = 0;
assert(osc);
- assert(!loc.empty());
make_ADSR_window();
make_ASR_window();
make_ADSRfilter_window();
@@ -546,6 +541,15 @@ freeedit->setpair(freeeditsmall);
refresh();} {}
}
+ Function {rebase(std::string new_base)} {open
+ } {
+ code {
+ printf("\\n\\n\\n\\nCAT DOG\\n\\n\\n\\n");
+ printf("\\nNEW BASE: '%s'\\n", (new_base+ext).c_str());
+ Fl_Osc_Group::rebase(new_base);
+ freemodeeditwindow->rebase(new_base+ext);
+ } {}
+ }
Function {reinit()} {open
} {
code {
@@ -670,10 +674,6 @@ envwindow->show();} {}
}
decl {int Plinearenvelope;}{private local
}
- decl {Fl_Osc_Interface *osc;}{private local
- }
- decl {std::string loc;}{private local
- }
decl {Fl_Group *envwindow;} {private local
}
}
diff --git a/src/UI/FilterUI.fl b/src/UI/FilterUI.fl
@@ -65,9 +65,9 @@ decl {\#include "common.H"} {public local
decl {\#include "FormantFilterGraph.H"} {public local
}
-class FilterUI {open : {public Fl_Group,PresetsUI_}
+class FilterUI {open : {public Fl_Osc_Group,PresetsUI_}
} {
- Function {FilterUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
+ Function {FilterUI(int x,int y, int w, int h, const char *label=0):Fl_Osc_Group(x,y,w,h,label)} {} {
code {nvowel=0;nformant=0;nseqpos=0;} {}
}
Function {~FilterUI()} {} {
@@ -87,8 +87,6 @@ delete (formantparswindow);} {}
label P
callback {/*presetsui->paste(pars,this);*/}
xywh {203 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
- code0 {filterui->osc = osc;}
- code1 {filterui->base = loc;}
}
Fl_Group filterparamswindow {
label {Filter Parameters}
@@ -254,7 +252,7 @@ delete (formantparswindow);} {}
callback {/*presetsui->paste(pars,this,nvowel);*/}
xywh {665 25 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
code0 {formantparswindow->osc = osc;}
- code1 {formantparswindow->base = loc;}
+ code1 {formantparswindow->base = loc();}
}
Fl_Group {} {open
xywh {485 47 105 113} box THIN_UP_BOX
@@ -263,7 +261,7 @@ delete (formantparswindow);} {}
Fl_Counter {} {
label {Formant }
callback {nformant=(int) o->value();
- formantparsgroup->rebase(loc+"Pvowels"+to_s(nvowel)+"/Pformants"+to_s(nformant)+"/");
+ formantparsgroup->rebase(loc()+"Pvowels"+to_s(nvowel)+"/Pformants"+to_s(nformant)+"/");
update_formant_window();
formantfiltergraph->redraw();}
xywh {545 80 40 15} type Simple labelfont 1 labelsize 10 align 4 minimum 0 maximum 127 step 1 textsize 10
@@ -273,7 +271,7 @@ formantfiltergraph->redraw();}
Fl_Counter {} {
label {Vowel no.}
callback {nvowel=(int) o->value();
- formantparsgroup->rebase(loc+"Pvowels"+to_s(nvowel)+"/Pformants"+to_s(nformant)+"/");
+ formantparsgroup->rebase(loc()+"Pvowels"+to_s(nvowel)+"/Pformants"+to_s(nformant)+"/");
update_formant_window();
formantfiltergraph->redraw();}
xywh {545 55 40 20} type Simple labelfont 1 labelsize 10 align 4 minimum 0 maximum 127 step 1 textfont 1 textsize 11
@@ -467,10 +465,20 @@ if ((categ==0)||(categ==2)) {
filterparamswindow->redraw();} {}
}
- Function {init(std::string alt_root_, Fl_Osc_Interface *osc_, std::string loc_)} {} {
+ Function {rebase(std::string new_base)} {open
+ } {
+ code {
+ printf("\\n\\n\\n\\nRABBIT HORSE\\n\\n\\n\\n");
+ printf("\\nNEW BASE: '%s'\\n", (new_base+ext).c_str());
+ Fl_Osc_Group::rebase(new_base);
+ formantparswindow->rebase(new_base+ext);
+ } {}
+ }
+ Function {init(std::string alt_root_, Fl_Osc_Interface *osc_, std::string base_, std::string ext_)} {} {
code {alt_root = alt_root_;
-osc = osc_;
-loc = loc_;
+osc = osc_;
+base = base_;
+ext = ext_;
assert(osc);
@@ -512,8 +520,4 @@ strchdial->when(0);} {}
}
decl {int nvowel,nformant,nseqpos;} {private local
}
- decl {Fl_Osc_Interface *osc;} {private local
- }
- decl {std::string loc;} {private local
- }
}
diff --git a/src/UI/Fl_Osc_Check.H b/src/UI/Fl_Osc_Check.H
@@ -23,7 +23,6 @@ class Fl_Osc_Check:public Fl_Check_Button, public Fl_Osc_Widget
void cb(void);
static void _cb(Fl_Widget *w, void *);
private:
- std::string path;
std::pair<Fl_Callback*, void*> cb_data;
char type;
};
diff --git a/src/UI/Fl_Osc_Check.cpp b/src/UI/Fl_Osc_Check.cpp
@@ -26,7 +26,7 @@ void Fl_Osc_Check::OSC_value(bool v)
void Fl_Osc_Check::init(std::string path, char type)
{
- this->path = path;
+ this->ext = path;
this->type = type;
oscRegister(path.c_str());
}
@@ -34,9 +34,9 @@ void Fl_Osc_Check::init(std::string path, char type)
void Fl_Osc_Check::cb(void)
{
if(type == 'T')
- oscWrite(path, value() ? "T" : "F");
+ oscWrite(ext, value() ? "T" : "F");
else
- oscWrite(path, "c", value());
+ oscWrite(ext, "c", value());
if(cb_data.first)
cb_data.first(this, cb_data.second);
diff --git a/src/UI/Fl_Osc_Choice.H b/src/UI/Fl_Osc_Choice.H
@@ -22,7 +22,6 @@ class Fl_Osc_Choice:public Fl_Choice, public Fl_Osc_Widget
void cb(void);
private:
- std::string path;
int min;
std::pair<Fl_Callback*, void*> cb_data;
};
diff --git a/src/UI/Fl_Osc_Choice.cpp b/src/UI/Fl_Osc_Choice.cpp
@@ -33,7 +33,7 @@ Fl_Osc_Choice::Fl_Osc_Choice(int X, int Y, int W, int H, const char *label)
void Fl_Osc_Choice::init(const char *path_, int base)
{
min = base;
- path = path_;
+ ext = path_;
Fl_Osc_Pane *pane = fetch_osc_pane(this);
assert(pane);
assert(pane->osc);
@@ -46,7 +46,6 @@ Fl_Osc_Choice::~Fl_Osc_Choice(void)
void Fl_Osc_Choice::callback(Fl_Callback *cb, void *p)
{
- puts("Fl_Osc_Choice cb");
cb_data.first = cb;
cb_data.second = p;
}
@@ -54,12 +53,14 @@ void Fl_Osc_Choice::callback(Fl_Callback *cb, void *p)
void Fl_Osc_Choice::OSC_value(char v)
{
value(v-min);
+ if(cb_data.first)
+ cb_data.first(this, cb_data.second);
}
void Fl_Osc_Choice::cb(void)
{
assert(osc);
- oscWrite(path, "c", value()+min);
+ oscWrite(ext, "c", value()+min);
if(cb_data.first)
cb_data.first(this, cb_data.second);
}
@@ -67,6 +68,6 @@ void Fl_Osc_Choice::cb(void)
void Fl_Osc_Choice::update(void)
{
assert(osc);
- oscWrite(path);
+ oscWrite(ext);
}
diff --git a/src/UI/Fl_Osc_DialF.H b/src/UI/Fl_Osc_DialF.H
@@ -19,7 +19,5 @@ class Fl_Osc_DialF:public WidgetPDial, Fl_Osc_Widget
void cb(void);
private:
- std::string full_path;
- class Fl_Osc_Interface *osc;
std::pair<Fl_Callback*, void*> cb_data;
};
diff --git a/src/UI/Fl_Osc_DialF.cpp b/src/UI/Fl_Osc_DialF.cpp
@@ -47,15 +47,13 @@ void Fl_Osc_DialF::init(const char *path)
Fl_Osc_Pane *pane = fetch_osc_pane(this);
assert(pane);
osc = pane->osc;
- full_path = pane->base + path;
- osc->createLink(full_path, this);
- osc->requestValue(full_path);
+ ext = path;
+ loc = pane->base;
+ oscRegister(path);
};
Fl_Osc_DialF::~Fl_Osc_DialF(void)
-{
- osc->removeLink(full_path, this);
-}
+{}
void Fl_Osc_DialF::callback(Fl_Callback *cb, void *p)
{
@@ -65,20 +63,19 @@ void Fl_Osc_DialF::callback(Fl_Callback *cb, void *p)
void Fl_Osc_DialF::OSC_value(float v)
{
- printf("Got a value of floating %f\n", v);
value(v);
}
void Fl_Osc_DialF::update(void)
{
- osc->requestValue(full_path);
+ oscWrite(ext);
}
void Fl_Osc_DialF::cb(void)
{
assert(osc);
- osc->writeValue(full_path, (float)value());
+ oscWrite(ext, "f", (float)value());
if(cb_data.first)
cb_data.first(this, cb_data.second);
diff --git a/src/UI/Fl_Osc_Pane.H b/src/UI/Fl_Osc_Pane.H
@@ -20,8 +20,8 @@ class Fl_Osc_Window:public Fl_Double_Window, public Fl_Osc_Pane
Fl_Osc_Window(int w, int h, const char *L=0);
void init(Fl_Osc_Interface *osc_, std::string loc_);
- std::string loc(void) const;
- void rebase(std::string new_base);
+ virtual std::string loc(void) const;
+ virtual void rebase(std::string new_base);
};
@@ -32,8 +32,8 @@ class Fl_Osc_Group:public Fl_Osc_Pane, public Fl_Group
std::string ext;
- std::string loc(void) const;
- void rebase(std::string new_base);
+ virtual std::string loc(void) const;
+ virtual void rebase(std::string new_base);
};
#endif
diff --git a/src/UI/Fl_Osc_Pane.cpp b/src/UI/Fl_Osc_Pane.cpp
@@ -28,8 +28,10 @@ void Fl_Osc_Window::rebase(std::string new_base)
unsigned nchildren = this->children();
for(unsigned i=0; i < nchildren; ++i) {
Fl_Widget *widget = this->child(i);
- if(Fl_Osc_Widget *o = dynamic_cast<Fl_Osc_Widget*>(widget))
+ if(Fl_Osc_Widget *o = dynamic_cast<Fl_Osc_Widget*>(widget)) {
+ printf("Osc_Window rebasing widget...\n");
o->rebase(new_base);
+ }
if(dynamic_cast<Fl_Osc_Group*>(widget))
printf("Fl_Osc_Group\n");
}
@@ -52,7 +54,7 @@ Fl_Osc_Group::Fl_Osc_Group(int x, int y, int w, int h, const char *L)
{
if(auto *p = find_osc_pane(this)) {
osc = p->osc;
- base = p->base;
+ base = p->loc();
assert(osc);
}
};
@@ -63,14 +65,26 @@ std::string Fl_Osc_Group::loc(void) const
return base + ext;
}
-void Fl_Osc_Group::rebase(std::string new_base)
+static void nested_rebase(Fl_Group *g, std::string new_base)
{
- unsigned nchildren = this->children();
+ unsigned nchildren = g->children();
for(unsigned i=0; i < nchildren; ++i) {
- Fl_Widget *widget = this->child(i);
- if(Fl_Osc_Widget *o = dynamic_cast<Fl_Osc_Widget*>(widget))
+ Fl_Widget *widget = g->child(i);
+ if(Fl_Osc_Widget *o = dynamic_cast<Fl_Osc_Widget*>(widget)) {
+ printf("nested_rebase rebasing widget...\n");
o->rebase(new_base);
- if(dynamic_cast<Fl_Osc_Group*>(widget))
+ } else if(Fl_Osc_Group *o = dynamic_cast<Fl_Osc_Group*>(widget)) {
printf("Fl_Osc_Group\n");
+ o->rebase(new_base);
+ } else if(Fl_Group *o = dynamic_cast<Fl_Group*>(widget)) {
+ printf("nested_rebase recur...\n");
+ nested_rebase(o, new_base);
+ }
+
}
}
+
+void Fl_Osc_Group::rebase(std::string new_base)
+{
+ nested_rebase(this, new_base+ext);
+}
diff --git a/src/UI/LFOUI.fl b/src/UI/LFOUI.fl
@@ -41,9 +41,9 @@ decl {\#include "PresetsUI.h"} {public local
decl {\#include "common.H"} {public local
}
-class LFOUI {open : {public Fl_Group, PresetsUI_}
+class LFOUI {open : {public Fl_Osc_Group, PresetsUI_}
} {
- Function {LFOUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {open
+ Function {LFOUI(int x,int y, int w, int h, const char *label=0):Fl_Osc_Group(x,y,w,h,label)} {open
} {
code {} {}
}
@@ -67,7 +67,7 @@ hide();} {}
Fl_Dial freq {
label {Freq.} selected
tooltip {LFO Frequency} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 step 1e-05
- code0 {lfoparamswindow->osc=osc;lfoparamswindow->base=loc;o->init("Pfreq");}
+ code0 {o->init("Pfreq");}
class Fl_Osc_DialF
}
Fl_Dial intensity {
@@ -172,9 +172,10 @@ randomness->update();
freqrand->update();
LFOtype->update();} {}
}
- Function {init(Fl_Osc_Interface *osc_, std::string loc_)} {open
+ Function {init(Fl_Osc_Interface *osc_, std::string base_, std::string ext_)} {open
} {
- code {loc = loc_;
+ code {base = base_;
+ ext = ext_;
osc = osc_;
make_window();
@@ -186,8 +187,4 @@ lfoui->resize(this->x(),this->y(),this->w(),this->h());
lfoparamswindow->label(this->label());} {}
}
- decl {Fl_Osc_Interface *osc;} {private local
- }
- decl {std::string loc;} {private local
- }
}
diff --git a/src/UI/PADnoteUI.fl b/src/UI/PADnoteUI.fl
@@ -79,7 +79,9 @@ location=location_;
oscui=NULL;
osc_i = osc_;
resui=new ResonanceUI(osc_i, location+"resonance/");
-make_window();} {selected
+initialized = false;
+make_window();
+initialized = true;} {selected
}
}
Function {make_window()} {open
@@ -110,7 +112,7 @@ make_window();} {selected
} {
Fl_Dial hpbasepar1 {
label Width
- callback {hpui->update();
+ callback {if(hpui) hpui->update();
cbwidget->do_callback();}
xywh {20 75 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
code2 {o->init("Php.base.par1");}
@@ -118,8 +120,8 @@ cbwidget->do_callback();}
}
Fl_Choice hpbasetype {
label {Base Type}
- callback {hprofile->redraw();
-cbwidget->do_callback();}
+ callback {if(initialized) {hprofile->redraw();
+cbwidget->do_callback();}}
xywh {15 45 75 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
code0 {o->init("Php.base.type");}
class Fl_Osc_Choice
@@ -166,8 +168,8 @@ cbwidget->do_callback();}
} {
Fl_Choice hpamptype {
label AmpMultiplier
- callback {hprofile->redraw();
-cbwidget->do_callback();}
+ callback {if(initialized) {hprofile->redraw();
+cbwidget->do_callback();}}
xywh {15 175 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
code0 {o->init("Php.amp.type");}
class Fl_Osc_Choice
@@ -191,8 +193,8 @@ cbwidget->do_callback();}
}
Fl_Choice hpampmode {
label AmpMode
- callback {hpui->update();
-cbwidget->do_callback();}
+ callback {if(initialized) {hpui->update();
+cbwidget->do_callback();}}
xywh {15 205 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
code0 {o->init("Php.amp.mode");}
class Fl_Osc_Choice
@@ -240,8 +242,8 @@ cbwidget->do_callback();}
class Fl_Osc_Check
}
Fl_Choice hponehalf {
- callback {hprofile->redraw();
-cbwidget->do_callback();}
+ callback {if(initialized) {hprofile->redraw();
+cbwidget->do_callback();}}
xywh {10 143 80 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
code0 {o->init("Php.onehalf");}
class Fl_Osc_Choice
@@ -312,8 +314,8 @@ resui->setcbwidget(cbwidget,applybutton);}
} {
Fl_Choice hrpostype {
label OvertonesPosition
- callback {opui->update();
-cbwidget->do_callback();}
+ callback {if(initialized) {opui->update();
+cbwidget->do_callback();}}
xywh {325 310 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11
code0 {o->init("Phrpos.type");}
class Fl_Osc_Choice
@@ -375,7 +377,7 @@ cbwidget->do_callback();}
}
Fl_Choice bwscale {
label {Bandwidth Scale}
- callback {cbwidget->do_callback();}
+ callback {if(initialized) {cbwidget->do_callback();}}
xywh {120 305 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11
code0 {o->init("Pbwscale");}
class Fl_Osc_Choice
@@ -420,7 +422,7 @@ cbwidget->do_callback();}
} {}
Fl_Choice qsamplesize {
label {Sample Size}
- callback {cbwidget->do_callback();}
+ callback {if(initialized) {cbwidget->do_callback();}}
xywh {375 190 115 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11
code0 {o->init("Pquality.samplesize");}
class Fl_Osc_Choice
@@ -456,7 +458,7 @@ cbwidget->do_callback();}
}
Fl_Choice qsmpoct {
label {smp/oct}
- callback {cbwidget->do_callback();}
+ callback {if(initialized) cbwidget->do_callback();}
xywh {430 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
code0 {o->init("Pquality.smpoct");}
class Fl_Osc_Choice
@@ -492,7 +494,7 @@ cbwidget->do_callback();}
}
Fl_Choice qoct {
label {no.oct}
- callback {cbwidget->do_callback();}
+ callback {if(initialized) cbwidget->do_callback();}
xywh {480 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
code0 {o->init("Pquality.oct");}
class Fl_Osc_Choice
@@ -532,7 +534,7 @@ cbwidget->do_callback();}
}
Fl_Choice qbasenote {
label base
- callback {cbwidget->do_callback();}
+ callback {if(initialized) cbwidget->do_callback();}
xywh {375 155 50 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
code0 {o->init("Pquality.basenote");}
class Fl_Osc_Choice
@@ -633,7 +635,7 @@ cbwidget->do_callback();}
Fl_Group freqenv {
label {PADSynth - Frequency Envelope} open
xywh {10 315 205 70} box FLAT_BOX color 51 align 144
- code0 {o->init(ENV_ASR, osc_i, location + "FreqEnvelope/");}
+ code0 {o->init(ENV_ASR, osc_i, location, "FreqEnvelope/");}
class EnvelopeUI
} {}
Fl_Counter octave {
@@ -652,7 +654,7 @@ cbwidget->do_callback();}
Fl_Group freqlfo {
label {Frequency LFO } open
xywh {215 315 230 70} box FLAT_BOX color 47 align 144
- code0 {o->init(osc_i, location + "FreqLfo/");}
+ code0 {o->init(osc_i, location, "FreqLfo/");}
class LFOUI
} {}
Fl_Slider detune {
@@ -739,13 +741,13 @@ cbwidget->do_callback();}
Fl_Group ampenv {
label {PADSynth - Amplitude Envelope} open
xywh {10 95 205 70} box FLAT_BOX color 51 align 144
- code0 {o->init(ENV_ADSR, osc_i, location + "AmpEnvelope/");}
+ code0 {o->init(ENV_ADSR, osc_i, location, "AmpEnvelope/");}
class EnvelopeUI
} {}
Fl_Group amplfo {
label {Amplitude LFO } open
xywh {10 165 230 70} box FLAT_BOX color 47 align 144
- code0 {o->init(osc_i, location+"AmpLfo/");}
+ code0 {o->init(osc_i, location, "AmpLfo/");}
class LFOUI
} {}
Fl_Check_Button stereo {
@@ -763,20 +765,20 @@ cbwidget->do_callback();}
Fl_Group filterenv {
label {PADSynth - Filter Envelope} open
xywh {250 130 275 70} box FLAT_BOX color 51 align 144
- code0 {o->init(ENV_ADSR_FILTER, osc_i, location + "FilterEnvelope/");}
+ code0 {o->init(ENV_ADSR_FILTER, osc_i, location, "FilterEnvelope/");}
class EnvelopeUI
} {}
Fl_Group filterlfo {
label {Filter LFO } open
xywh {250 200 230 70} box FLAT_BOX color 47 align 144
- code0 {o->init(osc_i, location+"FilterLfo/");}
+ code0 {o->init(osc_i, location, "FilterLfo/");}
class LFOUI
} {}
Fl_Group filterui {
label {PADsynth - Filter} open
xywh {250 55 275 75} box FLAT_BOX color 50 align 144
code0 {o->init(location + "PFilter",
- osc_i, location + "GlobalFilter/");}
+ osc_i, location, "GlobalFilter/");}
class FilterUI
} {}
}
@@ -875,6 +877,8 @@ delete(padnotewindow);} {}
}
decl {OscilEditor *oscui;} {public local
}
+ decl {bool initialized;}{private local
+ }
decl {Fl_Oscilloscope *osc;} {public local
}
decl {ResonanceUI *resui;} {public local
diff --git a/src/UI/SUBnoteUI.fl b/src/UI/SUBnoteUI.fl
@@ -204,7 +204,7 @@ class SUBnoteUI {open : {public PresetsUI_}
Fl_Group ampenv {
label {SUBsynth - Amplitude Envelope} open
xywh {10 65 205 70} box FLAT_BOX color 51 align 144
- code0 {o->init(ENV_ADSR, osc, loc + "AmpEnvelope/");}
+ code0 {o->init(ENV_ADSR, osc, loc, "AmpEnvelope/");}
class EnvelopeUI
} {}
}
@@ -271,7 +271,7 @@ class SUBnoteUI {open : {public PresetsUI_}
Fl_Group freqenvelopegroup {
label {SUBsynth - Frequency Envelope} open
xywh {445 65 205 70} box FLAT_BOX color 51 align 144
- code0 {o->init(ENV_ASR, osc, loc + "FreqEnvelope/");}
+ code0 {o->init(ENV_ASR, osc, loc, "FreqEnvelope/");}
class EnvelopeUI
} {}
Fl_Check_Button freqee {
@@ -358,7 +358,7 @@ SUBparameters->redraw();}
Fl_Group bandwidthenvelopegroup {
label {SUBsynth - BandWidth Envelope} open selected
xywh {225 65 205 70} box FLAT_BOX color 51 align 144
- code0 {o->init(ENV_ADSR_BW, osc, loc + "BandWidthEnvelope/");}
+ code0 {o->init(ENV_ADSR_BW, osc, loc, "BandWidthEnvelope/");}
class EnvelopeUI
} {}
Fl_Check_Button bwee {
@@ -391,13 +391,13 @@ bandwidthsettingsui->redraw();}
Fl_Group filterenv {
label {SUBsynth - Filter Envelope} open
xywh {445 250 275 70} box FLAT_BOX color 51 align 144
- code0 {o->init(ENV_ADSR_FILTER, osc, loc + "GlobalFilterEnvelope/");}
+ code0 {o->init(ENV_ADSR_FILTER, osc, loc, "GlobalFilterEnvelope/");}
class EnvelopeUI
} {}
Fl_Group filterui {
label {SUBsynthl - Filter} open
xywh {445 165 275 75} box FLAT_BOX color 50 align 144
- code0 {o->init(loc + "PGlobalFilter" , osc, loc + "GlobalFilter/");}
+ code0 {o->init(loc + "PGlobalFilter" , osc, loc, "GlobalFilter/");}
class FilterUI
} {}
}