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