annotate osc/OSCQueue.h @ 69:76cc2c424268

* Update the main sv.prf for compatibility with Qt 4.2 qmake instead of that from 4.1. Add a README.Qt41 describing how to build with 4.1 if preferred. * Add OSC support for control from external scripts etc (work in progress).
author Chris Cannam
date Fri, 10 Nov 2006 13:27:57 +0000
parents
children bedc7517b6e8
rev   line source
Chris@69 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@69 2
Chris@69 3 /*
Chris@69 4 Sonic Visualiser
Chris@69 5 An audio file viewer and annotation editor.
Chris@69 6 Centre for Digital Music, Queen Mary, University of London.
Chris@69 7
Chris@69 8 This program is free software; you can redistribute it and/or
Chris@69 9 modify it under the terms of the GNU General Public License as
Chris@69 10 published by the Free Software Foundation; either version 2 of the
Chris@69 11 License, or (at your option) any later version. See the file
Chris@69 12 COPYING included with this distribution for more information.
Chris@69 13 */
Chris@69 14
Chris@69 15 /*
Chris@69 16 This is a modified version of a source file from the
Chris@69 17 Rosegarden MIDI and audio sequencer and notation editor.
Chris@69 18 This file copyright 2000-2006 Chris Cannam.
Chris@69 19 */
Chris@69 20
Chris@69 21 #ifndef _OSC_QUEUE_H_
Chris@69 22 #define _OSC_QUEUE_H_
Chris@69 23
Chris@69 24 #include "OSCMessage.h"
Chris@69 25
Chris@69 26 #include "base/RingBuffer.h"
Chris@69 27
Chris@69 28 #include <QObject>
Chris@69 29
Chris@69 30 #ifdef HAVE_LIBLO
Chris@69 31 #include <lo/lo.h>
Chris@69 32 #endif
Chris@69 33
Chris@69 34 class OSCQueue : public QObject
Chris@69 35 {
Chris@69 36 Q_OBJECT
Chris@69 37
Chris@69 38 public:
Chris@69 39 OSCQueue();
Chris@69 40 virtual ~OSCQueue();
Chris@69 41
Chris@69 42 bool isOK() const;
Chris@69 43
Chris@69 44 bool isEmpty() const { return getMessagesAvailable() == 0; }
Chris@69 45 size_t getMessagesAvailable() const;
Chris@69 46 OSCMessage readMessage();
Chris@69 47
Chris@69 48 QString getOSCURL() const;
Chris@69 49
Chris@69 50 signals:
Chris@69 51 void messagesAvailable();
Chris@69 52
Chris@69 53 protected:
Chris@69 54 #ifdef HAVE_LIBLO
Chris@69 55 lo_server_thread m_thread;
Chris@69 56
Chris@69 57 static void oscError(int, const char *, const char *);
Chris@69 58 static int oscMessageHandler(const char *, const char *, lo_arg **,
Chris@69 59 int, lo_message, void *);
Chris@69 60 #endif
Chris@69 61
Chris@69 62 void postMessage(OSCMessage);
Chris@69 63 bool parseOSCPath(QString path, int &target, int &targetData, QString &method);
Chris@69 64
Chris@69 65 RingBuffer<OSCMessage *> m_buffer;
Chris@69 66 };
Chris@69 67
Chris@69 68 #endif
Chris@69 69