svcore
1.9
|
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 00003 /* 00004 Sonic Visualiser 00005 An audio file viewer and annotation editor. 00006 Centre for Digital Music, Queen Mary, University of London. 00007 00008 This program is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License as 00010 published by the Free Software Foundation; either version 2 of the 00011 License, or (at your option) any later version. See the file 00012 COPYING included with this distribution for more information. 00013 */ 00014 00015 /* 00016 This is a modified version of a source file from the 00017 Rosegarden MIDI and audio sequencer and notation editor. 00018 This file copyright 2000-2006 Chris Cannam and QMUL. 00019 */ 00020 00021 #ifndef _OSC_QUEUE_H_ 00022 #define _OSC_QUEUE_H_ 00023 00024 #include "OSCMessage.h" 00025 00026 #include "base/RingBuffer.h" 00027 00028 #include <QObject> 00029 00030 #ifdef HAVE_LIBLO 00031 #include <lo/lo.h> 00032 #endif 00033 00034 class OSCQueue : public QObject 00035 { 00036 Q_OBJECT 00037 00038 public: 00039 OSCQueue(); 00040 virtual ~OSCQueue(); 00041 00042 bool isOK() const; 00043 00044 bool isEmpty() const { return getMessagesAvailable() == 0; } 00045 int getMessagesAvailable() const; 00046 OSCMessage readMessage(); 00047 00048 QString getOSCURL() const; 00049 00050 signals: 00051 void messagesAvailable(); 00052 00053 protected: 00054 #ifdef HAVE_LIBLO 00055 lo_server_thread m_thread; 00056 00057 static void oscError(int, const char *, const char *); 00058 static int oscMessageHandler(const char *, const char *, lo_arg **, 00059 int, lo_message, void *); 00060 #endif 00061 00062 void postMessage(OSCMessage); 00063 bool parseOSCPath(QString path, int &target, int &targetData, QString &method); 00064 00065 RingBuffer<OSCMessage *> m_buffer; 00066 }; 00067 00068 #endif 00069