annotate data/osc/OSCQueue.h @ 1677:f97d64b8674f single-point

Make XmlExportables store their export IDs and always obtain a new one, avoiding reuse when an object is allocated at the same heap location as a previous one. This makes the ID system stable enough to be used in the export tests.
author Chris Cannam
date Thu, 28 Mar 2019 11:55:02 +0000
parents f66ad018b729
children 1078f0ef3012
rev   line source
Chris@320 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@320 2
Chris@320 3 /*
Chris@320 4 Sonic Visualiser
Chris@320 5 An audio file viewer and annotation editor.
Chris@320 6 Centre for Digital Music, Queen Mary, University of London.
Chris@320 7
Chris@320 8 This program is free software; you can redistribute it and/or
Chris@320 9 modify it under the terms of the GNU General Public License as
Chris@320 10 published by the Free Software Foundation; either version 2 of the
Chris@320 11 License, or (at your option) any later version. See the file
Chris@320 12 COPYING included with this distribution for more information.
Chris@320 13 */
Chris@320 14
Chris@320 15 /*
Chris@320 16 This is a modified version of a source file from the
Chris@320 17 Rosegarden MIDI and audio sequencer and notation editor.
Chris@320 18 This file copyright 2000-2006 Chris Cannam and QMUL.
Chris@320 19 */
Chris@320 20
Chris@1581 21 #ifndef SV_OSC_QUEUE_H
Chris@1581 22 #define SV_OSC_QUEUE_H
Chris@320 23
Chris@320 24 #include "OSCMessage.h"
Chris@320 25
Chris@320 26 #include "base/RingBuffer.h"
Chris@320 27
Chris@320 28 #include <QObject>
Chris@320 29
Chris@320 30 #ifdef HAVE_LIBLO
Chris@320 31 #include <lo/lo.h>
Chris@320 32 #endif
Chris@320 33
Chris@320 34 class OSCQueue : public QObject
Chris@320 35 {
Chris@320 36 Q_OBJECT
Chris@320 37
Chris@320 38 public:
Chris@320 39 OSCQueue();
Chris@320 40 virtual ~OSCQueue();
Chris@320 41
Chris@320 42 bool isOK() const;
Chris@320 43
Chris@320 44 bool isEmpty() const { return getMessagesAvailable() == 0; }
Chris@929 45 int getMessagesAvailable() const;
Chris@1664 46 void postMessage(OSCMessage);
Chris@320 47 OSCMessage readMessage();
Chris@320 48
Chris@320 49 QString getOSCURL() const;
Chris@320 50
Chris@320 51 signals:
Chris@320 52 void messagesAvailable();
Chris@320 53
Chris@320 54 protected:
Chris@320 55 #ifdef HAVE_LIBLO
Chris@320 56 lo_server_thread m_thread;
Chris@320 57
Chris@320 58 static void oscError(int, const char *, const char *);
Chris@320 59 static int oscMessageHandler(const char *, const char *, lo_arg **,
Chris@320 60 int, lo_message, void *);
Chris@320 61 #endif
Chris@320 62
Chris@320 63 bool parseOSCPath(QString path, int &target, int &targetData, QString &method);
Chris@320 64
Chris@320 65 RingBuffer<OSCMessage *> m_buffer;
Chris@320 66 };
Chris@320 67
Chris@320 68 #endif
Chris@320 69