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