commit b75cb8d6ecb558f50e04a013c04bee9e0df26af0
parent 7e46abf022c5aee0ed562d10c10a56d208f528c7
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Thu, 9 May 2013 14:46:26 -0400
OscilGenUI is free of hazardous pointers
- OscilGenUI no longer has any pointer to master or its own OscilGen instance
for that matter.
- Leaks are patched
- Verbosity is currently increased drastically in the source due to a few
logical errors
So, not quite everything is taken care of in OscilGen and a few parameters may
have typos yet to be discovered, though it does appear to be running fairly
smoothly. The memory that is being tossed all over the place is now safely
deallocated and all double free issues are handled.
Some of the code here is a bit more manual than desired, but the automagic
should start kicking in now that rtosc has infected the UI.
Next up wiring some of this stuff to MIDI...
Diffstat:
16 files changed, 1141 insertions(+), 783 deletions(-)
diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp
@@ -361,11 +361,16 @@ void Master::AudioOut(float *outl, float *outr)
//Handle user events TODO move me to a proper location
char loc_buf[1024];
DataObj d{loc_buf, 1024, this, bToU};
+ memset(loc_buf, sizeof(loc_buf), 0);
int events = 0;
while(uToB->hasNext()) {
+ d.matches = 0;
+ //fprintf(stderr, "address '%s'\n", uToB->peak());
ports.dispatch(uToB->read()+1, d);
events++;
- //fprintf(stderr, "backend: '%s'<%s>\n", uToB->peak(), rtosc_argument_string(uToB->peak()));
+ if(!d.matches)
+ fprintf(stderr, "Unknown address '%s'\n", uToB->peak());
+ fprintf(stderr, "backend: '%s'<%s>\n", uToB->peak(), rtosc_argument_string(uToB->peak()));
}
if(events>1)
fprintf(stderr, "backend: %d events per cycle\n",events);
diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp
@@ -8,6 +8,8 @@
#include <rtosc/ports.h>
#include <lo/lo.h>
+#include <unistd.h>
+
#include "../UI/Fl_Osc_Interface.h"
#include "../UI/Fl_Osc_Widget.H"
@@ -117,8 +119,11 @@ typedef void(*cb_t)(void*,const char*);
void deallocate(const char *str, void *v)
{
+ printf("deallocating a '%s' at '%p'\n", str, v);
if(!strcmp(str, "Part"))
delete (Part*)v;
+ if(!strcmp(str, "fft_t"))
+ delete[] (fft_t*)v;
else
fprintf(stderr, "Unknown type '%s', leaking pointer %p!!\n", str, v);
}
@@ -141,7 +146,7 @@ void osc_check(cb_t cb, void *ui)
curr_url = rtosc_argument(rtmsg,1).s;
else if(!strcmp(rtmsg, "/free")
&& !strcmp(rtosc_argument_string(rtmsg),"sb")) {
- printf("got a '%s' pointer for deallocation...\n", rtosc_argument(rtmsg, 0).s);
+ deallocate(rtosc_argument(rtmsg, 0).s, *((void**)rtosc_argument(rtmsg, 1).b.data));
} else if(curr_url == "GUI") {
cb(ui, rtmsg); //GUI::raiseUi(gui, bToU->read());
} else{
@@ -190,83 +195,6 @@ void preparePadSynth(string path, PADnoteParameters *p)
// {"prepare:", "", 0, }
//};
-static rtosc::Ports oscilPorts = {
- {"phase#128::c", "::Sets harmonic phase",
- NULL, [](const char *m, rtosc::RtData &d) {
- const char *mm = m;
- while(*mm && !isdigit(*mm)) ++mm;
- unsigned char &phase = ((OscilGen*)d.obj)->Phphase[atoi(mm)];
- if(!rtosc_narguments(m))
- d.reply(d.loc, "c", phase);
- else
- phase = rtosc_argument(m,0).i;
- }},
- {"magnitude#128::c", "::Sets harmonic magnitude",
- NULL, [](const char *m, rtosc::RtData &d) {
- //printf("I'm at '%s'\n", d.loc);
- const char *mm = m;
- while(*mm && !isdigit(*mm)) ++mm;
- unsigned char &mag = ((OscilGen*)d.obj)->Phmag[atoi(mm)];
- if(!rtosc_narguments(m))
- d.reply(d.loc, "c", mag);
- else
- mag = rtosc_argument(m,0).i;
- }},
- {"base-spectrum:", "::Returns spectrum of base waveshape",
- NULL, [](const char *m, rtosc::RtData &d) {
- const unsigned n = synth->oscilsize / 2;
- float *spc = new float[n];
- memset(spc, 0, 4*n);
- ((OscilGen*)d.obj)->getspectrum(n,spc,1);
- d.reply(d.loc, "b", n*sizeof(float), spc);
- delete[] spc;
- }},
- {"base-waveform:", "::Returns base waveshape points",
- NULL, [](const char *m, rtosc::RtData &d) {
- const unsigned n = synth->oscilsize;
- float *smps = new float[n];
- memset(smps, 0, 4*n);
- ((OscilGen*)d.obj)->getcurrentbasefunction(smps);
- d.reply(d.loc, "b", n*sizeof(float), smps);
- delete[] smps;
- }},
- {"spectrum:", "::Returns spectrum of waveform",
- NULL, [](const char *m, rtosc::RtData &d) {
- const unsigned n = synth->oscilsize / 2;
- float *spc = new float[n];
- memset(spc, 0, 4*n);
- ((OscilGen*)d.obj)->getspectrum(n,spc,0);
- d.reply(d.loc, "b", n*sizeof(float), spc);
- delete[] spc;
- }},
- {"waveform:", "::Returns waveform points",
- NULL, [](const char *m, rtosc::RtData &d) {
- const unsigned n = synth->oscilsize;
- float *smps = new float[n];
- memset(smps, 0, 4*n);
- OscilGen *o = ((OscilGen*)d.obj);
- //printf("%d\n", o->needPrepare());
- ((OscilGen*)d.obj)->get(smps,-1.0);
- //printf("wave: %f %f %f %f\n", smps[0], smps[1], smps[2], smps[3]);
- d.reply(d.loc, "b", n*sizeof(float), smps);
- delete[] smps;
- }},
- {"prepare:", "::Performs setup operation to oscillator",
- NULL, [](const char *m, rtosc::RtData &d) {
- OscilGen &o = *(OscilGen*)d.obj;
- fft_t *data = new fft_t[synth->oscilsize / 2];
- o.prepare(data);
- printf("sending '%p' of fft data\n", data);
- uToB->write(d.loc, "b",
- sizeof(fft_t*), &data);
- o.pendingfreqs = data;
- }},
- {"convert2sine:", "::Translates waveform into FS",
- NULL, [](const char *m, rtosc::RtData &d) {
- ((OscilGen*)d.obj)->convert2sine();
- }},
-};
-
class DummyDataObj:public rtosc::RtData
{
public:
@@ -274,6 +202,9 @@ class DummyDataObj:public rtosc::RtData
Fl_Osc_Interface *osc_)
{
memset(loc_, 0, sizeof(loc_size_));
+ //XXX Possible bug in rtosc using this buffer
+ buffer = new char[4*4096];
+ memset(buffer, 0, 4*4096);
loc = loc_;
loc_size = loc_size_;
obj = obj_;
@@ -281,25 +212,41 @@ class DummyDataObj:public rtosc::RtData
ui = ui_;
osc = osc_;
}
+ ~DummyDataObj(void)
+ {
+ delete[] buffer;
+ }
virtual void reply(const char *path, const char *args, ...)
{
//printf("reply building '%s'\n", path);
va_list va;
va_start(va,args);
- char *buffer = bToU->buffer();
- rtosc_vmessage(buffer,bToU->buffer_size(),path,args,va);
- reply(buffer);
+ if(!strcmp(path, "/forward")) { //forward the information to the backend
+ args++;
+ path = va_arg(va, const char *);
+ fprintf(stderr, "forwarding information to the backend on '%s'<%s>\n",
+ path, args);
+ rtosc_vmessage(buffer,4*4096,path,args,va);
+ uToB->raw_write(buffer);
+ } else {
+ printf("path = '%s' args = '%s'\n", path, args);
+ printf("buffer = '%p'\n", buffer);
+ rtosc_vmessage(buffer,4*4096,path,args,va);
+ printf("buffer = '%s'\n", buffer);
+ reply(buffer);
+ }
}
virtual void reply(const char *msg)
{
- //printf("reply used for '%s'\n", msg);
+ printf("reply used for '%s'\n", msg);
osc->tryLink(msg);
cb(ui, msg);
}
//virtual void broadcast(const char *path, const char *args, ...){(void)path;(void)args;};
//virtual void broadcast(const char *msg){(void)msg;};
private:
+ char *buffer;
cb_t cb;
void *ui;
Fl_Osc_Interface *osc;
@@ -388,13 +335,27 @@ struct MiddleWareImpl
osc_check(cb, ui);
}
- void handleOscil(string path, const char *msg, void *v)
+ bool handleOscil(string path, const char *msg, void *v)
{
char buffer[1024];
+ memset(buffer, 0, sizeof(buffer));
DummyDataObj d(buffer, 1024, v, cb, ui, osc);
strcpy(buffer, path.c_str());
- printf("location buffer contains '%s'\n", d.loc);
- oscilPorts.dispatch(msg, d);
+
+ for(auto &p:OscilGen::ports.ports) {
+ if(strstr(p.name,msg) && strstr(p.metadata, "realtime") &&
+ !strcmp("b", rtosc_argument_string(msg))) {
+ printf("sending along packet '%s'...\n", msg);
+ return false;
+ }
+ }
+
+ OscilGen::ports.dispatch(msg, d);
+ if(!d.matches)
+ fprintf(stderr, "Unknown location '%s%s'<%s>\n",
+ path.c_str(), msg, rtosc_argument_string(msg));
+
+ return true;
}
/* Should handle the following paths specially
@@ -408,6 +369,8 @@ struct MiddleWareImpl
*/
void handleMsg(const char *msg)
{
+ assert(!strstr(msg,"free"));
+ printf("middleware: '%s'\n", msg);
const char *last_path = rindex(msg, '/');
if(!last_path)
return;
@@ -417,11 +380,12 @@ struct MiddleWareImpl
string obj_rl(msg, last_path+1);
if(objmap.find(obj_rl) != objmap.end()) {
//try some over simplified pattern matching
- if(strstr(msg, "oscil/"))
- handleOscil(obj_rl, last_path+1, objmap[obj_rl]);
+ if(strstr(msg, "oscil/")) {
+ if(!handleOscil(obj_rl, last_path+1, objmap[obj_rl]))
+ uToB->raw_write(msg);
//else if(strstr(obj_rl.c_str(), "kititem"))
// handleKitItem(obj_rl, objmap[obj_rl],atoi(rindex(msg,'m')+1),rtosc_argument(msg,0).T);
- else if(strstr(msg, "padpars/prepare"))
+ } else if(strstr(msg, "padpars/prepare"))
preparePadSynth(obj_rl,(PADnoteParameters *) objmap[obj_rl]);
else //just forward the message
uToB->raw_write(msg);
@@ -439,7 +403,7 @@ struct MiddleWareImpl
va_start(va, args);
write(path, args, va);
}
-
+
void write(const char *path, const char *args, va_list va)
{
//printf("is that a '%s' I see there?\n", path);
@@ -473,7 +437,7 @@ struct MiddleWareImpl
//this assumption is broken
Master *master;
- //The ONLY means that any chunk of code should have for interacting with the
+ //The ONLY means that any chunk of UI code should have for interacting with the
//backend
Fl_Osc_Interface *osc;
@@ -501,7 +465,7 @@ class UI_Interface:public Fl_Osc_Interface
impl->write(s.c_str(),"");
}
-
+
void write(string s, const char *args, ...) override
{
va_list va;
@@ -530,8 +494,10 @@ class UI_Interface:public Fl_Osc_Interface
void removeLink(string s, class Fl_Osc_Widget*w) override
{
for(auto i = map.begin(); i != map.end(); ++i) {
- if(i->first == s && i->second == w)
+ if(i->first == s && i->second == w) {
map.erase(i);
+ break;
+ }
}
printf("[%d] removing '%s' (%p)...\n", map.size(), s.c_str(), w);
}
@@ -542,10 +508,13 @@ class UI_Interface:public Fl_Osc_Interface
if(pair.first == msg) {
const char *arg_str = rtosc_argument_string(msg);
//printf("Possible location for application of '%s' is '%p'\n", msg, pair.second);
- if(!strcmp(arg_str, "b"))
+ if(!strcmp(arg_str, "b")) {
+ printf("'%s' matches '%s' ala blob\n", pair.first.c_str(), msg);
+ fprintf(stderr, "tossing blob params %d %p (%p)\n", rtosc_argument(msg,0).b.len,rtosc_argument(msg,0).b.data, pair.second);
pair.second->OSC_value(rtosc_argument(msg,0).b.len,rtosc_argument(msg,0).b.data);
- else if(!strcmp(arg_str, "c")) {
+ } else if(!strcmp(arg_str, "c")) {
printf("'%s' => '%d'\n", msg, rtosc_argument(msg,0).i);
+ fprintf(stderr, "tossing char to %p\n", pair.second);
pair.second->OSC_value((char)rtosc_argument(msg,0).i);
}
}
diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp
@@ -23,20 +23,149 @@
#include "OscilGen.h"
#include "../Misc/WaveShapeSmps.h"
+int main_thread = 0;
#include <cassert>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
+#include <stddef.h>
+
+#include <unistd.h>
+#include <sys/syscall.h>
#include <rtosc/ports.h>
+template<int i>
+void simpleset(const char *m, rtosc::RtData &d)
+{
+ unsigned char *addr = ((unsigned char*) d.obj)+i;
+ if(!rtosc_narguments(m))
+ d.reply(d.loc, "c", *addr);
+ else
+ *addr = rtosc_argument(m, 0).i;
+}
+#undef PARAMC
+#define PARAMC(x) rtosc::Port{#x "::c", "::", NULL, \
+ simpleset<__builtin_offsetof(class OscilGen, P##x)>}
+
static rtosc::Ports localPorts = {
- {"prepare:b", ":'pointer':Sets prepared fft data",
+ PARAMC(hmagtype),
+ PARAMC(currentbasefunc),
+ PARAMC(basefuncpar),
+ PARAMC(basefuncpar),
+ PARAMC(basefuncmodulation),
+ PARAMC(basefuncmodulationpar1),
+ PARAMC(basefuncmodulationpar2),
+ PARAMC(basefuncmodulationpar3),
+ PARAMC(waveshaping),
+ PARAMC(waveshapingfunction),
+ PARAMC(filtertype),
+ PARAMC(filterpar1),
+ PARAMC(filterpar2),
+ PARAMC(filterbeforews),
+ PARAMC(satype),
+ PARAMC(sapar),
+ //FIXME missing int stuff
+ PARAMC(modulation),
+ PARAMC(modulationpar1),
+ PARAMC(modulationpar2),
+ PARAMC(modulationpar3),
+ //FIXME realtime parameters lurking below
+ PARAMC(rand),
+ PARAMC(amprandpower),
+ PARAMC(amprandtype),
+ PARAMC(adaptiveharmonics),
+ PARAMC(adaptiveharmonicsbasefreq),
+ PARAMC(adaptiveharmonicspower),
+ PARAMC(adaptiveharmonicspar),
+
+ {"phase#128::c", "::Sets harmonic phase",
+ NULL, [](const char *m, rtosc::RtData &d) {
+ const char *mm = m;
+ while(*mm && !isdigit(*mm)) ++mm;
+ unsigned char &phase = ((OscilGen*)d.obj)->Phphase[atoi(mm)];
+ if(!rtosc_narguments(m))
+ d.reply(d.loc, "c", phase);
+ else
+ phase = rtosc_argument(m,0).i;
+ }},
+ {"magnitude#128::c", "::Sets harmonic magnitude",
+ NULL, [](const char *m, rtosc::RtData &d) {
+ //printf("I'm at '%s'\n", d.loc);
+ const char *mm = m;
+ while(*mm && !isdigit(*mm)) ++mm;
+ unsigned char &mag = ((OscilGen*)d.obj)->Phmag[atoi(mm)];
+ if(!rtosc_narguments(m))
+ d.reply(d.loc, "c", mag);
+ else
+ mag = rtosc_argument(m,0).i;
+ }},
+ {"base-spectrum:", "::Returns spectrum of base waveshape",
+ NULL, [](const char *m, rtosc::RtData &d) {
+ const unsigned n = synth->oscilsize / 2;
+ float *spc = new float[n];
+ memset(spc, 0, 4*n);
+ ((OscilGen*)d.obj)->getspectrum(n,spc,1);
+ d.reply(d.loc, "b", n*sizeof(float), spc);
+ delete[] spc;
+ }},
+ {"base-waveform:", "::Returns base waveshape points",
+ NULL, [](const char *m, rtosc::RtData &d) {
+ const unsigned n = synth->oscilsize;
+ float *smps = new float[n];
+ memset(smps, 0, 4*n);
+ ((OscilGen*)d.obj)->getcurrentbasefunction(smps);
+ d.reply(d.loc, "b", n*sizeof(float), smps);
+ delete[] smps;
+ }},
+ {"spectrum:", "::Returns spectrum of waveform",
+ NULL, [](const char *m, rtosc::RtData &d) {
+ const unsigned n = synth->oscilsize / 2;
+ float *spc = new float[n];
+ memset(spc, 0, 4*n);
+ ((OscilGen*)d.obj)->getspectrum(n,spc,0);
+ d.reply(d.loc, "b", n*sizeof(float), spc);
+ delete[] spc;
+ }},
+ {"waveform:", "::Returns waveform points",
+ NULL, [](const char *m, rtosc::RtData &d) {
+ const unsigned n = synth->oscilsize;
+ float *smps = new float[n];
+ memset(smps, 0, 4*n);
+ OscilGen *o = ((OscilGen*)d.obj);
+ //printf("%d\n", o->needPrepare());
+ ((OscilGen*)d.obj)->get(smps,-1.0);
+ //printf("wave: %f %f %f %f\n", smps[0], smps[1], smps[2], smps[3]);
+ d.reply(d.loc, "b", n*sizeof(float), smps);
+ delete[] smps;
+ }},
+ {"prepare:", "::Performs setup operation to oscillator",
+ NULL, [](const char *m, rtosc::RtData &d) {
+ fprintf(stderr, "prepare: got a message from '%s'\n", m);
+ OscilGen &o = *(OscilGen*)d.obj;
+ fft_t *data = new fft_t[synth->oscilsize / 2];
+ o.prepare(data);
+ fprintf(stderr, "sending '%p' of fft data\n", data);
+ d.reply("/forward", "sb", d.loc, sizeof(fft_t*), &data);
+ o.pendingfreqs = data;
+ }},
+ {"convert2sine:", "::Translates waveform into FS",
+ NULL, [](const char *m, rtosc::RtData &d) {
+ ((OscilGen*)d.obj)->convert2sine();
+ }},
+ {"prepare:b", ":'pointer','realtime':Sets prepared fft data",
NULL, [](const char *m, rtosc::RtData &d) {
+ fprintf(stderr, "prepare:b got a message from '%s'\n", m);
+ OscilGen &o = *(OscilGen*)d.obj;
assert(rtosc_argument(m,0).b.len == sizeof(void*));
- ((OscilGen*)d.obj)->oscilFFTfreqs =
- *(fft_t**)rtosc_argument(m,0).b.data;
- }},//XXX memory leak
+ d.reply("/free", "sb", "fft_t", sizeof(void*), &o.oscilFFTfreqs);
+ fprintf(stderr, "\n\n");
+ fprintf(stderr, "The ID of this of this thread is: %ld\n", (long int)syscall(224));
+ fprintf(stderr, "o.oscilFFTfreqs = %p\n", o.oscilFFTfreqs);
+ assert(main_thread != syscall(224));
+ assert(o.oscilFFTfreqs !=*(fft_t**)rtosc_argument(m,0).b.data);
+ o.oscilFFTfreqs = *(fft_t**)rtosc_argument(m,0).b.data;
+ }},
};
rtosc::Ports &OscilGen::ports = localPorts;
diff --git a/src/UI/ADnoteUI.fl b/src/UI/ADnoteUI.fl
@@ -64,7 +64,7 @@ class ADvoicelistitem {open : {public Fl_Group}
Function {make_window()} {open private
} {
Fl_Window ADnoteVoiceListItem {open
- private xywh {310 881 615 100} type Double box UP_FRAME
+ private xywh {316 881 615 100} type Double box UP_FRAME
class Fl_Group visible
} {
Fl_Group voicelistitemgroup {open
@@ -207,7 +207,7 @@ class ADvoiceUI {open : {public Fl_Group}
} {
Fl_Window ADnoteVoiceParameters {
label Voice open
- xywh {502 391 765 590} type Double box NO_BOX
+ xywh {508 391 765 590} type Double box NO_BOX
class Fl_Group visible
} {
Fl_Group voiceparametersgroup {open
@@ -343,12 +343,14 @@ o->redraw();}
}
Fl_Button changeFMoscilbutton {
label Change
- callback {if (oscedit!=NULL) delete(oscedit);
+ callback {if (oscedit!=NULL)
+ delete(oscedit);
int nv=nvoice;
-if (pars->VoicePar[nvoice].PextFMoscil>=0) nv=pars->VoicePar[nvoice].PextFMoscil;
+if (pars->VoicePar[nvoice].PextFMoscil>=0)
+ nv=pars->VoicePar[nvoice].PextFMoscil;
-oscedit=new OscilEditor(pars->VoicePar[nv].FMSmp,fmoscil,NULL,NULL,loc+"mod-oscil/", osc_i);}
+oscedit=new OscilEditor(NULL,NULL,loc+"mod-oscil/", osc_i);}
xywh {700 380 55 15} box THIN_UP_BOX labelfont 1 labelsize 11
code0 {if (pars->VoicePar[nvoice].PextFMoscil>=0) o->labelcolor(FL_BLUE);}
}
@@ -541,9 +543,10 @@ detunevalueoutput->do_callback();} open
callback {if (oscedit!=NULL) delete(oscedit);
int nv=nvoice;
-if (pars->VoicePar[nvoice].Pextoscil>=0) nv=pars->VoicePar[nvoice].Pextoscil;
+if(pars->VoicePar[nvoice].Pextoscil>=0)
+ nv=pars->VoicePar[nvoice].Pextoscil;
-oscedit=new OscilEditor(pars->VoicePar[nv].OscilSmp,voiceoscil,NULL,NULL,loc+"oscil/", osc_i);}
+oscedit=new OscilEditor(NULL,NULL,loc+"oscil/", osc_i);} selected
xywh {5 490 65 20} box THIN_UP_BOX labelfont 1 labelsize 11
code0 {if (pars->VoicePar[nvoice].Pextoscil>=0) o->labelcolor(FL_BLUE);}
}
@@ -835,8 +838,7 @@ ADnoteVoiceParameters->show();} {}
code {ADnoteVoiceParameters->hide();
hide();
delete(oscedit);
-//delete (ADnoteVoiceParameters);} {selected
- }
+//delete (ADnoteVoiceParameters);} {}
}
decl {int nvoice;} {private local
}
@@ -862,7 +864,7 @@ class ADnoteUI {open : {public PresetsUI_}
} {
Fl_Window ADnoteGlobalParameters {
label {ADsynth Global Parameters of the Instrument} open
- xywh {505 551 540 430} type Double visible
+ xywh {511 551 540 430} type Double visible
} {
Fl_Group {} {
label FREQUENCY open
@@ -1071,7 +1073,7 @@ resui->resonancewindow->show();}
}
Fl_Window ADnoteVoice {
label {ADsynth Voice Parameters} open
- xywh {4 361 765 620} type Double visible
+ xywh {312 361 765 620} type Double visible
} {
Fl_Group advoice {open
xywh {0 0 765 585}
diff --git a/src/UI/CMakeLists.txt b/src/UI/CMakeLists.txt
@@ -34,6 +34,8 @@ add_library(zynaddsubfx_gui STATIC
${zynaddsubfx_gui_FLTK_UI_SRCS}
NioUI.cpp
WidgetPDial.cpp
+ Fl_Osc_Dial.cpp
+ Fl_Osc_Choice.cpp
Connection.cpp
)
diff --git a/src/UI/Fl_Osc_Choice.H b/src/UI/Fl_Osc_Choice.H
@@ -0,0 +1,25 @@
+#pragma once
+#include <FL/Fl_Choice.H>
+#include "Fl_Osc_Widget.H"
+#include <string>
+
+class Fl_Osc_Choice:public Fl_Choice, 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);
+ //void OSC_value(float);
+ void OSC_value(char);
+
+ //Refetch parameter information
+ void update(void);
+ void callback(Fl_Callback *cb, void *p = NULL);
+
+ 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_Choice.cpp b/src/UI/Fl_Osc_Choice.cpp
@@ -0,0 +1,89 @@
+#include "Fl_Osc_Choice.H"
+#include "Fl_Osc_Interface.h"
+#include "Fl_Osc_Pane.H"
+#include <cstdlib>
+#include <cstring>
+#include <cmath>
+#include <cassert>
+#include <sstream>
+
+template<typename A, typename B>
+B string_cast(const A &a)
+{
+ std::stringstream s;
+ s.precision(3);
+ B b;
+ s << " " << a << " ";
+ s >> b;
+ return b;
+}
+
+static Fl_Osc_Pane *fetch_osc_pane(Fl_Widget *w)
+{
+ if(!w)
+ return NULL;
+
+ Fl_Osc_Pane *pane = dynamic_cast<Fl_Osc_Pane*>(w->parent());
+ if(pane)
+ return pane;
+ return fetch_osc_pane(w->parent());
+}
+
+static void callback_fn(Fl_Widget *w, void *v)
+{
+ ((Fl_Osc_Choice*)w)->cb();
+}
+
+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(), osc(NULL), cb_data(NULL, NULL)
+{
+ Fl_Choice::callback(callback_fn, NULL);
+}
+
+void Fl_Osc_Choice::init(const char *path)
+{
+ Fl_Osc_Pane *pane = fetch_osc_pane(this);
+ assert(pane);
+ osc = pane->osc;
+ full_path = pane->pane_name + path;
+ osc->createLink(full_path, this);
+ osc->requestValue(full_path);
+};
+
+Fl_Osc_Choice::~Fl_Osc_Choice(void)
+{
+ if(osc)
+ osc->removeLink(full_path, this);
+}
+
+void Fl_Osc_Choice::callback(Fl_Callback *cb, void *p)
+{
+ cb_data.first = cb;
+ cb_data.second = p;
+}
+
+void Fl_Osc_Choice::OSC_value(char v)
+{
+ value(v);
+// real_value = v;
+// const float val = Fl_Osc_Widget::inv_translate(v, metadata.c_str());
+// Fl_Dial::value(val);
+//label_str = string_cast<int,string>(v);
+// label(" ");
+// label(label_str.c_str());
+}
+
+void Fl_Osc_Choice::cb(void)
+{
+ assert(osc);
+ osc->writeValue(full_path, (char)(value()));
+ if(cb_data.first)
+ cb_data.first(this, cb_data.second);
+}
+
+void Fl_Osc_Choice::update(void)
+{
+ assert(osc);
+ osc->requestValue(full_path);
+}
+
diff --git a/src/UI/Fl_Osc_Dial.H b/src/UI/Fl_Osc_Dial.H
@@ -0,0 +1,26 @@
+#pragma once
+#include <FL/Fl_Dial.H>
+#include "WidgetPDial.h"
+#include "Fl_Osc_Widget.H"
+#include <string>
+
+class Fl_Osc_Dial:public WidgetPDial, Fl_Osc_Widget
+{
+
+ public:
+ Fl_Osc_Dial(int X, int Y, int W, int H, const char *label = NULL);
+ virtual ~Fl_Osc_Dial(void);
+ void init(const char *path);
+ //void OSC_value(float);
+ void OSC_value(char);
+
+ //Refetch parameter information
+ void update(void);
+ void callback(Fl_Callback *cb, void *p = NULL);
+
+ 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_Dial.cpp b/src/UI/Fl_Osc_Dial.cpp
@@ -0,0 +1,93 @@
+#include "Fl_Osc_Dial.H"
+#include "Fl_Osc_Interface.h"
+#include "Fl_Osc_Pane.H"
+#include <cstdlib>
+#include <cstring>
+#include <cmath>
+#include <cassert>
+#include <sstream>
+
+template<typename A, typename B>
+B string_cast(const A &a)
+{
+ std::stringstream s;
+ s.precision(3);
+ B b;
+ s << " " << a << " ";
+ s >> b;
+ return b;
+}
+
+static void callback_fn(Fl_Widget *w, void *v)
+{
+ ((Fl_Osc_Dial*)w)->cb();
+}
+
+Fl_Osc_Pane *fetch_osc_pane(Fl_Widget *w)
+{
+ if(!w)
+ return NULL;
+
+ Fl_Osc_Pane *pane = dynamic_cast<Fl_Osc_Pane*>(w->parent());
+ if(pane)
+ return pane;
+ return fetch_osc_pane(w->parent());
+}
+
+Fl_Osc_Dial::Fl_Osc_Dial(int X, int Y, int W, int H, const char *label)
+ :WidgetPDial(X,Y,W,H, label), Fl_Osc_Widget()
+{
+ bounds(0.0, 127.0f);
+ WidgetPDial::callback(callback_fn);
+}
+
+
+void Fl_Osc_Dial::init(const char *path)
+{
+ Fl_Osc_Pane *pane = fetch_osc_pane(this);
+ assert(pane);
+ osc = pane->osc;
+ full_path = pane->pane_name + path;
+ osc->createLink(full_path, this);
+ osc->requestValue(full_path);
+};
+
+Fl_Osc_Dial::~Fl_Osc_Dial(void)
+{
+ osc->removeLink(full_path, this);
+}
+
+void Fl_Osc_Dial::callback(Fl_Callback *cb, void *p)
+{
+ cb_data.first = cb;
+ cb_data.second = p;
+}
+
+void Fl_Osc_Dial::OSC_value(char v)
+{
+ value(v+minimum());
+// real_value = v;
+// const float val = Fl_Osc_Widget::inv_translate(v, metadata.c_str());
+// Fl_Dial::value(val);
+//label_str = string_cast<int,string>(v);
+// label(" ");
+// label(label_str.c_str());
+}
+
+void Fl_Osc_Dial::update(void)
+{
+ osc->requestValue(full_path);
+}
+
+void Fl_Osc_Dial::cb(void)
+{
+ assert(osc);
+
+ osc->writeValue(full_path, (char)(value()-minimum()));
+
+ if(cb_data.first)
+ cb_data.first(this, cb_data.second);
+// label_str = string_cast<float,string>(val);
+// label(" ");
+// label(label_str.c_str());
+}
diff --git a/src/UI/Fl_Osc_Pane.H b/src/UI/Fl_Osc_Pane.H
@@ -5,6 +5,9 @@
class Fl_Osc_Pane
{
public:
+ Fl_Osc_Pane(void)
+ :osc(NULL), pane_name()
+ {}
class Fl_Osc_Interface *osc;
std::string pane_name;
};
diff --git a/src/UI/Fl_OscilSpectrum.h b/src/UI/Fl_OscilSpectrum.h
@@ -16,8 +16,7 @@ class Fl_OscilSpectrum : public Fl_Box, Fl_Osc_Widget
void init(bool base_spectrum_p)
{
- Fl_Group *g = dynamic_cast<Fl_Group*>(parent());
- Fl_Osc_Group *og = dynamic_cast<Fl_Osc_Group*>(g);
+ Fl_Osc_Pane *og = fetch_osc_pane(this);
assert(og);
loc = og->pane_name + (base_spectrum_p ? "base-spectrum": "spectrum");
@@ -25,16 +24,17 @@ class Fl_OscilSpectrum : public Fl_Box, Fl_Osc_Widget
assert(osc);
osc->createLink(loc, (Fl_Osc_Widget*) this);
- osc->requestValue(loc);
+ update();
}
void update(void)
{
- osc->write(loc, "i", nsamples);
+ osc->requestValue(loc);
}
- void OSC_value(unsigned N, void *data) override
+ virtual void OSC_value(unsigned N, void *data) override
{
+ fprintf(stderr, "(spec) OSC_value(%d,%p)\n", N, data);
assert(!(N%4));
const size_t new_samples = N / 4;
@@ -114,6 +114,17 @@ class Fl_OscilSpectrum : public Fl_Box, Fl_Osc_Widget
}
}
private:
+ Fl_Osc_Pane *fetch_osc_pane(Fl_Widget *w)
+ {
+ if(!w)
+ return NULL;
+
+ Fl_Osc_Pane *pane = dynamic_cast<Fl_Osc_Pane*>(w->parent());
+ if(pane)
+ return pane;
+ return fetch_osc_pane(w->parent());
+ }
+
size_t nsamples;
float *spc;
};
diff --git a/src/UI/Fl_Oscilloscope.h b/src/UI/Fl_Oscilloscope.h
@@ -32,8 +32,7 @@ class Fl_Oscilloscope : public Fl_Box, Fl_Osc_Widget
void init(bool base_waveform_p)
{
- Fl_Group *g = dynamic_cast<Fl_Group*>(parent());
- Fl_Osc_Group *og = dynamic_cast<Fl_Osc_Group*>(g);
+ Fl_Osc_Pane *og = fetch_osc_pane(this);
assert(og);
loc = og->pane_name + (base_waveform_p ? "base-waveform": "waveform");
@@ -49,8 +48,9 @@ class Fl_Oscilloscope : public Fl_Box, Fl_Osc_Widget
osc->requestValue(loc);
}
- void OSC_value(unsigned N, void *data) override
+ virtual void OSC_value(unsigned N, void *data) override
{
+ fprintf(stderr, "(oscl) OSC_value(%d,%p)\n", N, data);
assert(N==(unsigned)(synth->oscilsize*4));
memcpy(smps, data, N);
@@ -122,5 +122,16 @@ class Fl_Oscilloscope : public Fl_Box, Fl_Osc_Widget
int phase;
private:
+ Fl_Osc_Pane *fetch_osc_pane(Fl_Widget *w)
+ {
+ if(!w)
+ return NULL;
+
+ Fl_Osc_Pane *pane = dynamic_cast<Fl_Osc_Pane*>(w->parent());
+ if(pane)
+ return pane;
+ return fetch_osc_pane(w->parent());
+ }
+
float *smps;
};
diff --git a/src/UI/OscilGenUI.fl b/src/UI/OscilGenUI.fl
@@ -14,9 +14,6 @@ decl {\#include "../Synth/OscilGen.h"} {public local
decl {\#include "../Misc/Util.h"} {public local
}
-decl {\#include "../Misc/Master.h"} {public local
-}
-
decl {\#include "ResonanceUI.h"} {public local
}
@@ -50,19 +47,13 @@ decl {\#include <stdlib.h>} {private local
decl {\#include <string.h>} {private local
}
-decl {\#include "WidgetPDial.h"} {public local
-}
-
decl {\#include "Fl_Osc_Pane.H"} {public local
}
-decl {\#include "EnvelopeUI.h"} {public local
-}
-
-decl {\#include "LFOUI.h"} {public local
+decl {\#include "Fl_Osc_Dial.H"} {public local
}
-decl {\#include "FilterUI.h"} {public local
+decl {\#include "Fl_Osc_Choice.H"} {public local
}
decl {\#include "PresetsUI.h"} {public local
@@ -71,7 +62,7 @@ decl {\#include "PresetsUI.h"} {public local
decl {\#include <FL/fl_draw.H>} {public local
}
-class PSlider {open : {public Fl_Slider, public Fl_Osc_Widget}
+class PSlider {: {public Fl_Slider, public Fl_Osc_Widget}
} {
Function {PSlider(int x,int y, int w, int h, const char *label=0):Fl_Slider(x,y,w,h,label)} {open
} {
@@ -111,16 +102,16 @@ return(1);} {}
else
value(127-c);} {}
}
- decl {bool phase;} {selected public local
+ decl {bool phase;} {public local
}
}
-class Oscilharmonic {open : {public Fl_Group}
+class Oscilharmonic {: {public Fl_Group}
} {
Function {make_window()} {open private
} {
Fl_Window harmonic {open
- private xywh {398 719 100 225} type Double box NO_BOX
+ private xywh {461 756 100 225} type Double box NO_BOX
class Fl_Osc_Group visible
} {
Fl_Slider mag {
@@ -140,7 +131,6 @@ if (x==64) o->selection_color(0);
o->osc->requestValue(o->loc+"waveform");
display->redraw();
-oldosc->redraw();
if (cbwidget!=NULL) {
cbwidget->do_callback();
applybutton->color(FL_RED);
@@ -162,7 +152,6 @@ o->osc->requestValue(o->loc+"spectrum");
o->osc->requestValue(o->loc+"waveform");
display->redraw();
-oldosc->redraw();
if (cbwidget!=NULL) {
cbwidget->do_callback();
applybutton->color(FL_RED);
@@ -196,14 +185,13 @@ display=NULL;
applybutton=NULL;
cbwidget=NULL;} {}
}
- Function {init(int n_,Fl_Group *display_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *applybutton_, std::string loc_, Fl_Osc_Interface *osc_)} {open
+ Function {init(int n_,Fl_Group *display_,Fl_Widget *cbwidget_,Fl_Widget *applybutton_, std::string loc_, Fl_Osc_Interface *osc_)} {open
} {
code {assert(osc_);
assert(!loc_.empty());
n=n_;
display=display_;
-oldosc=oldosc_;
cbwidget=cbwidget_;
applybutton=applybutton_;
osc = osc_;
@@ -243,7 +231,7 @@ delete harmonic;} {}
}
decl {int n;} {private local
}
- decl {Fl_Widget *oldosc,*cbwidget,*applybutton;} {private local
+ decl {Fl_Widget *cbwidget,*applybutton;} {private local
}
decl {Fl_Osc_Interface *osc;} {private local
}
@@ -257,288 +245,285 @@ class OscilEditor {open : {public PresetsUI_}
} {
Fl_Window osceditUI {
label {ADsynth Oscillator Editor} open
- xywh {347 385 735 595} type Double
- code0 {if (oscil->ADvsPAD) o->label("PADsynth Harmonic Content Editor");} visible
+ xywh {67 214 735 595} type Double
+ code0 {//if (oscil->ADvsPAD) o->label("PADsynth Harmonic Content Editor");} visible
} {
Fl_Group dummy {open
- xywh {25 25 15 15} color 32 selection_color 71 labelcolor 179
- code0 {dummy->pane_name = loc;}
- code1 {dummy->osc = osc;}
+ xywh {0 0 735 595} box FLAT_BOX
class Fl_Osc_Group
- } {}
- Fl_Button applybutton {
- label Apply
- callback {applybutton->color(FL_GRAY);
+ } {
+ Fl_Button applybutton {
+ label Apply
+ callback {applybutton->color(FL_GRAY);
applybutton->redraw();
if (cbapplywidget!=NULL) {
cbapplywidget->do_callback();
cbapplywidget->color(FL_GRAY);
cbapplywidget->redraw();
};}
- xywh {300 280 60 20} box THIN_UP_BOX labelfont 1
- code0 {if (!oscil->ADvsPAD) o->hide();}
- }
- Fl_Group oscildisplaygroup {open
- xywh {5 5 360 300} box UP_FRAME
- } {
- Fl_Group {} {open
- xywh {10 85 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
- code0 {oscilo=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
- code1 {oscilo->parent(dummy);oscilo->init(false);}
- code2 {oscilo->activate();}
- } {}
- Fl_Box {} {
- label Oscillator
- xywh {120 10 110 20} labelfont 1
+ xywh {305 285 60 20} box THIN_UP_BOX labelfont 1
+ code0 {//if (!oscil->ADvsPAD) o->hide();}
+ code1 {dummy->pane_name = loc;}
+ code2 {dummy->osc = osc;}
}
- Fl_Value_Slider rndslider {
- label rnd
- callback {oscil->Prand=(int)o->value()+64;
-oscildisplaygroup->redraw();
-oldosc->redraw();}
- tooltip {Oscilator Phase Randomness: smaller than 0 is "group", larger than 0 is for each harmonic} xywh {140 285 100 10} type {Horz Knob} box NO_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1
- code0 {if (oscil->ADvsPAD) o->hide();}
- }
- Fl_Group {} {open
- xywh {10 30 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63
- code0 {oscils=new Fl_OscilSpectrum(o->x(),o->y(),o->w(),o->h(),"");}
- code1 {oscils->parent(dummy);oscils->init(false);}
- code2 {oscils->activate();}
- } {}
- Fl_Group {} {
- xywh {246 277 115 25} box UP_FRAME
- code0 {if (oscil->ADvsPAD) o->hide();}
+ Fl_Group oscildisplaygroup {open
+ xywh {10 10 360 300} box UP_FRAME
} {
- Fl_Choice hrndtype {
- label {H.rnd}
- callback {oscil->Pamprandtype=(int) o->value();}
- tooltip {Harmonic Amplitude Randomness} xywh {281 282 50 15} down_box BORDER_BOX labelsize 10 textsize 10
+ Fl_Group {} {open
+ xywh {15 90 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
+ code0 {oscilo=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
+ code1 {oscilo->parent(o);oscilo->init(false);}
+ } {}
+ Fl_Box {} {
+ label Oscillator
+ xywh {125 15 110 20} labelfont 1
+ }
+ Fl_Value_Slider rndslider {
+ label rnd
+ callback {//oscil->Prand=(int)o->value()+64;
+oscildisplaygroup->redraw();}
+ tooltip {Oscilator Phase Randomness: smaller than 0 is "group", larger than 0 is for each harmonic} xywh {145 290 100 10} type {Horz Knob} box NO_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1
+ code0 {//if (oscil->ADvsPAD) o->hide();}
+ }
+ Fl_Group {} {open
+ xywh {15 35 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63
+ code0 {oscils=new Fl_OscilSpectrum(o->x(),o->y(),o->w(),o->h(),"");}
+ code1 {oscils->parent(o);oscils->init(false);}
+ } {}
+ Fl_Group {} {
+ xywh {251 282 115 25} box UP_FRAME
+ code0 {//if (oscil->ADvsPAD) o->hide();}
+ } {
+ Fl_Choice hrndtype {
+ label {H.rnd}
+ callback {//oscil->Pamprandtype=(int) o->value();}
+ tooltip {Harmonic Amplitude Randomness} xywh {286 287 50 15} down_box BORDER_BOX labelsize 10 textsize 10
+ code0 {o->init("amprandtype");}
+ class Fl_Osc_Choice
+ } {
+ MenuItem {} {
+ label None
+ xywh {65 65 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Pow
+ xywh {75 75 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Sin
+ xywh {85 85 100 20} labelfont 1 labelsize 10
+ }
+ }
+ Fl_Dial hrnddial {
+ tooltip {Oscillator's spectrum adjust parameter} xywh {345 285 18 18} maximum 127 step 1
+ code0 {o->init("amprandpower");}
+ class Fl_Osc_Dial
+ }
+ }
+ Fl_Choice magtype {
+ label {Mag.Type}
+ callback {//oscil->Phmagtype=(int) o->value();
+basefuncdisplaygroup->redraw();
+
+redrawoscil();} selected
+ xywh {75 285 65 20} down_box BORDER_BOX labelsize 11 when 1 textsize 11
+ code0 {o->init("hmagtype");}
+ class Fl_Osc_Choice
} {
MenuItem {} {
- label None
- xywh {60 60 100 20} labelfont 1 labelsize 10
+ label Linear
+ xywh {10 10 100 20} labelfont 1 labelsize 11
}
MenuItem {} {
- label Pow
- xywh {70 70 100 20} labelfont 1 labelsize 10
+ label {-40dB}
+ xywh {20 20 100 20} labelfont 1 labelsize 11
}
MenuItem {} {
- label Sin
- xywh {80 80 100 20} labelfont 1 labelsize 10
+ label {-60dB}
+ xywh {30 30 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label {-80dB}
+ xywh {40 40 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label {-100dB}
+ xywh {50 50 100 20} labelfont 1 labelsize 11
}
- }
- Fl_Dial hrnddial {
- callback {oscil->Pamprandpower=(int) o->value();}
- tooltip {Oscillator's spectrum adjust parameter} xywh {338 280 18 18} maximum 127 step 1
- class WidgetPDial
}
}
- }
- Fl_Group basefuncdisplaygroup {open
- xywh {365 5 360 300} box UP_FRAME
- code0 {o->pane_name = loc;}
- code1 {o->osc = osc;}
- code2 {assert(osc);}
- class Fl_Osc_Group
- } {
- Fl_Group {} {
- xywh {370 85 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
- code0 {oscilo_base=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
- code1 {oscilo_base->parent(dummy);oscilo_base->init(true);}
- code2 {oscilo_base->activate();}
- } {}
- Fl_Dial bfslider {
- callback {oscil->Pbasefuncpar=(int)o->value()+64;
-basefuncdisplaygroup->redraw();
-bfparval->value(oscil->Pbasefuncpar-64);
-
-redrawoscil();}
- tooltip {Base Function Parameter} xywh {520 280 20 20} minimum -64 maximum 63 step 1
- class WidgetPDial
- }
- Fl_Choice bftype {
- label {Base.F..}
- callback {oscil->Pcurrentbasefunc=(int) o->value();
+ Fl_Group basefuncdisplaygroup {open
+ xywh {370 10 360 300} box UP_FRAME
+ code0 {o->pane_name = loc;}
+ code1 {o->osc = osc;}
+ code2 {assert(osc);}
+ class Fl_Osc_Group
+ } {
+ Fl_Group {} {
+ xywh {375 90 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
+ code0 {oscilo_base=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
+ code1 {oscilo_base->parent(o);oscilo_base->init(true);}
+ } {}
+ Fl_Dial bfslider {
+ callback {redrawoscil();}
+ tooltip {Base Function Parameter} xywh {525 285 20 20} minimum -64 maximum 63 step 1
+ code0 {o->init("basefuncpar");}
+ class Fl_Osc_Dial
+ }
+ Fl_Choice bftype {
+ label {Base.F..}
+ callback {//oscil->Pcurrentbasefunc=(int) o->value();
basefuncdisplaygroup->redraw();
redrawoscil();
-if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate();
- else basefuncmodulation->activate();}
- xywh {370 285 90 15} down_box BORDER_BOX labelsize 10 align 5 textsize 11
- } {
- MenuItem {} {
- label Sine
- xywh {10 10 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label Triangle
- xywh {20 20 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label Pulse
- xywh {30 30 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label Saw
- xywh {40 40 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label Power
- xywh {50 50 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label Gauss
- xywh {50 50 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label Diode
- xywh {60 60 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label AbsSine
- xywh {70 70 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label PulseSine
- xywh {80 80 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label StrchSine
- xywh {90 90 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label Chirp
- xywh {100 100 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label AbsStrSine
- xywh {102 102 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label Chebyshev
- xywh {112 112 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label Sqr
- xywh {122 122 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label Spike
- xywh {122 122 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label Circle
- xywh {122 122 100 20} labelfont 1 labelsize 11
- }
- }
- Fl_Box {} {
- label {Base Func.}
- xywh {480 10 110 20} labelfont 1
- }
- Fl_Group {} {open
- xywh {370 30 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63
- code0 {oscils_base=new Fl_OscilSpectrum (o->x(),o->y(),o->w(),o->h(),"");}
- code1 {oscils_base->parent(dummy);oscils_base->init(true);}
- code2 {oscils_base->activate();}
- } {}
- Fl_Value_Output bfparval {
- label {Par.}
- xywh {490 285 25 15} labelsize 12 minimum -63 maximum 63 step 1
- }
- Fl_Group basefuncmodulation {
- xywh {550 276 169 25} box UP_FRAME
- code0 {if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate();}
- } {
- Fl_Choice bfmodtype {
- label {B.F.Mod.}
- callback {oscil->Pbasefuncmodulation=(int) o->value();
-basefuncdisplaygroup->redraw();
-redrawoscil();}
- tooltip {Base function modulation} xywh {599 281 50 15} down_box BORDER_BOX labelsize 10 textsize 10
+//if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate();
+ //else basefuncmodulation->activate();}
+ xywh {375 290 90 15} down_box BORDER_BOX labelsize 10 align 5 when 1 textsize 11
+ code0 {o->init("currentbasefunc");}
+ class Fl_Osc_Choice
} {
MenuItem {} {
- label None
- xywh {50 50 100 20} labelfont 1 labelsize 10
+ label Sine
+ xywh {15 15 100 20} labelfont 1 labelsize 11
}
MenuItem {} {
- label Rev
- xywh {60 60 100 20} labelfont 1 labelsize 10
+ label Triangle
+ xywh {25 25 100 20} labelfont 1 labelsize 11
}
MenuItem {} {
- label Sine
- xywh {70 70 100 20} labelfont 1 labelsize 10
+ label Pulse
+ xywh {35 35 100 20} labelfont 1 labelsize 11
}
MenuItem {} {
- label Pow
- xywh {80 80 100 20} labelfont 1 labelsize 10
+ label Saw
+ xywh {45 45 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label Power
+ xywh {55 55 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label Gauss
+ xywh {55 55 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label Diode
+ xywh {65 65 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label AbsSine
+ xywh {75 75 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label PulseSine
+ xywh {85 85 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label StrchSine
+ xywh {95 95 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label Chirp
+ xywh {105 105 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label AbsStrSine
+ xywh {107 107 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label Chebyshev
+ xywh {117 117 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label Sqr
+ xywh {127 127 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label Spike
+ xywh {127 127 100 20} labelfont 1 labelsize 11
+ }
+ MenuItem {} {
+ label Circle
+ xywh {127 127 100 20} labelfont 1 labelsize 11
}
}
- Fl_Dial bfmodpar1 {
- callback {oscil->Pbasefuncmodulationpar1=(int)o->value();
-basefuncdisplaygroup->redraw();
-redrawoscil();}
- tooltip {Oscillator's modulation parameter 1} xywh {659 281 15 15} maximum 127 step 1
- class WidgetPDial
- }
- Fl_Dial bfmodpar2 {
- callback {oscil->Pbasefuncmodulationpar2=(int)o->value();
-basefuncdisplaygroup->redraw();
-redrawoscil();}
- tooltip {Oscillator's modulation parameter 2} xywh {679 281 15 15} maximum 127 step 1
- class WidgetPDial
- }
- Fl_Dial bfmodpar3 {
- callback {oscil->Pbasefuncmodulationpar3=(int)o->value();
+ Fl_Box {} {
+ label {Base Func.}
+ xywh {485 15 110 20} labelfont 1
+ }
+ Fl_Group {} {open
+ xywh {375 35 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63
+ code0 {oscils_base=new Fl_OscilSpectrum (o->x(),o->y(),o->w(),o->h(),"");}
+ code1 {oscils_base->parent(o);oscils_base->init(true);}
+ } {}
+ Fl_Value_Output bfparval {
+ label {Par.}
+ xywh {495 290 25 15} labelsize 12 minimum -63 maximum 63 step 1
+ }
+ Fl_Group basefuncmodulation {
+ xywh {555 281 169 25} box UP_FRAME
+ code0 {//if ((oscil->Pcurrentbasefunc==0)||(oscil->Pcurrentbasefunc==127)) basefuncmodulation->deactivate();}
+ } {
+ Fl_Choice bfmodtype {
+ label {B.F.Mod.}
+ callback {//oscil->Pbasefuncmodulation=(int) o->value();
basefuncdisplaygroup->redraw();
redrawoscil();}
- tooltip {Oscillator's modulation parameter 3} xywh {699 281 15 15} maximum 127 step 1
- class WidgetPDial
+ tooltip {Base function modulation} xywh {604 286 50 15} down_box BORDER_BOX labelsize 10 when 1 textsize 10
+ code0 {o->init("basefuncmodulation");}
+ class Fl_Osc_Choice
+ } {
+ MenuItem {} {
+ label None
+ xywh {55 55 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Rev
+ xywh {65 65 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Sine
+ xywh {75 75 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Pow
+ xywh {85 85 100 20} labelfont 1 labelsize 10
+ }
+ }
+ Fl_Dial bfmodpar1 {
+ callback {redrawoscil();}
+ tooltip {Oscillator's modulation parameter 1} xywh {664 286 15 15} maximum 127 step 1
+ code0 {o->init("basefuncmodulationpar1");}
+ class Fl_Osc_Dial
+ }
+ Fl_Dial bfmodpar2 {
+ callback {redrawoscil();}
+ tooltip {Oscillator's modulation parameter 2} xywh {684 286 15 15} maximum 127 step 1
+ code0 {o->init("basefuncmodulationpar2");}
+ class Fl_Osc_Dial
+ }
+ Fl_Dial bfmodpar3 {
+ callback {redrawoscil();}
+ tooltip {Oscillator's modulation parameter 3} xywh {704 286 15 15} maximum 127 step 1
+ code0 {o->init("basefunctionmodulationpar3");}
+ class Fl_Osc_Dial
+ }
}
}
- }
- Fl_Choice magtype {
- label {Mag.Type}
- callback {oscil->Phmagtype=(int) o->value();
-basefuncdisplaygroup->redraw();
-
-redrawoscil();}
- xywh {70 280 65 20} down_box BORDER_BOX labelsize 11 textsize 11
- } {
- MenuItem {} {
- label Linear
- xywh {0 0 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label {-40dB}
- xywh {10 10 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label {-60dB}
- xywh {20 20 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label {-80dB}
- xywh {30 30 100 20} labelfont 1 labelsize 11
- }
- MenuItem {} {
- label {-100dB}
- xywh {40 40 100 20} labelfont 1 labelsize 11
- }
- }
- Fl_Button {} {
- label {Use as base}
- callback {oscil->useasbase();
+ Fl_Button {} {
+ label {Use as base}
+ callback {//oscil->useasbase();
if (autoclearbutton->value()){
for (int i=0;i<MAX_AD_HARMONICS;i++){
h[i]->mag->value(64);
- oscil->Phmag[i]=64;
+ //oscil->Phmag[i]=64;
h[i]->phase->value(64);
- oscil->Phphase[i]=64;
+ //oscil->Phphase[i]=64;
};
- oscil->Phmag[0]=127;
+ //oscil->Phmag[0]=127;
- oscil->Pharmonicshift=0;
+ //oscil->Pharmonicshift=0;
harmonicshiftcounter->value(0);
h[0]->mag->value(0);
@@ -551,427 +536,433 @@ if (autoclearbutton->value()){
};
//pthread_mutex_lock(&master->mutex);
- for (int i=0;i<MAX_AD_HARMONICS;i++){
- if (oscil->Phmag[i]==64) h[i]->mag->selection_color(0);
- else h[i]->mag->selection_color(222);
- };
+// for (int i=0;i<MAX_AD_HARMONICS;i++){
+// if (oscil->Phmag[i]==64) h[i]->mag->selection_color(0);
+// else h[i]->mag->selection_color(222);
+// };
osc->requestValue(loc+"prepare");
//pthread_mutex_unlock(&master->mutex);
basefuncdisplaygroup->redraw();
redrawoscil();}
- tooltip {Use this Oscillator as base function} xywh {5 313 85 20} box THIN_UP_BOX labelfont 1 labelsize 11
- }
- Fl_Button {} {
- label Close
- callback {osceditUI->hide();}
- xywh {668 565 62 25} box THIN_UP_BOX
- }
- Fl_Button {} {
- label Clear
- callback {if (!fl_choice("Clear the harmonics settings?","No","Yes",NULL)) return;
+ tooltip {Use this Oscillator as base function} xywh {10 318 85 20} box THIN_UP_BOX labelfont 1 labelsize 11
+ }
+ Fl_Button {} {
+ label Close
+ callback {osceditUI->hide();}
+ xywh {673 570 62 25} box THIN_UP_BOX
+ }
+ Fl_Button {} {
+ label Clear
+ callback {if (!fl_choice("Clear the harmonics settings?","No","Yes",NULL)) return;
for (int i=0;i<MAX_AD_HARMONICS;i++){
h[i]->mag->value(64);
- oscil->Phmag[i]=64;
+ //oscil->Phmag[i]=64;
h[i]->phase->value(64);
- oscil->Phphase[i]=64;
+ //oscil->Phphase[i]=64;
};
-oscil->Phmag[0]=127;
+//oscil->Phmag[0]=127;
h[0]->mag->value(0);
-for (int i=0;i<MAX_AD_HARMONICS;i++){
- if (oscil->Phmag[i]==64) h[i]->mag->selection_color(0);
- else h[i]->mag->selection_color(222);
-};
+//for (int i=0;i<MAX_AD_HARMONICS;i++){
+// if (oscil->Phmag[i]==64) h[i]->mag->selection_color(0);
+// else h[i]->mag->selection_color(222);
+//};
//harmonics->redraw();
osc->requestValue(loc+"prepare");
redrawoscil();}
- xywh {670 505 55 15} box THIN_UP_BOX labelfont 1 labelsize 11
- }
- Fl_Group {} {
- xywh {135 308 150 30} box UP_FRAME
- } {
- Fl_Choice wshbutton {
- label {Wsh.}
- callback {oscil->Pwaveshapingfunction=(int) o->value();
-basefuncdisplaygroup->redraw();
-redrawoscil();} open
- tooltip {Waveshaping function} xywh {165 313 55 20} down_box BORDER_BOX labelsize 10 textsize 10
+ xywh {675 510 55 15} box THIN_UP_BOX labelfont 1 labelsize 11
+ }
+ Fl_Group {} {
+ xywh {140 313 150 30} box UP_FRAME
} {
- MenuItem {} {
- label None
- xywh {25 25 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Atan
- xywh {35 35 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Asym1
- xywh {45 45 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Pow
- xywh {55 55 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Sine
- xywh {65 65 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Qnts
- xywh {75 75 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Zigzg
- xywh {85 85 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Lmt
- xywh {95 95 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label LmtU
- xywh {105 105 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label LmtL
- xywh {115 115 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label ILmt
- xywh {127 127 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Clip
- xywh {137 137 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Asym2
- xywh {85 85 100 20} labelfont 1 labelsize 10
+ Fl_Choice wshbutton {
+ label {Wsh.}
+ callback {//oscil->Pwaveshapingfunction=(int) o->value();
+basefuncdisplaygroup->redraw();
+redrawoscil();}
+ tooltip {Waveshaping function} xywh {170 320 55 20} down_box BORDER_BOX labelsize 10 when 1 textsize 10
+ code0 {o->init("waveshapingfunction");}
+ class Fl_Osc_Choice
+ } {
+ MenuItem {} {
+ label None
+ xywh {30 30 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Atan
+ xywh {40 40 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Asym1
+ xywh {50 50 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Pow
+ xywh {60 60 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Sine
+ xywh {70 70 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Qnts
+ xywh {80 80 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Zigzg
+ xywh {90 90 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Lmt
+ xywh {100 100 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label LmtU
+ xywh {110 110 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label LmtL
+ xywh {120 120 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label ILmt
+ xywh {132 132 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Clip
+ xywh {142 142 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Asym2
+ xywh {90 90 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Pow2
+ xywh {100 100 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Sgm
+ xywh {95 95 100 20} labelfont 1 labelsize 10
+ }
}
- MenuItem {} {
- label Pow2
- xywh {95 95 100 20} labelfont 1 labelsize 10
+ Fl_Dial wshpar {
+ callback {redrawoscil();}
+ tooltip {Waveshaping Parameter} xywh {265 318 20 20} minimum -64 maximum 63 step 1
+ code0 {o->init("waveshaping");}
+ class Fl_Osc_Dial
}
- MenuItem {} {
- label Sgm
- xywh {90 90 100 20} labelfont 1 labelsize 10
+ Fl_Value_Output wsparval {
+ xywh {233 321 25 15} labelsize 12 minimum -63 maximum 63 step 1
}
}
- Fl_Dial wshpar {
- callback {oscil->Pwaveshaping=(int)o->value()+64;
-wsparval->value(oscil->Pwaveshaping-64);
-redrawoscil();}
- tooltip {Waveshaping Parameter} xywh {260 313 20 20} minimum -64 maximum 63 step 1
- class WidgetPDial
- }
- Fl_Value_Output wsparval {
- xywh {228 316 25 15} labelsize 12 minimum -63 maximum 63 step 1
+ Fl_Light_Button autoclearbutton {
+ label {Clr.}
+ tooltip {Auto clear when using the oscillator as base function} xywh {100 318 35 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10
}
- }
- Fl_Light_Button autoclearbutton {
- label {Clr.}
- tooltip {Auto clear when using the oscillator as base function} xywh {95 313 35 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10
- }
- Fl_Group {} {
- xywh {285 308 155 30} box UP_FRAME
- } {
- Fl_Choice fltbutton {
- label Filter
- callback {oscil->Pfiltertype=(int) o->value();
+ Fl_Group {} {
+ xywh {290 313 155 30} box UP_FRAME
+ } {
+ Fl_Choice fltbutton {
+ label Filter
+ callback {//oscil->Pfiltertype=(int) o->value();
redrawoscil();}
- tooltip {Oscillator's filter type} xywh {315 313 50 20} down_box BORDER_BOX labelsize 10 textsize 10
- } {
- MenuItem {} {
- label None
- xywh {35 35 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label LP1
- xywh {45 45 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label HP1a
- xywh {55 55 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label HP1b
- xywh {65 65 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label BP1
- xywh {75 75 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label BS1
- xywh {85 85 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label LP2
- xywh {55 55 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label HP2
- xywh {65 65 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label BP2
- xywh {65 65 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label BS2
- xywh {75 75 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Cos
- xywh {75 75 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Sin
- xywh {85 85 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label LSh
- xywh {95 95 100 20} labelfont 1 labelsize 10
+ tooltip {Oscillator's filter type} xywh {320 318 50 20} down_box BORDER_BOX labelsize 10 when 1 textsize 10
+ code0 {o->init("filtertype");}
+ class Fl_Osc_Choice
+ } {
+ MenuItem {} {
+ label None
+ xywh {40 40 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label LP1
+ xywh {50 50 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label HP1a
+ xywh {60 60 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label HP1b
+ xywh {70 70 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label BP1
+ xywh {80 80 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label BS1
+ xywh {90 90 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label LP2
+ xywh {60 60 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label HP2
+ xywh {70 70 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label BP2
+ xywh {70 70 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label BS2
+ xywh {80 80 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Cos
+ xywh {80 80 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Sin
+ xywh {90 90 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label LSh
+ xywh {100 100 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label S
+ xywh {110 110 100 20} labelfont 1 labelsize 10
+ }
}
- MenuItem {} {
- label S
- xywh {105 105 100 20} labelfont 1 labelsize 10
+ Fl_Dial filtervalue1 {
+ callback {redrawoscil();}
+ tooltip {Oscillator's filter parameter1} xywh {372 318 20 20} maximum 127 step 1
+ code0 {o->init("filterpar1");}
+ class Fl_Osc_Dial
}
- }
- Fl_Dial filtervalue1 {
- callback {oscil->Pfilterpar1=(int)o->value();
-
-redrawoscil();}
- tooltip {Oscillator's filter parameter1} xywh {367 313 20 20} maximum 127 step 1
- class WidgetPDial
- }
- Fl_Check_Button filterpref {
- label p
- callback {oscil->Pfilterbeforews=(int)o->value();
+ Fl_Check_Button filterpref {
+ label p
+ callback {//oscil->Pfilterbeforews=(int)o->value();
redrawoscil();}
- tooltip {Apply the filter before the waveshaping} xywh {415 313 20 20} down_box DOWN_BOX labelsize 10 align 24
- }
- Fl_Dial filtervalue2 {
- callback {oscil->Pfilterpar2=(int)o->value();
-
-redrawoscil();}
- tooltip {Oscillator's filter parameter2} xywh {392 313 20 20} maximum 127 step 1
- class WidgetPDial
- }
- }
- Fl_Group {} {
- xywh {590 308 135 30} box UP_FRAME
- } {
- Fl_Choice sabutton {
- label {Sp.adj.}
- callback {oscil->Psatype=(int) o->value();
-redrawoscil();}
- tooltip {Oscillator's spectrum adjust} xywh {630 313 60 20} down_box BORDER_BOX labelsize 10 textsize 10
- } {
- MenuItem {} {
- label None
- xywh {55 55 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Pow
- xywh {65 65 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label ThrsD
- xywh {75 75 100 20} labelfont 1 labelsize 10
+ tooltip {Apply the filter before the waveshaping} xywh {420 318 20 20} down_box DOWN_BOX labelsize 10 align 24
}
- MenuItem {} {
- label ThrsU
- xywh {85 85 100 20} labelfont 1 labelsize 10
+ Fl_Dial filtervalue2 {
+ callback {redrawoscil();}
+ tooltip {Oscillator's filter parameter2} xywh {395 318 20 20} maximum 127 step 1
+ code0 {o->init("filterpar2");}
+ class Fl_Osc_Dial
}
}
- Fl_Dial sadjpar {
- callback {oscil->Psapar=(int)o->value();
+ Fl_Group {} {
+ xywh {595 313 135 30} box UP_FRAME
+ } {
+ Fl_Choice sabutton {
+ label {Sp.adj.}
+ callback {//oscil->Psatype=(int) o->value();
redrawoscil();}
- tooltip {Oscillator's spectrum adjust parameter} xywh {695 313 20 20} maximum 127 step 1
- class WidgetPDial
+ tooltip {Oscillator's spectrum adjust} xywh {635 318 60 20} down_box BORDER_BOX labelsize 10 when 1 textsize 10
+ code0 {o->init("satype");}
+ class Fl_Osc_Choice
+ } {
+ MenuItem {} {
+ label None
+ xywh {60 60 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Pow
+ xywh {70 70 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label ThrsD
+ xywh {80 80 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label ThrsU
+ xywh {90 90 100 20} labelfont 1 labelsize 10
+ }
+ }
+ Fl_Dial sadjpar {
+ callback {redrawoscil();}
+ tooltip {Oscillator's spectrum adjust parameter} xywh {700 318 20 20} maximum 127 step 1
+ code0 {o->init("sapar");}
+ class Fl_Osc_Dial
+ }
}
- }
- Fl_Group {} {
- xywh {665 340 65 65} box UP_FRAME
- } {
- Fl_Counter harmonicshiftcounter {
- label {Harmonic Shift}
- callback {oscil->Pharmonicshift=(int)o->value();
+ Fl_Group {} {
+ xywh {670 345 65 65} box UP_FRAME
+ } {
+ Fl_Counter harmonicshiftcounter {
+ label {Harmonic Shift}
+ callback {//oscil->Pharmonicshift=(int)o->value();
redrawoscil();}
- xywh {670 365 55 15} type Simple labelsize 10 align 129 minimum -64 maximum 64 step 1 textfont 1 textsize 10
- }
- Fl_Check_Button harmonicshiftpre {
- label preH
- callback {oscil->Pharmonicshiftfirst=(int)o->value();
+ xywh {675 370 55 15} type Simple labelsize 10 align 129 minimum -64 maximum 64 step 1 textfont 1 textsize 10
+ }
+ Fl_Check_Button harmonicshiftpre {
+ label preH
+ callback {//oscil->Pharmonicshiftfirst=(int)o->value();
redrawoscil();}
- tooltip {Apply the harmonic shift before the waveshaping and filtering} xywh {690 385 34 15} down_box DOWN_BOX labelsize 10 align 24
- }
- Fl_Button {} {
- label R
- callback {oscil->Pharmonicshift=0;
+ tooltip {Apply the harmonic shift before the waveshaping and filtering} xywh {695 390 34 15} down_box DOWN_BOX labelsize 10 align 24
+ }
+ Fl_Button {} {
+ label R
+ callback {//oscil->Pharmonicshift=0;
harmonicshiftcounter->value(0);
redrawoscil();}
- xywh {670 385 20 15} box THIN_UP_BOX labelfont 1 labelsize 10
- }
- }
- Fl_Group {} {open
- xywh {665 410 65 90} box UP_FRAME
- } {
- Fl_Choice adhrtype {
- label {Adpt.Harm.}
- callback {oscil->Padaptiveharmonics=(int) o->value();
-redrawoscil();}
- tooltip {The type of the addaptive harmonics} xywh {670 425 55 15} down_box BORDER_BOX labelsize 10 align 129 when 6 textsize 10
- } {
- MenuItem {} {
- label OFF
- xywh {80 80 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label ON
- xywh {90 90 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label Square
- xywh {100 100 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label 2xSub
- xywh {110 110 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label 2xAdd
- xywh {120 120 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label 3xSub
- xywh {120 120 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label 3xAdd
- xywh {130 130 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label 4xSub
- xywh {130 130 100 20} labelfont 1 labelsize 10
- }
- MenuItem {} {
- label 4xAdd
- xywh {140 140 100 20} labelfont 1 labelsize 10
+ xywh {675 390 20 15} box THIN_UP_BOX labelfont 1 labelsize 10
}
}
- Fl_Dial adhrpow {
- label pow
- callback {oscil->Padaptiveharmonicspower=(int)o->value();
-redrawoscil();}
- tooltip {Adaptive harmonics power} xywh {700 460 25 25} labelsize 10 maximum 200 step 1
- class WidgetPDial
- }
- Fl_Dial adhrbf {
- label baseF
- callback {oscil->Padaptiveharmonicsbasefreq=(int)o->value();
+ Fl_Group {} {
+ xywh {670 415 65 90} box UP_FRAME
+ } {
+ Fl_Choice adhrtype {
+ label {Adpt.Harm.}
+ callback {//oscil->Padaptiveharmonics=(int) o->value();
redrawoscil();}
- tooltip {Adaptive harmonics base frequency} xywh {670 460 25 25} labelsize 10 maximum 255 step 1
- class WidgetPDial
- }
- Fl_Slider adhrpar {
- callback {oscil->Padaptiveharmonicspar=(int)o->value();
+ tooltip {The type of the addaptive harmonics} xywh {675 430 55 15} down_box BORDER_BOX labelsize 10 align 129 when 3 textsize 10
+ code0 {o->init("adaptiveharmonics");}
+ class Fl_Osc_Choice
+ } {
+ MenuItem {} {
+ label OFF
+ xywh {85 85 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label ON
+ xywh {95 95 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Square
+ xywh {105 105 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label 2xSub
+ xywh {115 115 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label 2xAdd
+ xywh {125 125 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label 3xSub
+ xywh {125 125 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label 3xAdd
+ xywh {135 135 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label 4xSub
+ xywh {135 135 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label 4xAdd
+ xywh {145 145 100 20} labelfont 1 labelsize 10
+ }
+ }
+ Fl_Dial adhrpow {
+ label pow
+ callback {redrawoscil();}
+ tooltip {Adaptive harmonics power} xywh {705 465 25 25} labelsize 10 maximum 200 step 1
+ code0 {o->init("adaptiveharmonicspower");}
+ class Fl_Osc_Dial
+ }
+ Fl_Dial adhrbf {
+ label baseF
+ callback {redrawoscil();}
+ tooltip {Adaptive harmonics base frequency} xywh {675 465 25 25} labelsize 10 maximum 255 step 1
+ code0 {o->init("adaptiveharmoicsbasefreq");}
+ class Fl_Osc_Dial
+ }
+ Fl_Slider adhrpar {
+ callback {//oscil->Padaptiveharmonicspar=(int)o->value();
redrawoscil();}
- xywh {670 445 55 10} type {Horz Knob} box NO_BOX maximum 100 step 1 value 50
+ xywh {675 450 55 10} type {Horz Knob} box NO_BOX maximum 100 step 1 value 50
+ }
}
- }
- Fl_Group {} {
- xywh {440 308 150 30} box UP_FRAME
- } {
- Fl_Choice modtype {
- label {Mod.}
- callback {oscil->Pmodulation=(int) o->value();
+ Fl_Group {} {
+ xywh {445 313 150 30} box UP_FRAME
+ } {
+ Fl_Choice modtype {
+ label {Mod.}
+ callback {//oscil->Pmodulation=(int) o->value();
redrawoscil();}
- tooltip modulation xywh {470 315 50 15} down_box BORDER_BOX labelsize 10 textsize 10
- } {
- MenuItem {} {
- label None
- xywh {60 60 100 20} labelfont 1 labelsize 10
+ tooltip modulation xywh {475 320 50 15} down_box BORDER_BOX labelsize 10 when 1 textsize 10
+ code0 {o->init("modtype");}
+ class Fl_Osc_Choice
+ } {
+ MenuItem {} {
+ label None
+ xywh {65 65 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Rev
+ xywh {75 75 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Sine
+ xywh {85 85 100 20} labelfont 1 labelsize 10
+ }
+ MenuItem {} {
+ label Pow
+ xywh {95 95 100 20} labelfont 1 labelsize 10
+ }
}
- MenuItem {} {
- label Rev
- xywh {70 70 100 20} labelfont 1 labelsize 10
+ Fl_Dial modpar1 {
+ callback {redrawoscil();}
+ tooltip {Oscillator's modulation parameter 1} xywh {535 320 15 15} maximum 127 step 1
+ code0 {o->init("modulationpar1");}
+ class Fl_Osc_Dial
}
- MenuItem {} {
- label Sine
- xywh {80 80 100 20} labelfont 1 labelsize 10
+ Fl_Dial modpar2 {
+ callback {redrawoscil();}
+ tooltip {Oscillator's modulation parameter 2} xywh {555 320 15 15} maximum 127 step 1
+ code0 {o->init("modulationpar2");}
+ class Fl_Osc_Dial
}
- MenuItem {} {
- label Pow
- xywh {90 90 100 20} labelfont 1 labelsize 10
+ Fl_Dial modpar3 {
+ callback {redrawoscil();}
+ tooltip {Oscillator's modulation parameter 3} xywh {575 320 15 15} maximum 127 step 1
+ code0 {o->init("modulationpar3");}
+ class Fl_Osc_Dial
}
}
- Fl_Dial modpar1 {
- callback {oscil->Pmodulationpar1=(int)o->value();
-
-redrawoscil();}
- tooltip {Oscillator's modulation parameter 1} xywh {530 315 15 15} maximum 127 step 1
- class WidgetPDial
- }
- Fl_Dial modpar2 {
- callback {oscil->Pmodulationpar2=(int)o->value();
-
-redrawoscil();}
- tooltip {Oscillator's modulation parameter 2} xywh {550 315 15 15} maximum 127 step 1
- class WidgetPDial
- }
- Fl_Dial modpar3 {
- callback {oscil->Pmodulationpar3=(int)o->value();
-redrawoscil();}
- tooltip {Oscillator's modulation parameter 3} xywh {570 315 15 15} maximum 127 step 1
- class WidgetPDial
- }
- }
- Fl_Button {} {
- label Sine
- callback {if (!fl_choice("Convert to SINE?","No","Yes",NULL)) return;
+ Fl_Button {} {
+ label Sine
+ callback {if (!fl_choice("Convert to SINE?","No","Yes",NULL)) return;
osc->requestValue(loc+"convert2sine");
redrawoscil();
refresh();}
- xywh {670 525 55 15} box THIN_UP_BOX labelfont 1 labelsize 11
- }
- Fl_Button {} {
- label C
- callback {presetsui->copy(oscil);}
- xywh {670 545 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
- }
- Fl_Button {} {
- label P
- callback {presetsui->paste(oscil,this);}
- xywh {700 545 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
- }
- Fl_Scroll _this_has_to_be_the_last {open
- xywh {5 340 660 250} type HORIZONTAL box FLAT_BOX
- } {
- Fl_Pack harmonics {open
- xywh {10 345 650 225} type HORIZONTAL
- code0 {for (int i=0;i<MAX_AD_HARMONICS;i++){h[i]=new Oscilharmonic(0,0,20,o->h(),"");h[i]->init(i,oscildisplaygroup,oldosc,cbwidget,applybutton,loc,osc);}}
- } {}
+ xywh {675 530 55 15} box THIN_UP_BOX labelfont 1 labelsize 11
+ }
+ Fl_Button {} {
+ label C
+ callback {//presetsui->copy(oscil);
+//TODO FIXME}
+ xywh {675 550 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
+ }
+ Fl_Button {} {
+ label P
+ callback {//presetsui->paste(oscil,this);
+//TODO FIXME}
+ xywh {705 550 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
+ }
+ Fl_Scroll _this_has_to_be_the_last {
+ xywh {10 345 660 250} type HORIZONTAL box FLAT_BOX
+ } {
+ Fl_Pack harmonics {open
+ xywh {15 350 650 225} type HORIZONTAL
+ code0 {for (int i=0;i<MAX_AD_HARMONICS;i++){h[i]=new Oscilharmonic(0,0,20,o->h(),"");h[i]->init(i,oscildisplaygroup,cbwidget,applybutton,loc,osc);}}
+ } {}
+ }
}
}
}
- Function {OscilEditor(OscilGen *oscil_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *cbapplywidget_, std::string loc_, Fl_Osc_Interface *osc_)} {open
+ Function {OscilEditor(Fl_Widget *cbwidget_,Fl_Widget *cbapplywidget_, std::string loc_, Fl_Osc_Interface *osc_)} {open
} {
code {assert(osc_);
assert(!loc_.empty());
-oscil=oscil_;
-oldosc=oldosc_;
cbwidget=cbwidget_;
cbapplywidget=cbapplywidget_;
osc = osc_;
@@ -997,76 +988,74 @@ delete oscilo;
delete oscilo_base;
delete oscils;
delete oscils_base;
-delete (osceditUI);} {}
+delete osceditUI;} {}
}
- Function {refresh()} {open
- } {
- code {magtype->value(oscil->Phmagtype);
-rndslider->value(oscil->Prand-64);
+ Function {refresh()} {} {
+ code {magtype->update();
+ ////rndslider->update();
-hrndtype->value(oscil->Pamprandtype);
-hrnddial->value(oscil->Pamprandpower);
+ ////hrndtype->update();
+ ////hrnddial->update();
-bftype->value(oscil->Pcurrentbasefunc);
-bfparval->value(oscil->Pbasefuncpar-64);
-bfslider->value(oscil->Pbasefuncpar-64);
+ ////bftype->update();
+ ////bfparval->update();
+ ////bfslider->update();
-bfmodtype->value(oscil->Pbasefuncmodulation);
-bfmodpar1->value(oscil->Pbasefuncmodulationpar1);
-bfmodpar2->value(oscil->Pbasefuncmodulationpar2);
-bfmodpar3->value(oscil->Pbasefuncmodulationpar3);
+ ////bfmodtype->update();
+ ////bfmodpar1->update();
+ ////bfmodpar2->update();
+ ////bfmodpar3->update();
-wshbutton->value(oscil->Pwaveshapingfunction);
-wsparval->value(oscil->Pwaveshaping-64);
-wshpar->value(oscil->Pwaveshaping-64);
+ ////wshbutton->update();
+ ////wsparval->update();
+ ////wshpar->update();
-fltbutton->value(oscil->Pfiltertype);
-filtervalue1->value(oscil->Pfilterpar1);
-filtervalue2->value(oscil->Pfilterpar2);
-filterpref->value(oscil->Pfilterbeforews);
+ ////fltbutton->update();
+ ////filtervalue1->update();
+ ////filtervalue2->update();
+ ////filterpref->update();
-modtype->value(oscil->Pmodulation);
-modpar1->value(oscil->Pmodulationpar1);
-modpar2->value(oscil->Pmodulationpar2);
-modpar3->value(oscil->Pmodulationpar3);
+ ////modtype->update();
+ ////modpar1->update();
+ ////modpar2->update();
+ ////modpar3->update();
-sabutton->value(oscil->Psatype);
-sadjpar->value(oscil->Psapar);
+ ////sabutton->update();
+ ////sadjpar->update();
-harmonicshiftcounter->value(oscil->Pharmonicshift);
-harmonicshiftpre->value(oscil->Pharmonicshiftfirst);
+ ////harmonicshiftcounter->update();
+ ////harmonicshiftpre->update();
-adhrtype->value(oscil->Padaptiveharmonics);
-adhrbf->value(oscil->Padaptiveharmonicsbasefreq);
-adhrpow->value(oscil->Padaptiveharmonicspower);
-adhrtype->value(oscil->Padaptiveharmonicspar);
+ ////adhrtype->update();
+ ////adhrbf->update();
+ ////adhrpow->update();
+ ////adhrtype->update();
-for (int i=0;i<MAX_AD_HARMONICS;i++) h[i]->refresh();
+ for (int i=0;i<MAX_AD_HARMONICS;i++) h[i]->refresh();
-osc->requestValue(loc+"prepare");
+ osc->requestValue(loc+"prepare");
-basefuncdisplaygroup->redraw();
+ basefuncdisplaygroup->redraw();
redrawoscil();} {}
}
Function {redrawoscil()} {open
} {
code {//get data from backend
+osc->requestValue(loc+"prepare");
oscilo->update();
oscils->update();
oscilo_base->update();
oscils_base->update();
-oscildisplaygroup->redraw();
-oldosc->redraw();
+//oscildisplaygroup->redraw();
+//basefuncdisplaygroup->redraw();
if (cbwidget!=NULL) {
cbwidget->do_callback();
applybutton->color(FL_RED);
applybutton->redraw();
};} {}
}
- decl {OscilGen *oscil;} {private local
- }
- decl {Fl_Widget *oldosc,*cbwidget,*cbapplywidget;} {private local
+ decl {Fl_Widget *cbwidget,*cbapplywidget;} {private local
}
decl {Oscilharmonic *h[MAX_AD_HARMONICS];} {private local
}
diff --git a/src/UI/PADnoteUI.fl b/src/UI/PADnoteUI.fl
@@ -259,7 +259,7 @@ make_window();} {}
} {
Fl_Window padnotewindow {
label {PAD synth Parameters} open
- xywh {306 484 535 435} type Double visible
+ xywh {252 515 535 435} type Double visible
} {
Fl_Tabs {} {
callback {if (o->value()!=harmonicstructuregroup) applybutton->hide();
@@ -441,7 +441,7 @@ cbwidget->do_callback();}
class WidgetPDial
}
}
- Fl_Group oscilgroup {
+ Fl_Group oscilgroup {open
xywh {100 155 270 135} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 align 6
code0 {osc=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
code1 {oscilgroup->pane_name = location+"oscil/"; oscilgroup->osc = osc_i;osc->init(false);//pars->oscilgen,master);}
@@ -450,14 +450,14 @@ cbwidget->do_callback();}
Fl_Button {} {
label Change
callback {if (oscui!=NULL) delete (oscui);
-oscui=new OscilEditor(pars->oscilgen,osc,cbwidget,applybutton,location+"oscil/",osc_i);}
+oscui=new OscilEditor(cbwidget,applybutton,location+"oscil/",osc_i);}
xywh {375 270 60 20} box THIN_UP_BOX labelfont 1 labelsize 11
}
Fl_Box cbwidget {
label {Harmonic Content}
callback {overtonepos->redraw();
applybutton->color(FL_RED);
-applybutton->redraw();}
+applybutton->redraw();} selected
xywh {125 135 205 20} align 16
}
Fl_Button {} {
@@ -989,7 +989,7 @@ if (oscui!=NULL) {
if (resui!=NULL) {
resui->applybutton->color(FL_GRAY);
resui->applybutton->redraw();
-};} selected
+};}
xywh {300 400 135 30} box THIN_UP_BOX
code0 {o->color(FL_RED);}
}
diff --git a/src/globals.h b/src/globals.h
@@ -27,7 +27,7 @@
#include <stdint.h>
//Forward declarations
-namespace rtosc{class Ports; class ThreadLink;};
+namespace rtosc{struct Ports; class ThreadLink;};
extern rtosc::ThreadLink *bToU;
extern rtosc::ThreadLink *uToB;
diff --git a/src/main.cpp b/src/main.cpp
@@ -79,6 +79,8 @@ char *instance_name = 0;
void exitprogram();
+extern int main_thread;
+
//cleanup on signaled exit
void sigterm_exit(int /*sig*/)
{
@@ -120,6 +122,7 @@ void exitprogram()
Nio::stop();
GUI::destroyUi(gui);
+ delete middleware;
#if LASH
if(lash)
delete lash;
@@ -135,6 +138,7 @@ void exitprogram()
int main(int argc, char *argv[])
{
+ main_thread = (long int)syscall(224);
synth = new SYNTH_T;
config.init();
dump.startnow();