Chris@320: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@320: Chris@320: /* Chris@320: Sonic Visualiser Chris@320: An audio file viewer and annotation editor. Chris@320: Centre for Digital Music, Queen Mary, University of London. Chris@320: Chris@320: This program is free software; you can redistribute it and/or Chris@320: modify it under the terms of the GNU General Public License as Chris@320: published by the Free Software Foundation; either version 2 of the Chris@320: License, or (at your option) any later version. See the file Chris@320: COPYING included with this distribution for more information. Chris@320: */ Chris@320: Chris@320: /* Chris@320: This is a modified version of a source file from the Chris@320: Rosegarden MIDI and audio sequencer and notation editor. Chris@320: This file copyright 2000-2006 Chris Cannam and QMUL. Chris@320: */ Chris@320: Chris@1581: #ifndef SV_OSC_QUEUE_H Chris@1581: #define SV_OSC_QUEUE_H Chris@320: Chris@320: #include "OSCMessage.h" Chris@320: Chris@320: #include "base/RingBuffer.h" Chris@320: Chris@320: #include Chris@320: Chris@320: #ifdef HAVE_LIBLO Chris@320: #include Chris@320: #endif Chris@320: Chris@320: class OSCQueue : public QObject Chris@320: { Chris@320: Q_OBJECT Chris@320: Chris@320: public: Chris@1678: OSCQueue(bool withNetworkPort); Chris@320: virtual ~OSCQueue(); Chris@320: Chris@320: bool isOK() const; Chris@320: Chris@320: bool isEmpty() const { return getMessagesAvailable() == 0; } Chris@929: int getMessagesAvailable() const; Chris@1664: void postMessage(OSCMessage); Chris@320: OSCMessage readMessage(); Chris@320: Chris@320: QString getOSCURL() const; Chris@320: Chris@1678: bool hasPort() const { return m_withPort; } Chris@1678: Chris@320: signals: Chris@320: void messagesAvailable(); Chris@320: Chris@320: protected: Chris@320: #ifdef HAVE_LIBLO Chris@320: lo_server_thread m_thread; Chris@320: Chris@320: static void oscError(int, const char *, const char *); Chris@320: static int oscMessageHandler(const char *, const char *, lo_arg **, Chris@320: int, lo_message, void *); Chris@320: #endif Chris@320: Chris@320: bool parseOSCPath(QString path, int &target, int &targetData, QString &method); Chris@320: Chris@1678: bool m_withPort; Chris@320: RingBuffer m_buffer; Chris@320: }; Chris@320: Chris@320: #endif Chris@320: