svcore  1.9
OSCQueue.h
Go to the documentation of this file.
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  int getMessagesAvailable() const;
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 
66 };
67 
68 #endif
69 
RingBuffer< OSCMessage * > m_buffer
Definition: OSCQueue.h:65
OSCMessage readMessage()
Definition: OSCQueue.cpp:152
virtual ~OSCQueue()
Definition: OSCQueue.cpp:112
int getMessagesAvailable() const
Definition: OSCQueue.cpp:146
void messagesAvailable()
bool isEmpty() const
Definition: OSCQueue.h:44
lo_server_thread m_thread
Definition: OSCQueue.h:55
OSCQueue()
Definition: OSCQueue.cpp:91
QString getOSCURL() const
Definition: OSCQueue.cpp:136
static int oscMessageHandler(const char *, const char *, lo_arg **, int, lo_message, void *)
Definition: OSCQueue.cpp:40
static void oscError(int, const char *, const char *)
Definition: OSCQueue.cpp:33
void postMessage(OSCMessage)
Definition: OSCQueue.cpp:161
bool isOK() const
Definition: OSCQueue.cpp:126
bool parseOSCPath(QString path, int &target, int &targetData, QString &method)
Definition: OSCQueue.cpp:188