28 #define OSC_MESSAGE_QUEUE_SIZE 1023 37 SVCERR <<
"ERROR: OSCQueue::oscError: liblo server error " << num
38 <<
" in path " << path <<
": " << msg << endl;
43 int argc, lo_message,
void *user_data)
51 if (!queue->
parseOSCPath(path, target, targetData, method)) {
62 while (types && i < argc && types[i]) {
65 lo_arg *arg = argv[i];
68 case 'i': message.
addArg(arg->i);
break;
73 case 'f': message.
addArg(arg->f);
break;
74 case 'd': message.
addArg(arg->d);
break;
75 case 'c': message.
addArg(arg->c);
break;
76 case 't': message.
addArg(arg->i);
break;
77 case 's': message.
addArg(&arg->s);
break;
78 default: cerr <<
"WARNING: OSCQueue::oscMessageHandler: " 79 <<
"Unsupported OSC type '" << type <<
"'" 100 Profiler profiler(
"OSCQueue::OSCQueue");
106 lo_server_thread_add_method(
m_thread,
nullptr,
nullptr,
111 SVDEBUG <<
"OSCQueue::OSCQueue: Started OSC thread, URL is " 112 << lo_server_thread_get_url(
m_thread) << endl;
114 cout <<
"OSCQueue::OSCQueue: Base OSC URL is " 115 << lo_server_thread_get_url(
m_thread) << endl;
119 SVDEBUG <<
"OSCQueue::OSCQueue: Note: OSC port support not " 120 <<
"compiled in; not opening port, falling back to " 121 <<
"internal-only queue" << endl;
160 url = lo_server_thread_get_url(
m_thread);
178 SVDEBUG <<
"OSCQueue::readMessage[" << QThread::currentThreadId() <<
"]: " 186 int count = 0, max = 5;
189 cerr <<
"ERROR: OSCQueue::postMessage: OSC message queue is full and not clearing -- abandoning incoming message" << endl;
192 cerr <<
"WARNING: OSCQueue::postMessage: OSC message queue (capacity " <<
m_buffer.
getSize() <<
" is full!" << endl;
193 SVDEBUG <<
"Waiting for something to be processed" << endl;
204 SVDEBUG <<
"OSCQueue::postMessage: Posted OSC message: target " 205 << message.
getTarget() <<
", target data " 215 while (path.startsWith(
"/")) {
216 path = path.right(path.length()-1);
222 target = path.section(
'/', i, i).toInt(&ok);
228 targetData = path.section(
'/', i, i).toInt(&ok);
236 method = path.section(
'/', i, -1);
238 if (method.contains(
'/')) {
239 cerr <<
"ERROR: OSCQueue::parseOSCPath: malformed path \"" 240 << path <<
"\" (should be target/data/method or " 241 <<
"target/method or method, where target and data " 242 <<
"are numeric)" << endl;
246 SVDEBUG <<
"OSCQueue::parseOSCPath: good path \"" << path
RingBuffer< OSCMessage * > m_buffer
QString getMethod() const
void addArg(QVariant arg)
int getSize() const
Return the total capacity of the ring buffer in samples.
#define OSC_MESSAGE_QUEUE_SIZE
T readOne(int R=0)
Read one sample from the buffer, for reader R.
QString getOSCURL() const
int getMessagesAvailable() const
lo_server_thread m_thread
OSCQueue(bool withNetworkPort)
int write(const T *source, int n)
Write n samples to the buffer.
int getReadSpace(int R=0) const
Return the amount of data available for reading by reader R, in samples.
static int oscMessageHandler(const char *, const char *, lo_arg **, int, lo_message, void *)
void setMethod(QString method)
void setTarget(const int &target)
int getWriteSpace() const
Return the amount of space available for writing, in samples.
static void oscError(int, const char *, const char *)
void postMessage(OSCMessage)
void setTargetData(const int &targetData)
bool parseOSCPath(QString path, int &target, int &targetData, QString &method)
int getTargetData() const
Profile point instance class.