13
0

OSC-debug: print argument

This commit is contained in:
Robin Gareus 2016-01-15 00:57:33 +01:00
parent 919feac5f7
commit 6a6f414fc0
2 changed files with 63 additions and 4 deletions

View File

@ -618,7 +618,7 @@ OSC::_catchall (const char *path, const char *types, lo_arg **argv, int argc, vo
}
int
OSC::catchall (const char *path, const char* /*types*/, lo_arg **argv, int argc, lo_message msg)
OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg)
{
size_t len;
int ret = 1; /* unhandled */
@ -679,12 +679,70 @@ OSC::catchall (const char *path, const char* /*types*/, lo_arg **argv, int argc,
}
if ((ret && _debugmode == Unhandled) || _debugmode == All) {
PBD::info << "Unhandled OSC message: " << path << endmsg;
debugmsg (_("Unhandled OSC message"), path, types, argv, argc);
}
return ret;
}
void
OSC::debugmsg (const char *prefix, const char *path, const char* types, lo_arg **argv, int argc)
{
std::stringstream ss;
for (int i = 0; i < argc; ++i) {
lo_type type = (lo_type)types[i];
ss << " ";
switch (type) {
case LO_INT32:
ss << "i:" << argv[i]->i;
break;
case LO_FLOAT:
ss << "f:" << argv[i]->f;
break;
case LO_DOUBLE:
ss << "d:" << argv[i]->d;
break;
case LO_STRING:
ss << "s:" << &argv[i]->s;
break;
case LO_INT64:
ss << "h:" << argv[i]->h;
break;
case LO_CHAR:
ss << "c:" << argv[i]->s;
break;
case LO_TIMETAG:
ss << "<Timetag>";
break;
case LO_BLOB:
ss << "<BLOB>";
break;
case LO_TRUE:
ss << "#T";
break;
case LO_FALSE:
ss << "#F";
break;
case LO_NIL:
ss << "NIL";
break;
case LO_INFINITUM:
ss << "#inf";
break;
case LO_MIDI:
ss << "<MIDI>";
break;
case LO_SYMBOL:
ss << "<SYMBOL>";
break;
default:
ss << "<??>";
break;
}
}
PBD::info << prefix << ": " << path << ss.str() << endmsg;
}
void
OSC::update_clock ()
{

View File

@ -143,14 +143,14 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
#define OSC_DEBUG \
if (_debugmode == All) { \
PBD::info << "OSC: " << path << " " << types << endmsg; \
debugmsg (dgettext(PACKAGE, "OSC"), path, types, argv, argc); \
}
#define PATH_CALLBACK_MSG(name) \
static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
} \
int cb_ ## name (const char *path, const char *types, lo_arg **, int, void *data) { \
int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
OSC_DEBUG; \
name (data); \
return 0; \
@ -282,6 +282,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
typedef std::list<OSCRouteObserver*> RouteObservers;
RouteObservers route_observers;
void debugmsg (const char *prefix, const char *path, const char* types, lo_arg **argv, int argc);
static OSC* _instance;