zynaddsubfx

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

commit 49575847bbbc10dd05905bbd43ab6fe6f0f95eac
parent ff47364db4db9d3fe7534a89eaded6d77ee53f42
Author: fundamental <[email protected]>
Date:   Mon, 12 Aug 2013 11:33:49 -0400

Enhance Exposed Metadata

- Increases the size of the liblo buffer as messages around 17kib
  have been observed
- Prefers some of the rtosc port sugar methods
- Updates existing methods with rDoc macro
- Updates Util.h implementation of ports with expanded metadata strings

Diffstat:
Msrc/Misc/Master.cpp | 24++++++++++++------------
Msrc/Misc/MiddleWare.cpp | 10++++------
Msrc/Misc/Part.cpp | 10+++++-----
Msrc/Misc/Util.h | 12++++++------
4 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp @@ -46,20 +46,20 @@ using namespace rtosc; #define rObject Master static Ports localports = { - RECURSP(Master, Part, part, part, 16, "Part"),//NUM_MIDI_PARTS - RECURSP(Master, EffectMgr, sysefx, sysefx, 4, "System Effect"),//NUM_SYS_EFX - RECURSP(Master, EffectMgr, insefx, insefx, 8, "Insertion Effect"),//NUM_INS_EFX + rRecursp(part, 16, "Part"),//NUM_MIDI_PARTS + rRecursp(sysefx, 4, "System Effect"),//NUM_SYS_EFX + rRecursp(insefx, 8, "Insertion Effect"),//NUM_INS_EFX rRecur(microtonal, "Micrtonal Mapping Functionality"), rParam(Pkeyshift, "Global Key Shift"), {"echo", "=documentation\0:Hidden port to echo messages\0", 0, [](const char *m, RtData&) { bToU->raw_write(m-1);}}, - {"get-vu", "", 0, [](const char *, RtData &d) { + {"get-vu", rDoc("Grab VU Data"), 0, [](const char *, RtData &d) { Master *m = (Master*)d.obj; bToU->write("/vu-meter", "bb", sizeof(m->vu), &m->vu, sizeof(float)*NUM_MIDI_PARTS, m->vuoutpeakpart);}}, - {"reset-vu", "", 0, [](const char *, RtData &d) { + {"reset-vu", rDoc("Grab VU Data"), 0, [](const char *, RtData &d) { Master *m = (Master*)d.obj; m->vuresetpeaks();}}, - {"load-part:ib", "", 0, [](const char *msg, RtData &d) { + {"load-part:ib", rProp(internal) rDoc("Load Part From Middleware"), 0, [](const char *msg, RtData &d) { Master *m = (Master*)d.obj; Part *p = *(Part**)rtosc_argument(msg, 1).b.data; int i = rtosc_argument(msg, 0).i; @@ -67,7 +67,7 @@ static Ports localports = { d.reply("/free", "sb", "Part", sizeof(void*), &m->part[i]); m->part[i] = p; printf("part %d is now pointer %p\n", i, p);}}, - {"volume::c", "", 0, + {"volume::c", rDoc("Master Volume"), 0, [](const char *m, rtosc::RtData &d) { if(rtosc_narguments(m)==0) { d.reply(d.loc, "c", ((Master*)d.obj)->Pvolume); @@ -79,27 +79,27 @@ static Ports localports = { printf("sets volume to value %d\n", ((Master*)d.obj)->Pvolume); d.broadcast(d.loc, "c", ((Master*)d.obj)->Pvolume);}}}, - {"noteOn:ccc", "", 0, + {"noteOn:ccc", rDoc("Noteon Event"), 0, [](const char *m,RtData &d){ Master *M = (Master*)d.obj; M->noteOn(rtosc_argument(m,0).i,rtosc_argument(m,1).i,rtosc_argument(m,2).i);}}, - {"noteOff:cc", "", 0, + {"noteOff:cc", rDoc("Noteoff Event"), 0, [](const char *m,RtData &d){ Master *M = (Master*)d.obj; M->noteOff(rtosc_argument(m,0).i,rtosc_argument(m,1).i);}}, - {"setController:ccc", "", 0, + {"setController:ccc", rDoc("MIDI CC Event"), 0, [](const char *m,RtData &d){ Master *M = (Master*)d.obj; M->setController(rtosc_argument(m,0).i,rtosc_argument(m,1).i,rtosc_argument(m,2).i);}}, - {"register:iis","", 0, + {"register:iis", rDoc("MIDI Mapping Registration"), 0, [](const char *m,RtData &d){ Master *M = (Master*)d.obj; M->midi.addElm(rtosc_argument(m,0).i, rtosc_argument(m,1).i,rtosc_argument(m,2).s);}}, - {"learn:s", "", 0, + {"learn:s", rDoc("Begin Learning for specified address"), 0, [](const char *m, RtData &d){ Master *M = (Master*)d.obj; printf("learning '%s'\n", rtosc_argument(m,0).s); diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp @@ -44,8 +44,8 @@ void path_search(const char *m) using rtosc::Port; //assumed upper bound of 32 ports (may need to be resized) - char types[65]; - rtosc_arg_t args[64]; + char types[129]; + rtosc_arg_t args[128]; size_t pos = 0; const Ports *ports = NULL; const char *str = rtosc_argument(m,0).s; @@ -68,7 +68,6 @@ void path_search(const char *m) for(const Port &p:*ports) { if(strstr(p.name, needle)!=p.name) continue; - printf("Reporting '%s'\n", p.name); types[pos] = 's'; args[pos++].s = p.name; types[pos] = 'b'; @@ -84,10 +83,9 @@ void path_search(const char *m) } - //Reply to requester - char buffer[1024*4]; + //Reply to requester [wow, these messages are getting huge...] + char buffer[1024*20]; size_t length = rtosc_amessage(buffer, sizeof(buffer), "/paths", types, args); - printf("ARG COUNT = %d\n", rtosc_narguments(buffer)); if(length) { lo_message msg = lo_message_deserialise((void*)buffer, length, NULL); lo_address addr = lo_address_new_from_url(last_url.c_str()); diff --git a/src/Misc/Part.cpp b/src/Misc/Part.cpp @@ -45,8 +45,8 @@ using rtosc::RtData; #define rObject Part static Ports partPorts = { - RECURS(Part, Part::Kit, kit, kit, 16, "Kit"),//NUM_KIT_ITEMS - RECURSP(Part, EffectMgr, partefx, partefx, 3, "Part Effect"), + rRecurs(kit, 16, "Kit"),//NUM_KIT_ITEMS + rRecursp(partefx, 3, "Part Effect"), rRecur(ctl, "Controller"), rToggle(Penabled, "Part enable"), rParam(Pvolume, "Part Volume"), @@ -90,9 +90,9 @@ static Ports partPorts = { #undef rObject #define rObject Part::Kit static Ports kitPorts = { - RECURP(Part::Kit, PADnoteParameters, padpars, padpars, "Padnote parameters"), - RECURP(Part::Kit, ADnoteParameters, adpars, adpars, "Adnote parameters"), - RECURP(Part::Kit, SUBnoteParameters, subpars, subpars, "Adnote parameters"), + rRecurp(padpars, "Padnote parameters"), + rRecurp(adpars, "Adnote parameters"), + rRecurp(subpars, "Adnote parameters"), rToggle(Penabled, "Kit item enable"), rToggle(Pmuted, "Kit item mute"), rParam(Pminkey, "Kit item min key"), diff --git a/src/Misc/Util.h b/src/Misc/Util.h @@ -149,7 +149,7 @@ const char *message_snip(const char *m); ///floating point parameter - with lookup code #define PARAMF(type, var, name, scale, _min, _max, desc) \ -{#name"::f", #scale "," # _min "," #_max ":'parameter':" desc, 0, \ +{#name"::f", ":parameter\0:documentation\0=" desc "\0", 0, \ [](const char *m, rtosc::RtData &d) { \ if(rtosc_narguments(m)==0) {\ d.reply(d.loc, "f", ((type*)d.obj)->var); \ @@ -159,7 +159,7 @@ const char *message_snip(const char *m); ///character parameter - with lookup code #define PARAMC(type, var, name, desc) \ -{#name"::c", ":'old-param':" desc, 0, \ +{#name"::c", ":parameter\0:old-param\0:documentation\0=" desc"\0", 0, \ [](const char *m, rtosc::RtData &d) { \ if(rtosc_narguments(m)==0) {\ d.reply(d.loc, "c", ((type*)d.obj)->var); \ @@ -169,13 +169,13 @@ const char *message_snip(const char *m); ///Recur - perform a simple recursion #define RECUR(type, cast, name, var, desc) \ -{#name"/", ":'recursion':" desc, &cast::ports, [](const char *m, rtosc::RtData &d){\ +{#name"/", ":recursion\0:documentation\0=" desc"\0", &cast::ports, [](const char *m, rtosc::RtData &d){\ d.obj = &(((type*)d.obj)->var); \ cast::ports.dispatch(message_snip(m), d);}} ///Recurs - perform a ranged recursion #define RECURS(type, cast, name, var, length, desc) \ -{#name "#" #length "/", ":'recursion':" desc, &cast::ports, \ +{#name "#" #length "/", ":recursion\0:documentation\0=" desc"\0", &cast::ports, \ [](const char *m, rtosc::RtData &d){ \ const char *mm = m; \ while(!isdigit(*mm))++mm; \ @@ -184,13 +184,13 @@ const char *message_snip(const char *m); ///Recur - perform a simple recursion (on pointer member) #define RECURP(type, cast, name, var, desc) \ -{#name"/", ":'recursion':" desc, &cast::ports, [](const char *m, rtosc::RtData &d){\ +{#name"/", ":recursion\0:documentation\0=" desc"\0", &cast::ports, [](const char *m, rtosc::RtData &d){\ d.obj = (((type*)d.obj)->var); \ cast::ports.dispatch(message_snip(m), d);}} ///Recurs - perform a ranged recursion (on pointer array member) #define RECURSP(type, cast, name, var, length, desc) \ -{#name "#" #length "/", ":'recursion':" desc, &cast::ports, \ +{#name "#" #length "/", ":recursion\0:documentation\0=" desc"\0", &cast::ports, \ [](const char *m, rtosc::RtData &d){ \ const char *mm = m; \ while(!isdigit(*mm))++mm; \