summaryrefslogtreecommitdiff
path: root/libs/surfaces
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-01-15 00:57:33 +0100
committerRobin Gareus <robin@gareus.org>2016-01-15 00:57:33 +0100
commit6a6f414fc018a84ae53422397e4f50d80715f936 (patch)
tree3f831f33d5e49ed57b073c374993b3cbace00f4f /libs/surfaces
parent919feac5f7398b718a612e357dd1567c214e0a5c (diff)
OSC-debug: print argument
Diffstat (limited to 'libs/surfaces')
-rw-r--r--libs/surfaces/osc/osc.cc62
-rw-r--r--libs/surfaces/osc/osc.h5
2 files changed, 63 insertions, 4 deletions
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc
index 22ae4725a1..47ef9e13c2 100644
--- a/libs/surfaces/osc/osc.cc
+++ b/libs/surfaces/osc/osc.cc
@@ -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,13 +679,71 @@ 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 ()
{
diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h
index 9c96d5f593..197b0193ea 100644
--- a/libs/surfaces/osc/osc.h
+++ b/libs/surfaces/osc/osc.h
@@ -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;