commit d4172aa05a689df211238ce56f12540fabff47c2
parent 95c635e9ccdc91265d9f57050354a34d584db7f8
Author: fundamental <[email protected]>
Date: Sun, 1 Nov 2015 13:07:04 -0500
Midi Learn: Cleanup Extra Debug Info
Diffstat:
5 files changed, 57 insertions(+), 36 deletions(-)
diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp
@@ -357,8 +357,10 @@ void Master::applyOscEvent(const char *msg)
}
ports.dispatch(msg, d, true);
- if(d.matches == 0 || d.forwarded)
+ if(d.matches == 0 && !d.forwarded)
fprintf(stderr, "Unknown path '%s:%s'\n", msg, rtosc_argument_string(msg));
+ if(d.forwarded)
+ bToU->raw_write(msg);
}
void Master::defaults()
diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp
@@ -324,7 +324,6 @@ struct NonRtObjStore
}
void handlePad(const char *msg, rtosc::RtData &d) {
string obj_rl(d.message, msg);
- printf("object resource locator = <%s>\n", obj_rl.c_str());
void *pad = get(obj_rl);
assert(pad);
strcpy(d.loc, obj_rl.c_str());
@@ -703,6 +702,23 @@ class MwDataObj:public rtosc::RtData
};
//virtual void broadcast(const char *path, const char *args, ...){(void)path;(void)args;};
//virtual void broadcast(const char *msg){(void)msg;};
+
+ virtual void chain(const char *msg) override
+ {
+ assert(msg);
+ printf("chain call on <%s>\n", msg);
+ mwi->handleMsg(msg);
+ }
+
+ virtual void chain(const char *path, const char *args, ...) override
+ {
+ assert(path);
+ va_list va;
+ va_start(va,args);
+ rtosc_vmessage(buffer,4*4096,path,args,va);
+ chain(buffer);
+ va_end(va);
+ }
virtual void forward(const char *) override
{
@@ -861,33 +877,27 @@ rtosc::Ports bankPorts = {
static rtosc::Ports middwareSnoopPorts = {
{"part#16/kit#8/adpars/VoicePar#8/OscilSmp/", 0, &OscilGen::non_realtime_ports,
rBegin;
- printf("snoop for oscilsmp\n");
impl.obj_store.handleOscil(chomp(chomp(chomp(chomp(chomp(msg))))), d);
rEnd},
{"part#16/kit#8/adpars/VoicePar#8/FMSmp/", 0, &OscilGen::non_realtime_ports,
rBegin
- printf("snoop for fmsmp\n");
impl.obj_store.handleOscil(chomp(chomp(chomp(chomp(chomp(msg))))), d);
rEnd},
{"part#16/kit#8/padpars/", 0, &PADnoteParameters::non_realtime_ports,
rBegin
- printf("snoop for padpars\n");
impl.obj_store.handlePad(chomp(chomp(chomp(msg))), d);
rEnd},
{"bank/", 0, &bankPorts,
rBegin;
- printf("bank port\n");
d.obj = &impl.master->bank;
bankPorts.dispatch(chomp(msg),d);
rEnd},
{"config/", 0, &Config::ports,
rBegin;
- printf("config port\n");
d.obj = impl.config;
Config::ports.dispatch(chomp(msg), d);
rEnd},
{"presets/", 0, &real_preset_ports, [](const char *msg, RtData &d) {
- printf("presets port\n");
MiddleWareImpl *obj = (MiddleWareImpl*)d.obj;
d.obj = (void*)obj->parent;
real_preset_ports.dispatch(chomp(msg), d);
@@ -895,11 +905,9 @@ static rtosc::Ports middwareSnoopPorts = {
d.reply("/damage", "s", rtosc_argument(msg, 0).s);
}},
{"io/", 0, &Nio::ports, [](const char *msg, RtData &d) {
- printf("io port\n");
Nio::ports.dispatch(chomp(msg), d);}},
{"part*/kit*/{Padenabled,Ppadenabled,Psubenabled}:T:F", 0, 0,
rBegin;
- printf("enable engine port...\n");
impl.kitEnable(msg);
d.forward();
rEnd},
@@ -962,7 +970,6 @@ static rtosc::Ports middwareSnoopPorts = {
rEnd},
{"part#16/clear:", 0, 0,
rBegin;
- printf("clear part port...\n");
impl.loadClearPart(extractInt(msg));
rEnd},
{"undo:", 0, 0,
@@ -1027,7 +1034,7 @@ static rtosc::Ports middlewareReplyPorts = {
impl.midi_mapper.useFreeID(rtosc_argument(msg, 0).i);
rEnd},
{"broadcast:", 0, 0, rBegin; impl.broadcast = true; rEnd},
- {"foward:", 0, 0, rBegin; impl.forward = true; rEnd},
+ {"forward:", 0, 0, rBegin; impl.forward = true; rEnd},
};
#undef rBegin
#undef rEnd
@@ -1212,15 +1219,15 @@ void MiddleWareImpl::bToUhandle(const char *rtmsg)
assert(strcmp(rtmsg, "/ze_state"));
//Dump Incomming Events For Debugging
- if(strcmp(rtmsg, "/vu-meter") && true) {
+ if(strcmp(rtmsg, "/vu-meter") && false) {
fprintf(stdout, "%c[%d;%d;%dm", 0x1B, 0, 1 + 30, 0 + 40);
- fprintf(stdout, "frontend: '%s'<%s>\n", rtmsg,
- rtosc_argument_string(rtmsg));
+ fprintf(stdout, "frontend[%c]: '%s'<%s>\n", forward?'f':broadcast?'b':'N',
+ rtmsg, rtosc_argument_string(rtmsg));
fprintf(stdout, "%c[%d;%d;%dm", 0x1B, 0, 7 + 30, 0 + 40);
}
//Activity dot
- printf(".");fflush(stdout);
+ //printf(".");fflush(stdout);
MwDataObj d(this);
middlewareReplyPorts.dispatch(rtmsg, d, true);
@@ -1277,7 +1284,7 @@ void MiddleWareImpl::kitEnable(const char *msg)
void MiddleWareImpl::kitEnable(int part, int kit, int type)
{
- printf("attempting a kit enable<%d,%d,%d>\n", part, kit, type);
+ //printf("attempting a kit enable<%d,%d,%d>\n", part, kit, type);
string url = "/part"+to_s(part)+"/kit"+to_s(kit)+"/";
void *ptr = NULL;
if(type == 0 && kits.add[part][kit] == NULL) {
@@ -1314,7 +1321,7 @@ void MiddleWareImpl::handleMsg(const char *msg)
assert(strcmp(msg, "/sysefx0preset"));
assert(strcmp(msg, "Psysefxvol0/part0"));
- if(strcmp("/get-vu", msg)) {
+ if(strcmp("/get-vu", msg) && false) {
fprintf(stdout, "%c[%d;%d;%dm", 0x1B, 0, 6 + 30, 0 + 40);
fprintf(stdout, "middleware: '%s':%s\n", msg, rtosc_argument_string(msg));
fprintf(stdout, "%c[%d;%d;%dm", 0x1B, 0, 7 + 30, 0 + 40);
@@ -1332,12 +1339,13 @@ void MiddleWareImpl::handleMsg(const char *msg)
//A message unmodified by snooping
if(d.matches == 0 || d.forwarded) {
- if(strcmp("/get-vu", msg)) {
- printf("Message Continuing on<%s:%s>...\n", msg, rtosc_argument_string(msg));
- }
+ //if(strcmp("/get-vu", msg)) {
+ // printf("Message Continuing on<%s:%s>...\n", msg, rtosc_argument_string(msg));
+ //}
uToB->raw_write(msg);
- } else
- printf("Message Handled<%s:%s>...\n", msg, rtosc_argument_string(msg));
+ } else {
+ //printf("Message Handled<%s:%s>...\n", msg, rtosc_argument_string(msg));
+ }
}
void MiddleWareImpl::write(const char *path, const char *args, ...)
diff --git a/src/Params/ADnoteParameters.cpp b/src/Params/ADnoteParameters.cpp
@@ -50,6 +50,8 @@ static const Ports voicePorts = {
data.obj = obj->OscilSmp;
SNIP
OscilGen::realtime_ports.dispatch(msg, data);
+ if(data.matches == 0)
+ data.forward();
rBOIL_END},
{"FMSmp/", rDoc("Modulating Oscillator"),
&OscilGen::ports,
@@ -58,6 +60,8 @@ static const Ports voicePorts = {
data.obj = obj->FMSmp;
SNIP
OscilGen::realtime_ports.dispatch(msg, data);
+ if(data.matches == 0)
+ data.forward();
rBOIL_END},
rRecurp(FreqLfo, "Frequency LFO"),
rRecurp(AmpLfo, "Amplitude LFO"),
diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp
@@ -94,7 +94,7 @@ const rtosc::Ports OscilGen::non_realtime_ports = {
//TODO update to rArray and test
- {"phase#128::c", rProp(parameter) rDoc("Sets harmonic phase"),
+ {"phase#128::c:i", rProp(parameter) rLinear(0,127) rDoc("Sets harmonic phase"),
NULL, [](const char *m, rtosc::RtData &d) {
const char *mm = m;
while(*mm && !isdigit(*mm)) ++mm;
@@ -105,7 +105,7 @@ const rtosc::Ports OscilGen::non_realtime_ports = {
phase = rtosc_argument(m,0).i;
}},
//TODO update to rArray and test
- {"magnitude#128::c", rProp(parameter) rDoc("Sets harmonic magnitude"),
+ {"magnitude#128::c:i", rProp(parameter) rLinear(0,127) rDoc("Sets harmonic magnitude"),
NULL, [](const char *m, rtosc::RtData &d) {
//printf("I'm at '%s'\n", d.loc);
const char *mm = m;
@@ -113,8 +113,20 @@ const rtosc::Ports OscilGen::non_realtime_ports = {
unsigned char &mag = ((OscilGen*)d.obj)->Phmag[atoi(mm)];
if(!rtosc_narguments(m))
d.reply(d.loc, "c", mag);
- else
+ else {
mag = rtosc_argument(m,0).i;
+ printf("setting magnitude\n\n");
+ //XXX hack hack
+ char *repath = strdup(d.loc);
+ char *edit = rindex(repath, '/')+1;
+ strcpy(edit, "prepare");
+ OscilGen &o = *((OscilGen*)d.obj);
+ fft_t *data = new fft_t[o.synth.oscilsize / 2];
+ o.prepare(data);
+ fprintf(stderr, "sending '%p' of fft data\n", data);
+ d.chain(repath, "b", sizeof(fft_t*), &data);
+ o.pendingfreqs = data;
+ }
}},
{"base-spectrum:", rProp(non-realtime) rDoc("Returns spectrum of base waveshape"),
NULL, [](const char *, rtosc::RtData &d) {
@@ -148,7 +160,6 @@ const rtosc::Ports OscilGen::non_realtime_ports = {
}},
{"waveform:", rProp(non-realtime) rDoc("Returns waveform points"),
NULL, [](const char *, rtosc::RtData &d) {
- printf("WAVEFORM PORT REPORTING IN\n");
OscilGen &o = *((OscilGen*)d.obj);
const unsigned n = o.synth.oscilsize;
float *smps = new float[n];
@@ -165,8 +176,8 @@ const rtosc::Ports OscilGen::non_realtime_ports = {
OscilGen &o = *(OscilGen*)d.obj;
fft_t *data = new fft_t[o.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);
+ fprintf(stderr, "sending '%p' of fft data\n", data);
+ d.chain(d.loc, "b", sizeof(fft_t*), &data);
o.pendingfreqs = data;
}},
{"convert2sine:", rProp(non-realtime) rDoc("Translates waveform into FS"),
@@ -176,10 +187,6 @@ const rtosc::Ports OscilGen::non_realtime_ports = {
{"use-as-base:", rProp(non-realtime) rDoc("Translates current waveform into base"),
NULL, [](const char *, rtosc::RtData &d) {
((OscilGen*)d.obj)->useasbase();
- }},
- {"prepare:b", rProp(internal) rProp(realtime) rProp(pointer) rDoc("Sets prepared fft data"),
- NULL, [](const char *m, rtosc::RtData &d) {
- assert(false && "wrong thread...");
}}};
#define rForwardCb [](const char *msg, rtosc::RtData &d) {\
@@ -203,7 +210,7 @@ const rtosc::Ports OscilGen::realtime_ports{
"Adaptive Harmonics Postprocessing Power"),
{"prepare:b", rProp(internal) rProp(realtime) rProp(pointer) rDoc("Sets prepared fft data"),
NULL, [](const char *m, rtosc::RtData &d) {
- //fprintf(stderr, "prepare:b got a message from '%s'\n", m);
+ 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*));
d.reply("/free", "sb", "fft_t", sizeof(void*), &o.oscilFFTfreqs);
diff --git a/src/UI/OscilGenUI.fl b/src/UI/OscilGenUI.fl
@@ -121,7 +121,7 @@ class Oscilharmonic {: {public Fl_Group}
display->redraw();}
xywh {0 15 15 115} type {Vert Knob} box NO_BOX selection_color 222 maximum 127 step 1 value 64
- code0 {o->phase=false;//o->value(127-oscil->Phmag[n]);}
+ code0 {o->phase=false;o->ext = "magnitude"+to_s(n);//o->value(127-oscil->Phmag[n]);}
code1 {//if (oscil->Phmag[n]==64) o->selection_color(0);}
class OGSlider
}
@@ -134,7 +134,7 @@ o->osc->requestValue(o->loc+"waveform");
display->redraw();}
xywh {0 135 15 75} type {Vert Knob} box NO_BOX selection_color 222 maximum 127 step 1 value 64
- code0 {o->phase=true;//o->value(oscil->Phphase[n]);}
+ code0 {o->phase=true;o->ext = "phase"+to_s(n);//o->value(oscil->Phphase[n]);}
class OGSlider
}
Fl_Box {} {