commit a58f3638d0f27db7a18443f621c51600ce7aba33
parent bbe8766b1ae0828f71850fb741dc2442bed5dd2b
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Mon, 5 Aug 2013 09:49:47 -0400
Remove All Backend Pointers from SUBnoteUI
Diffstat:
14 files changed, 330 insertions(+), 170 deletions(-)
diff --git a/src/Params/SUBnoteParameters.cpp b/src/Params/SUBnoteParameters.cpp
@@ -23,6 +23,7 @@
#include "../globals.h"
#include "SUBnoteParameters.h"
#include "EnvelopeParams.h"
+#include "../Misc/Util.h"
#include <stdio.h>
#include <rtosc/ports.h>
@@ -38,7 +39,7 @@ static rtosc::Ports localPorts = {
rParamI(PDetune, "Detune in detune type units"),
rParamI(PCoarseDetune, "Coarse Detune"),
//Real values needed
- //rOption(PDetuneType, rOptions("100 cents", "200 cents", "500 cents")),
+ rOption(PDetuneType, rOptions("100 cents", "200 cents", "500 cents"), "Detune Scale"),
rToggle(PFreqEnvelopeEnabled, "Enable for Frequency Envelope"),
rToggle(PBandWidthEnvelopeEnabled, "Enable for Bandwidth Envelope"),
rToggle(PGlobalFilterEnabled, "Enable for Global Filter"),
@@ -50,6 +51,7 @@ static rtosc::Ports localPorts = {
rParam(PfixedfreqET, "Equal temeperate control for fixed frequency operation"),
rParam(Pnumstages, rMap(min, 1), rMap(max, 5), "Number of filter stages"),
rParam(Pbandwidth, "Bandwidth of filters"),
+ rParam(Phmagtype, "How the magnitudes are computed (0=linear,1=-60dB,2=-60dB)"),
rArray(Phmag, MAX_SUB_HARMONICS, "Harmonic magnitudes"),
rArray(Phrelbw, MAX_SUB_HARMONICS, "Relative bandwidth"),
rParam(Pbwscale, "Bandwidth scaling with frequency"),
@@ -58,7 +60,50 @@ static rtosc::Ports localPorts = {
rRecurp(BandWidthEnvelope, "Bandwidth Envelope"),
rRecurp(GlobalFilterEnvelope, "Post Filter Envelope"),
rRecurp(GlobalFilter, "Post Filter"),
- //rOption(Pstart, rOptions("zero", "random", "ones")),
+ rOption(Pstart, rOptions("zero", "random", "ones"), "How harmonics are initialized"),
+
+ {"clear:", NULL, NULL, [](const char *, RtData &d)
+ {
+ SUBnoteParameters *obj = (SUBnoteParameters *)d.obj;
+ for(int i=0; i<MAX_SUB_HARMONICS; ++i) {
+ obj->Phmag[i] = 0;
+ obj->Phrelbw[i] = 64;
+ }
+ obj->Phmag[0] = 127;
+ }},
+ {"detunevalue:", NULL, NULL, [](const char *, RtData &d)
+ {
+ SUBnoteParameters *obj = (SUBnoteParameters *)d.obj;
+ d.reply(d.loc, "f", getdetune(obj->PDetuneType, 0, obj->PDetune));
+ }},
+ //weird stuff for PCoarseDetune
+ {"octave::c:i", NULL, NULL, [](const char *msg, RtData &d)
+ {
+ SUBnoteParameters *obj = (SUBnoteParameters *)d.obj;
+ if(!rtosc_narguments(msg)) {
+ int k=obj->PCoarseDetune/1024;
+ if (k>=8) k-=16;
+ d.reply(d.loc, "i", k);
+ } else {
+ int k=(int) rtosc_argument(msg, 0).i;
+ if (k<0) k+=16;
+ obj->PCoarseDetune = k*1024 + obj->PCoarseDetune%1024;
+ }
+ }},
+ {"coarsedetune::c:i", NULL, NULL, [](const char *msg, RtData &d)
+ {
+ SUBnoteParameters *obj = (SUBnoteParameters *)d.obj;
+ if(!rtosc_narguments(msg)) {
+ int k=obj->PCoarseDetune%1024;
+ if (k>=512) k-=1024;
+ d.reply(d.loc, "i", k);
+ } else {
+ int k=(int) rtosc_argument(msg, 0).i;
+ if (k<0) k+=1024;
+ obj->PCoarseDetune = k + (obj->PCoarseDetune/1024)*1024;
+ }
+ }},
+
};
rtosc::Ports &SUBnoteParameters::ports = localPorts;
diff --git a/src/UI/CMakeLists.txt b/src/UI/CMakeLists.txt
@@ -38,6 +38,7 @@ add_library(zynaddsubfx_gui STATIC
Fl_Osc_Dial.cpp
Fl_Osc_DialF.cpp
Fl_Osc_Slider.cpp
+ Fl_Osc_VSlider.cpp
Fl_Osc_Button.cpp
Fl_Osc_Check.cpp
Fl_Osc_Choice.cpp
diff --git a/src/UI/Fl_Osc_Check.H b/src/UI/Fl_Osc_Check.H
@@ -17,12 +17,13 @@ class Fl_Osc_Check:public Fl_Check_Button, public Fl_Osc_Widget
virtual void OSC_value(bool);
using Fl_Osc_Widget::OSC_value;
- void init(Fl_Osc_Interface *osc, std::string loc);
- void init(std::string loc);
+ void init(std::string loc, char type = 'T');
void update(void);
+ void callback(Fl_Callback *cb, void *p = NULL);
void cb(void);
static void _cb(Fl_Widget *w, void *);
private:
- class Fl_Osc_Interface *osc;
- std::string full_path;
+ 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
@@ -8,45 +8,43 @@
#include <sstream>
Fl_Osc_Check::Fl_Osc_Check(int X, int Y, int W, int H, const char *label)
- :Fl_Check_Button(X,Y,W,H,label), Fl_Osc_Widget()
+ :Fl_Check_Button(X,Y,W,H,label), Fl_Osc_Widget(this), cb_data(NULL, NULL)
{
- callback(Fl_Osc_Check::_cb);
+ Fl_Check_Button::callback(Fl_Osc_Check::_cb);
}
Fl_Osc_Check::~Fl_Osc_Check(void)
-{
- osc->removeLink(full_path, this);
-}
+{}
void Fl_Osc_Check::OSC_value(bool v)
{
Fl_Check_Button::value(v);
}
-void Fl_Osc_Check::init(std::string path)
+void Fl_Osc_Check::init(std::string path, char type)
{
- Fl_Osc_Pane *pane = fetch_osc_pane(this);
- assert(pane);
- osc = pane->osc;
- init(osc,path);
-}
-
-void Fl_Osc_Check::init(Fl_Osc_Interface *osc, std::string path)
-{
- Fl_Osc_Pane *pane = fetch_osc_pane(this);
- full_path = pane->pane_name + path;
- osc->createLink(full_path, this);
- osc->requestValue(full_path);
+ this->path = path;
+ this->type = type;
+ oscRegister(path.c_str());
}
void Fl_Osc_Check::cb(void)
{
- osc->writeValue(full_path, (bool) value());
+ if(type == 'T')
+ oscWrite(path, value() ? "T" : "F");
+ else
+ oscWrite(path, "c", value());
}
void Fl_Osc_Check::update(void)
{}
+void Fl_Osc_Check::callback(Fl_Callback *cb, void *p)
+{
+ cb_data.first = cb;
+ cb_data.second = p;
+}
+
void Fl_Osc_Check::_cb(Fl_Widget *w, void *)
{
static_cast<Fl_Osc_Check*>(w)->cb();
diff --git a/src/UI/Fl_Osc_Choice.H b/src/UI/Fl_Osc_Choice.H
@@ -3,13 +3,14 @@
#include "Fl_Osc_Widget.H"
#include <string>
-class Fl_Osc_Choice:public Fl_Choice, Fl_Osc_Widget
+class Fl_Osc_Choice:public Fl_Choice, public Fl_Osc_Widget
{
public:
Fl_Osc_Choice(int X, int Y, int W, int H, const char *label = NULL);
virtual ~Fl_Osc_Choice(void);
- void init(const char *path);
+ //Base is for braindead choices that don't actually start at zero
+ void init(const char *path, int base =0);
//void OSC_value(float);
@@ -22,5 +23,6 @@ class Fl_Osc_Choice:public Fl_Choice, 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
@@ -26,11 +26,13 @@ static void callback_fn(Fl_Widget *w, void *v)
Fl_Osc_Choice::Fl_Osc_Choice(int X, int Y, int W, int H, const char *label)
:Fl_Choice(X,Y,W,H, label), Fl_Osc_Widget(this), cb_data(NULL, NULL)
{
+ min = 0;
Fl_Choice::callback(callback_fn, NULL);
}
-void Fl_Osc_Choice::init(const char *path_)
+void Fl_Osc_Choice::init(const char *path_, int base)
{
+ min = base;
path = path_;
Fl_Osc_Pane *pane = fetch_osc_pane(this);
assert(pane);
@@ -51,13 +53,13 @@ void Fl_Osc_Choice::callback(Fl_Callback *cb, void *p)
void Fl_Osc_Choice::OSC_value(char v)
{
- value(v);
+ value(v-min);
}
void Fl_Osc_Choice::cb(void)
{
assert(osc);
- oscWrite(path, "c", value());
+ oscWrite(path, "c", value()+min);
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
@@ -27,13 +27,25 @@ class Fl_Osc_Window:public Fl_Osc_Pane, public Fl_Double_Window
}
};
+static Fl_Osc_Pane *find_osc_pane(Fl_Widget *root)
+{
+ if(!root)
+ return NULL;
+ Fl_Group *next = root->parent();
+
+ if(auto *p = dynamic_cast<Fl_Osc_Pane*>(next))
+ return p;
+ else
+ return find_osc_pane(next);
+}
+
class Fl_Osc_Group:public Fl_Osc_Pane, public Fl_Group
{
public:
Fl_Osc_Group(int x, int y, int w, int h, const char *L=0)
:Fl_Group(x,y,w,h,L)
{
- if(auto *p = dynamic_cast<Fl_Osc_Pane*>(parent())) {
+ if(auto *p = find_osc_pane(this)) {
osc = p->osc;
pane_name = p->pane_name;
}
diff --git a/src/UI/Fl_Osc_Slider.H b/src/UI/Fl_Osc_Slider.H
@@ -5,7 +5,7 @@
using std::string; //yes this is bad form FIXME
-class Fl_Osc_Slider:public Fl_Slider, Fl_Osc_Widget
+class Fl_Osc_Slider:public Fl_Slider, public Fl_Osc_Widget
{
public:
diff --git a/src/UI/Fl_Osc_Slider.cpp b/src/UI/Fl_Osc_Slider.cpp
@@ -26,16 +26,18 @@ Fl_Osc_Slider::~Fl_Osc_Slider(void)
void Fl_Osc_Slider::OSC_value(float v)
{
- Fl_Slider::value(v);
+ Fl_Slider::value(v+minimum());
}
void Fl_Osc_Slider::cb(void)
{
const float val = Fl_Slider::value();
if(osc_type == 'f')
- oscWrite(path, "f", val);
+ oscWrite(path, "f", val-minimum());
+ else if(osc_type == 'i')
+ oscWrite(path, "i", (int)(val-minimum()));
else
- oscWrite(path, "c", (char) val);
+ oscWrite(path, "c", (char)(val-minimum()));
//OSC_value(val);
if(cb_data.first)
diff --git a/src/UI/Fl_Osc_VSlider.H b/src/UI/Fl_Osc_VSlider.H
@@ -0,0 +1,32 @@
+#pragma once
+#include <FL/Fl_Value_Slider.H>
+#include "Fl_Osc_Widget.H"
+#include <string>
+
+using std::string; //yes this is bad form FIXME
+
+class Fl_Osc_VSlider:public Fl_Value_Slider, Fl_Osc_Widget
+{
+
+ public:
+ Fl_Osc_VSlider(int X, int Y, int W, int H, const char *label = NULL);
+
+ virtual ~Fl_Osc_VSlider(void);
+ void OSC_value(char);
+ void OSC_value(float);
+ void init(std::string, char type = 'c');
+
+ //Refetch parameter information
+ void update(void);
+ void callback(Fl_Callback *cb, void *p = NULL);
+
+ void cb(void);
+ static void _cb(Fl_Widget *w, void *);
+ private:
+ string label_str;
+ std::string full_path;
+ std::string path;
+ double real_value;
+ char osc_type;
+ std::pair<Fl_Callback*, void*> cb_data;
+};
diff --git a/src/UI/Fl_Osc_VSlider.cpp b/src/UI/Fl_Osc_VSlider.cpp
@@ -0,0 +1,66 @@
+#include "Fl_Osc_VSlider.H"
+#include "Fl_Osc_Interface.h"
+#include "Fl_Osc_Pane.H"
+#include <cstdlib>
+#include <cstring>
+#include <cmath>
+#include <cassert>
+#include <sstream>
+
+Fl_Osc_VSlider::Fl_Osc_VSlider(int X, int Y, int W, int H, const char *label)
+ :Fl_Value_Slider(X,Y,W,H,label), Fl_Osc_Widget(this), cb_data(NULL, NULL)
+{
+ //bounds(0.0f,1.0f);
+ Fl_Slider::callback(Fl_Osc_VSlider::_cb);
+}
+
+void Fl_Osc_VSlider::init(std::string path_, char type_)
+{
+ osc_type = type_;
+ path = path_;
+ oscRegister(path.c_str());
+}
+
+Fl_Osc_VSlider::~Fl_Osc_VSlider(void)
+{}
+
+void Fl_Osc_VSlider::OSC_value(char v)
+{
+ Fl_Slider::value(v+minimum());
+}
+
+void Fl_Osc_VSlider::OSC_value(float v)
+{
+ Fl_Slider::value(v+minimum());
+}
+
+void Fl_Osc_VSlider::cb(void)
+{
+ const float val = Fl_Slider::value();
+ if(osc_type == 'f')
+ oscWrite(path, "f", val-minimum());
+ else if(osc_type == 'i')
+ oscWrite(path, "i", (int)(val-minimum()));
+ else
+ oscWrite(path, "c", (char)(val-minimum()));
+ //OSC_value(val);
+
+ if(cb_data.first)
+ cb_data.first(this, cb_data.second);
+}
+
+void Fl_Osc_VSlider::callback(Fl_Callback *cb, void *p)
+{
+ cb_data.first = cb;
+ cb_data.second = p;
+}
+
+void Fl_Osc_VSlider::update(void)
+{
+ oscWrite(path, "");
+}
+
+void Fl_Osc_VSlider::_cb(Fl_Widget *w, void *)
+{
+ static_cast<Fl_Osc_VSlider*>(w)->cb();
+}
diff --git a/src/UI/Fl_Osc_Widget.cpp b/src/UI/Fl_Osc_Widget.cpp
@@ -54,6 +54,10 @@ void Fl_Osc_Widget::oscWrite(std::string path, const char *args, ...)
printf("Args = ['%d']\n", rtosc_argument(buffer, 0).i);
if(!strcmp(args, "f"))
printf("Args = ['%f']\n", rtosc_argument(buffer, 0).f);
+ if(!strcmp(args, "T"))
+ printf("Args = [True]\n");
+ if(!strcmp(args, "F"))
+ printf("Args = [False]\n");
}
void Fl_Osc_Widget::oscWrite(std::string path)
diff --git a/src/UI/PartUI.fl b/src/UI/PartUI.fl
@@ -1097,8 +1097,7 @@ if (kititem!=lastkititem){
adnoteui=new ADnoteUI(part->kit[kititem].adpars, loc+"kit"+to_s(kititem)+"/adpars/", osc);
if (part->kit[kititem].subpars)
- subnoteui=new SUBnoteUI(part->kit[kititem].subpars,
- osc, loc+"kit"+to_s(kititem)+"/subpars/");
+ subnoteui=new SUBnoteUI(osc, loc+"kit"+to_s(kititem)+"/subpars/");
if (part->kit[kititem].padpars) {
char buffer[1024];
diff --git a/src/UI/SUBnoteUI.fl b/src/UI/SUBnoteUI.fl
@@ -20,8 +20,11 @@ decl {\#include <string.h>} {public local
decl {\#include "../globals.h"} {public local
}
-decl {\#include "WidgetPDial.h"} {public local
-}
+decl {\#include "Fl_Osc_VSlider.H"} {public local
+}
+
+decl {\#include "Fl_Osc_Dial.H"} {public local
+}
decl {\#include "EnvelopeUI.h"} {public local
}
@@ -38,32 +41,71 @@ decl {\#include "../Params/SUBnoteParameters.h"} {public local
decl {\#include "PresetsUI.h"} {public local
}
-class SUBnoteharmonic {: {public Fl_Group}
+class PPSlider {: {public Fl_Slider, public Fl_Osc_Widget}
+} {
+ Function {PPSlider(int x,int y, int w, int h, const char *label=0):Fl_Slider(x,y,w,h,label),Fl_Osc_Widget(this)} {open
+ } {
+ code {//Shamelessly copied from OscilGenUI.fl TODO refactor
+ bw=false;} {}
+ }
+ Function {handle(int event)} {open return_type int
+ } {
+ code {int X=x(),Y=y(),W=w(),H=h();
+
+if ((!Fl::event_buttons())|| (event==0)||(Fl::event_shift()==0)) return(Fl_Slider::handle(event));
+
+if (!Fl::event_inside(X,Y,W,H)) {
+ if (event==FL_DRAG){
+ Fl_Slider::handle(FL_RELEASE);
+ Fl_Slider::handle(FL_LEAVE);
+ deactivate();
+ activate();
+ return(1);
+ }else{
+ return(Fl_Slider::handle(event));
+ };
+} else {
+ //Fl_Slider::handle(FL_FOCUS);
+ Fl_Slider::handle(FL_PUSH);
+};
+
+return(1);} {}
+ }
+ Function {OSC_value(char c)} {open return_type void
+ } {
+ code {value(127-c);} {}
+ }
+ decl {bool bw;} {public local
+ }
+}
+
+class SUBnoteharmonic {: {public Fl_Osc_Group}
} {
Function {make_window()} {private
} {
Fl_Window harmonic {
xywh {329 403 90 225} type Double hide
- class Fl_Group
+ class Fl_Osc_Group
} {
Fl_Slider mag {
- callback {int x=0;
+ callback {
+ //TODO consider unifying this with the OscilGenUI display stuff
+ int x=0;
if (Fl::event_button1()) x=127-(int)o->value();
else o->value(127-x);
-pars->Phmag[n]=x;
-if (pars->Phmag[n]==0) o->selection_color(0);
+ o->osc->writeValue(o->loc + "Phmag" + to_s(n), (char) x);
+if (x==0) o->selection_color(0);
else o->selection_color(222);}
tooltip {harmonic's magnitude} xywh {0 15 10 115} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 127
- code0 {o->value(127-pars->Phmag[n]);}
- code1 {if (pars->Phmag[n]==0) o->selection_color(0);}
+ class PPSlider
}
Fl_Slider bw {
callback {int x=64;
if (Fl::event_button1()) x=127-(int)o->value();
else o->value(x);
-pars->Phrelbw[n]=x;}
+ o->osc->writeValue(o->loc+"Phrelbw"+to_s(n), (char) x);}
tooltip {harmonic's bandwidth} xywh {0 135 10 75} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64
- code0 {o->value(127-pars->Phrelbw[n]);}
+ class PPSlider
}
Fl_Box {} {
xywh {10 170 5 5} box FLAT_BOX color 45
@@ -81,28 +123,31 @@ pars->Phrelbw[n]=x;}
}
}
}
- Function {SUBnoteharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
+ Function {SUBnoteharmonic(int x,int y, int w, int h, const char *label=0):Fl_Osc_Group(x,y,w,h,label)} {} {
code {n=0;} {}
}
- Function {init(SUBnoteParameters *pars_,int n_)} {} {
- code {pars=pars_;
-n=n_;
+ Function {init(int n_)} {} {
+ code {n=n_;
make_window();
harmonic->show();
+
+osc->createLink(pane_name+"Phmag"+to_s(n), mag);
+osc->createLink(pane_name+"Phrelbw"+to_s(n), bw);
+osc->requestValue(pane_name+"Phmag"+to_s(n));
+osc->requestValue(pane_name+"Phrelbw"+to_s(n));
+
end();} {}
}
Function {refresh()} {} {
- code {mag->value(127-pars->Phmag[n]);
-if (pars->Phmag[n]==0) mag->selection_color(0);
-bw->value(127-pars->Phrelbw[n]);} {}
+ code {
+osc->requestValue(pane_name+"Phmag"+to_s(n));
+osc->requestValue(pane_name+"Phrelbw"+to_s(n));} {}
}
Function {~SUBnoteharmonic()} {} {
code {harmonic->hide();
hide();
//delete(harmonic);} {}
}
- decl {SUBnoteParameters *pars;} {private local
- }
decl {int n;} {private local
}
}
@@ -116,13 +161,17 @@ class SUBnoteUI {open : {public PresetsUI_}
xywh {542 512 735 390} type Double
class Fl_Osc_Window visible
} {
+ Fl_Box {} {
+ xywh {0 0 0 0} box FLAT_BOX color 45
+ code0 {SUBparameters->osc = osc; SUBparameters->pane_name = loc;}
+ }
Fl_Scroll {} {
label scroll open
xywh {5 140 435 245} type HORIZONTAL box FLAT_BOX labeltype NO_LABEL
} {
Fl_Pack harmonics {open
xywh {10 145 425 235} type HORIZONTAL
- code0 {for (int i=0;i<MAX_SUB_HARMONICS;i++){h[i]=new SUBnoteharmonic(0,0,15,o->h(),"");h[i]->init(pars,i);}}
+ code0 {for (int i=0;i<MAX_SUB_HARMONICS;i++){h[i]=new SUBnoteharmonic(0,0,15,o->h(),"");h[i]->init(i);}}
} {}
}
Fl_Button {} {
@@ -136,22 +185,21 @@ class SUBnoteUI {open : {public PresetsUI_}
} {
Fl_Value_Slider vol {
label Vol
- callback {pars->PVolume=(int)o->value();}
tooltip Volume xywh {10 25 140 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
- code0 {o->value(pars->PVolume);}
+ code0 {o->init("PVolume");}
+ class Fl_Osc_VSlider
}
Fl_Value_Slider vsns {
label {V.Sns}
- callback {pars->PAmpVelocityScaleFunction=(int) o->value();}
tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 45 140 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
- code0 {o->value(pars->PAmpVelocityScaleFunction);}
+ code0 {o->init("PAmpVelocityScaleFunction");}
+ class Fl_Osc_VSlider
}
Fl_Dial pan {
label Pan
- callback {pars->PPanning=(int) o->value();}
tooltip {Panning (leftmost is Random)} xywh {185 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
- code0 {o->value(pars->PPanning);}
- class WidgetPDial
+ code0 {o->init("PPanning");}
+ class Fl_Osc_Dial
}
Fl_Group ampenv {
label {SUBsynth - Amplitude Envelope} open
@@ -165,15 +213,15 @@ class SUBnoteUI {open : {public PresetsUI_}
} {
Fl_Counter filterstages {
label {Filter Stages}
- callback {pars->Pnumstages=(int) o->value();}
tooltip {How many times the noise is filtered} xywh {515 340 45 15} type Simple labelfont 1 labelsize 10 align 1 minimum 1 maximum 5 step 1 textsize 10
- code0 {o->value(pars->Pnumstages);}
+ code0 {o->init("Pnumstages");}
+ class Fl_Osc_Counter
}
Fl_Choice magtype {
label {Mag.Type}
- callback {pars->Phmagtype=(int) o->value();}
xywh {585 340 65 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11
- code0 {o->value(pars->Phmagtype);}
+ code0 {o->init("Phmagtype");}
+ class Fl_Osc_Choice
} {
MenuItem {} {
label Linear
@@ -198,9 +246,9 @@ class SUBnoteUI {open : {public PresetsUI_}
}
Fl_Choice start {
label Start
- callback {pars->Pstart=(int) o->value();} open
xywh {670 340 50 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11
- code0 {o->value(pars->Pstart);}
+ code0 {o->init("Pstart");}
+ class Fl_Osc_Choice
} {
MenuItem {} {
label Zero
@@ -224,96 +272,84 @@ class SUBnoteUI {open : {public PresetsUI_}
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/");}
- code1 {if (pars->PFreqEnvelopeEnabled==0) o->deactivate();}
class EnvelopeUI
} {}
Fl_Check_Button freqee {
label Enabled
- callback {pars->PFreqEnvelopeEnabled=o->value();
-if (o->value()==0) freqenvelopegroup->deactivate();
- else freqenvelopegroup->activate();
+ callback { if (o->value()==0) freqenvelopegroup->deactivate();
+ else freqenvelopegroup->activate();
o->show();
freqsettingsui->redraw();}
xywh {445 68 55 15} down_box DOWN_BOX labelfont 1 labelsize 10
- code0 {o->value(pars->PFreqEnvelopeEnabled);}
+ code0 {o->init("PFreqEnvelopeEnabled");}
+ class Fl_Osc_Check
}
Fl_Counter octave {
label Octave
- callback {int k=(int) o->value();
-if (k<0) k+=16;
-pars->PCoarseDetune = k*1024+
- pars->PCoarseDetune%1024;}
tooltip Octave xywh {670 50 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11
- code0 {int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;}
- code2 {o->value(k);}
+ code0 {o->init("octave");}
+ class Fl_Osc_Counter
}
Fl_Counter coarsedet {
label {Coarse Det.}
- callback {int k=(int) o->value();
-if (k<0) k+=1024;
-pars->PCoarseDetune = k+
- (pars->PCoarseDetune/1024)*1024;}
tooltip {Coarse Detune} xywh {655 115 60 20} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11
- code0 {int k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;}
- code2 {o->value(k);}
+ code0 {o->init("coarsedetune");}
code3 {o->lstep(10);}
+ class Fl_Osc_Counter
}
Fl_Slider detune {
- callback {pars->PDetune=(int)o->value()+8192;
-detunevalueoutput->do_callback();}
+ callback {o->oscWrite("detunevalue");}
tooltip {Fine Detune (cents)} xywh {495 25 230 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
- code0 {o->value(pars->PDetune-8192);}
+ code0 {o->init("PDetune",'i');}
+ class Fl_Osc_Slider
}
Fl_Value_Output detunevalueoutput {
label Detune
- callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
xywh {448 25 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
- code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
+ code0 {o->init("detunevalue");}
+ class Fl_Osc_Output
}
Fl_Check_Button hz440 {
label 440Hz
- callback {int x=(int) o->value();
-pars->Pfixedfreq=x;
-if (x==0) fixedfreqetdial->deactivate();
+ callback {if (o->value()==0) fixedfreqetdial->deactivate();
else fixedfreqetdial->activate();}
tooltip {set the base frequency to 440Hz} xywh {555 45 50 15} down_box DOWN_BOX labelfont 1 labelsize 10
- code0 {o->value(pars->Pfixedfreq);}
+ code0 {o->init("Pfixedfreq");}
+ class Fl_Osc_Check
}
Fl_Dial fixedfreqetdial {
label {Eq.T.}
- callback {pars->PfixedfreqET=(int) o->value();}
tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {610 45 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
- code0 {o->value(pars->PfixedfreqET);}
- code1 {if (pars->Pfixedfreq==0) o->deactivate();}
- class WidgetPDial
+ code0 {o->init("PfixedfreqET");}
+ class Fl_Osc_Dial
}
Fl_Choice detunetype {
label {Detune Type}
- callback {pars->PDetuneType=(int) o->value()+1;
-detunevalueoutput->do_callback();} open
+ callback {o->oscWrite("detunevalue");} open
xywh {655 85 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
- code1 {o->value(pars->PDetuneType-1);}
+ code1 {o->init("PDetuneType",1);}
+ class Fl_Osc_Choice
} {}
}
Fl_Check_Button stereo {
label Stereo
- callback {pars->Pstereo=(int) o->value();}
xywh {440 325 55 35} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
- code0 {o->value(pars->Pstereo);}
+ code0 {o->init("Pstereo");}
+ class Fl_Osc_Check
}
Fl_Button {} {
label Clear
- callback {for (int i=0;i<MAX_SUB_HARMONICS;i++){
+ callback {
+ o->oscWrite("clear");
+ for (int i=0;i<MAX_SUB_HARMONICS;i++){
h[i]->mag->value(127);
- pars->Phmag[i]=0;
h[i]->bw->value(64);
- pars->Phrelbw[i]=64;
};
-pars->Phmag[0]=127;
h[0]->mag->value(0);
SUBparameters->redraw();}
tooltip {Clear the harmonics} xywh {445 365 70 20} box THIN_UP_BOX labelfont 1 labelsize 11
+ class Fl_Osc_Button
}
Fl_Group bandwidthsettingsui {
label BANDWIDTH
@@ -323,36 +359,34 @@ SUBparameters->redraw();}
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/");}
- code1 {if (pars->PBandWidthEnvelopeEnabled==0) o->deactivate();}
class EnvelopeUI
} {}
Fl_Check_Button bwee {
label Enabled
- callback {pars->PBandWidthEnvelopeEnabled=o->value();
-if (o->value()==0) bandwidthenvelopegroup->deactivate();
+ callback {if (o->value()==0) bandwidthenvelopegroup->deactivate();
else bandwidthenvelopegroup->activate();
o->show();
bandwidthsettingsui->redraw();}
xywh {225 67 55 15} down_box DOWN_BOX labelfont 1 labelsize 10
- code0 {o->value(pars->PBandWidthEnvelopeEnabled);}
+ code0 {o->init("PBandWidthEnvelopeEnabled");}
+ class Fl_Osc_Check
}
Fl_Value_Slider bandwidth {
label {Band Width}
- callback {pars->Pbandwidth=(int) o->value();}
xywh {225 40 115 15} type {Horz Knob} box NO_BOX labelsize 10 align 1 maximum 127 step 1
- code0 {o->value(pars->Pbandwidth);}
+ code0 {o->init("Pbandwidth");}
+ class Fl_Osc_VSlider
}
Fl_Value_Slider bwidthscale {
label {B.Width Scale}
- callback {pars->Pbwscale=(int) o->value()+64;}
tooltip {How much I increase the BandWidth according to lower/higher harmonics} xywh {345 40 90 15} type {Horz Knob} box NO_BOX labelsize 10 align 1 minimum -64 maximum 63 step 1
- code0 {o->value(pars->Pbwscale-64);}
+ code0 {o->init("Pbwscale");}
+ class Fl_Osc_Slider
}
}
Fl_Group globalfiltergroup {
label FILTER
xywh {440 140 290 185} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
- code0 {if (pars->PGlobalFilterEnabled==0) o->deactivate();}
} {
Fl_Group filterenv {
label {SUBsynth - Filter Envelope} open
@@ -369,81 +403,45 @@ bandwidthsettingsui->redraw();}
}
Fl_Check_Button filtere {
label Enabled
- callback {pars->PGlobalFilterEnabled=o->value();
-if (o->value()==0) globalfiltergroup->deactivate();
+ callback {if (o->value()==0) globalfiltergroup->deactivate();
else globalfiltergroup->activate();
o->show();
globalfiltergroup->redraw();}
xywh {445 145 85 20} down_box DOWN_BOX labelfont 1 labelsize 11
- code0 {o->value(pars->PGlobalFilterEnabled);}
+ code0 {o->init("PGlobalFilterEnabled");}
+ class Fl_Osc_Check
}
Fl_Button {} {
label C
- callback {presetsui->copy(pars);}
+ callback {/*presetsui->copy(pars);*/}
xywh {540 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
}
Fl_Button {} {
label P
- callback {presetsui->paste(pars,this);}
+ callback {/*presetsui->paste(pars,this);*/}
xywh {570 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
}
}
}
Function {refresh()} {} {
- code {for (int i=0;i<MAX_SUB_HARMONICS;i++) h[i]->refresh();
-vol->value(pars->PVolume);
-vsns->value(pars->PAmpVelocityScaleFunction);
-pan->value(pars->PPanning);
-
-
-bandwidth->value(pars->Pbandwidth);
-bwidthscale->value(pars->Pbwscale-64);
-bwee->value(pars->PBandWidthEnvelopeEnabled);
-if (pars->PBandWidthEnvelopeEnabled==0) bandwidthenvelopegroup->deactivate();
- else bandwidthenvelopegroup->activate();
-bwee->show();
-bandwidthsettingsui->redraw();
+ code {
+//bwee->show();
+//bandwidthsettingsui->redraw();
-detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune));
-freqee->value(pars->PFreqEnvelopeEnabled);
-if (pars->PFreqEnvelopeEnabled==0) freqenvelopegroup->deactivate();
- else freqenvelopegroup->activate();
-freqee->show();
-freqsettingsui->redraw();
+//freqee->show();
+//freqsettingsui->redraw();
-detune->value(pars->PDetune-8192);
-hz440->value(pars->Pfixedfreq);
-
-fixedfreqetdial->value(pars->PfixedfreqET);
-
-int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;
-octave->value(k);
-
-detunetype->value(pars->PDetuneType-1);
-
-k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;
-coarsedet->value(k);
-
-filtere->value(pars->PGlobalFilterEnabled);
-if (pars->PGlobalFilterEnabled==0) globalfiltergroup->deactivate();
- else globalfiltergroup->activate();
-filtere->show();
+//filtere->show();
globalfiltergroup->redraw();
-stereo->value(pars->Pstereo);
-filterstages->value(pars->Pnumstages);
-magtype->value(pars->Phmagtype);
-start->value(pars->Pstart);
-
ampenv->refresh();
bandwidthenvelopegroup->refresh();
freqenvelopegroup->refresh();
filterui->refresh();
filterenv->refresh();} {}
}
- Function {SUBnoteUI(SUBnoteParameters *parameters, Fl_Osc_Interface *osc_, std::string loc_)} {} {
- code {pars=parameters;
- osc = osc_;
+ Function {SUBnoteUI(Fl_Osc_Interface *osc_, std::string loc_)} {} {
+ code {osc = osc_;
loc = loc_;
make_window();} {}
}
@@ -456,8 +454,6 @@ delete(SUBparameters);} {}
}
decl {std::string loc;} {private local
}
- decl {SUBnoteParameters *pars;} {private local
- }
decl {SUBnoteharmonic *h[MAX_SUB_HARMONICS];} {private local
}
}