comparison data/osc/OSCQueue.h @ 320:32e50b620a6c

* Move some things around to facilitate plundering libraries for other applications without needing to duplicate so much code. sv/osc -> data/osc sv/audioio -> audioio sv/transform -> plugin/transform sv/document -> document (will rename to framework in next commit)
author Chris Cannam
date Wed, 24 Oct 2007 16:34:31 +0000
parents
children 59e7fe1b1003
comparison
equal deleted inserted replaced
319:3ff8f571da09 320:32e50b620a6c
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 and QMUL.
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