changeset 1673:dfcd05e8bd2f osc-script

Merge from branch single-point
author Chris Cannam
date Wed, 27 Mar 2019 14:15:21 +0000
parents 1d1a16968f03 (diff) b5580d93f28b (current diff)
children 69ab62d378bf
files data/model/IntervalModel.h data/model/Model.cpp data/model/PathModel.h data/model/SparseModel.h data/model/SparseValueModel.h files.pri
diffstat 8 files changed, 59 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/data/model/AlignmentModel.cpp	Wed Mar 27 14:13:32 2019 +0000
+++ b/data/model/AlignmentModel.cpp	Wed Mar 27 14:15:21 2019 +0000
@@ -54,6 +54,8 @@
 
 AlignmentModel::~AlignmentModel()
 {
+    SVDEBUG << "AlignmentModel(" << this << ")::~AlignmentModel()" << endl;
+    
     if (m_inputModel) m_inputModel->aboutToDelete();
     delete m_inputModel;
 
@@ -201,8 +203,8 @@
         m_rawPath->isReady(&completion);
 
 #ifdef DEBUG_ALIGNMENT_MODEL
-        cerr << "AlignmentModel::pathCompletionChanged: completion = "
-                  << completion << endl;
+        SVCERR << "AlignmentModel::pathCompletionChanged: completion = "
+               << completion << endl;
 #endif
 
         m_pathComplete = (completion == 100);
@@ -211,7 +213,8 @@
 
             constructPath();
             constructReversePath();
-            
+
+            SVDEBUG << "AlignmentModel: path complete, deleting input" << endl;
             if (m_inputModel) m_inputModel->aboutToDelete();
             delete m_inputModel;
             m_inputModel = nullptr;
--- a/data/model/Model.cpp	Wed Mar 27 14:13:32 2019 +0000
+++ b/data/model/Model.cpp	Wed Mar 27 14:15:21 2019 +0000
@@ -22,7 +22,7 @@
 
 Model::~Model()
 {
-//    SVDEBUG << "Model::~Model(" << this << ")" << endl;
+    SVDEBUG << "Model::~Model(" << this << ")" << endl;
 
     if (!m_aboutToDelete) {
         SVDEBUG << "NOTE: Model(" << this << ", \""
@@ -73,9 +73,10 @@
 void
 Model::aboutToDelete()
 {
-//    SVDEBUG << "Model(" << this << ", \""
-//            << objectName() << "\", type uri <"
-//            << m_typeUri << ">)::aboutToDelete()" << endl;
+    SVDEBUG << "Model(" << this << ", \""
+            << objectName() << "\", type name \""
+            << getTypeName() << "\", type uri <"
+            << m_typeUri << ">)::aboutToDelete()" << endl;
 
     if (m_aboutToDelete) {
         SVDEBUG << "WARNING: Model(" << this << ", \""
@@ -98,6 +99,9 @@
 void
 Model::setAlignment(AlignmentModel *alignment)
 {
+    SVDEBUG << "Model(" << this << "): accepting alignment model "
+            << alignment << endl;
+    
     if (m_alignment) {
         m_alignment->aboutToDelete();
         delete m_alignment;
--- a/data/model/PathModel.h	Wed Mar 27 14:13:32 2019 +0000
+++ b/data/model/PathModel.h	Wed Mar 27 14:15:21 2019 +0000
@@ -76,7 +76,7 @@
         m_end(0) {
     }
 
-    QString getTypeName() const override { return tr("Text"); }
+    QString getTypeName() const override { return tr("Path"); }
     bool isSparse() const { return true; }
     bool isOK() const override { return true; }
 
--- a/data/osc/OSCMessage.h	Wed Mar 27 14:13:32 2019 +0000
+++ b/data/osc/OSCMessage.h	Wed Mar 27 14:15:21 2019 +0000
@@ -50,6 +50,18 @@
     int getArgCount() const;
     const QVariant &getArg(int i) const;
 
+    // For debugging purposes, not for interchange
+    QString toString() const {
+        QString s = QString("[%1][%2] %3")
+            .arg(m_target)
+            .arg(m_targetData)
+            .arg(m_method);
+        for (auto a: m_args) {
+            s.push_back(" \"" + a.toString() + "\"");
+        }
+        return s;
+    }
+
 private:
     int m_target;
     int m_targetData;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data/osc/OSCMessageCallback.h	Wed Mar 27 14:15:21 2019 +0000
@@ -0,0 +1,25 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
+
+/*
+    Sonic Visualiser
+    An audio file viewer and annotation editor.
+    Centre for Digital Music, Queen Mary, University of London.
+    
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License as
+    published by the Free Software Foundation; either version 2 of the
+    License, or (at your option) any later version.  See the file
+    COPYING included with this distribution for more information.
+*/
+
+#ifndef SV_OSC_MESSAGE_CALLBACK_H
+#define SV_OSC_MESSAGE_CALLBACK_H
+
+class OSCMessage;
+
+class OSCMessageCallback {
+public:
+    virtual void handleOSCMessage(const OSCMessage &) = 0;
+};
+
+#endif
--- a/data/osc/OSCQueue.cpp	Wed Mar 27 14:13:32 2019 +0000
+++ b/data/osc/OSCQueue.cpp	Wed Mar 27 14:15:21 2019 +0000
@@ -30,6 +30,8 @@
 
 #include <unistd.h>
 
+#include <QThread>
+
 void
 OSCQueue::oscError(int num, const char *msg, const char *path)
 {
@@ -155,6 +157,9 @@
     OSCMessage *message = m_buffer.readOne();
     OSCMessage rmessage = *message;
     delete message;
+    SVDEBUG << "OSCQueue::readMessage: In thread "
+            << QThread::currentThreadId() << ": message follows:\n"
+            << rmessage.toString() << endl;
     return rmessage;
 }
 
--- a/data/osc/OSCQueue.h	Wed Mar 27 14:13:32 2019 +0000
+++ b/data/osc/OSCQueue.h	Wed Mar 27 14:15:21 2019 +0000
@@ -43,6 +43,7 @@
 
     bool isEmpty() const { return getMessagesAvailable() == 0; }
     int getMessagesAvailable() const;
+    void postMessage(OSCMessage);
     OSCMessage readMessage();
 
     QString getOSCURL() const;
@@ -59,7 +60,6 @@
                                  int, lo_message, void *);
 #endif
 
-    void postMessage(OSCMessage);
     bool parseOSCPath(QString path, int &target, int &targetData, QString &method);
 
     RingBuffer<OSCMessage *> m_buffer;
--- a/files.pri	Wed Mar 27 14:13:32 2019 +0000
+++ b/files.pri	Wed Mar 27 14:15:21 2019 +0000
@@ -104,6 +104,7 @@
            data/model/ReadOnlyWaveFileModel.h \
            data/model/WritableWaveFileModel.h \
            data/osc/OSCMessage.h \
+           data/osc/OSCMessageCallback.h \
            data/osc/OSCQueue.h \
 	   plugin/PluginScan.h \
            plugin/DSSIPluginFactory.h \