annotate osc/OSCQueue.h @ 182:21a76c9ed5c3
* Merge transform directory from sv-match-alignment branch
(the previous comment included notes for this stuff, but I missed it
in the actual merge)
* Fix crash when a transform fails to create an output model and the
thread that created the transform then deletes its input model thinking
it's no longer needed, even though the transform run thread is still
using it -- fix is to wait() on the transform before returning the
null output model
author |
Chris Cannam |
date |
Fri, 28 Sep 2007 16:15:06 +0000 |
parents |
bedc7517b6e8 |
children |
|
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@77
|
18 This file copyright 2000-2006 Chris Cannam and QMUL.
|
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
|