changeset 459:74d575708e06 alignment-simple

Branch to test simple FFT model code
author Chris Cannam
date Mon, 15 Jun 2015 09:15:55 +0100
parents d9d132c0e240 (current diff) ea30a8c4cb93 (diff)
children 51befd6165a3
files framework/Document.cpp framework/MainWindowBase.cpp framework/MainWindowBase.h
diffstat 6 files changed, 41 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp	Mon Apr 20 09:21:32 2015 +0100
+++ b/audioio/AudioCallbackPlaySource.cpp	Mon Jun 15 09:15:55 2015 +0100
@@ -422,6 +422,9 @@
         SVDEBUG << startFrame << endl;
 
     } else {
+        if (startFrame < 0) {
+            startFrame = 0;
+        }
 	if (startFrame >= m_lastModelEndFrame) {
 	    startFrame = 0;
 	}
--- a/audioio/AudioGenerator.cpp	Mon Apr 20 09:21:32 2015 +0100
+++ b/audioio/AudioGenerator.cpp	Mon Jun 15 09:15:55 2015 +0100
@@ -439,10 +439,10 @@
     sv_frame_t got = 0;
 
     if (startFrame >= fadeIn/2) {
-        got = dtvm->getData(0, modelChannels - 1,
-                            startFrame - fadeIn/2,
-                            frames + fadeOut/2 + fadeIn/2,
-                            m_channelBuffer);
+        got = dtvm->getMultiChannelData(0, modelChannels - 1,
+                                        startFrame - fadeIn/2,
+                                        frames + fadeOut/2 + fadeIn/2,
+                                        m_channelBuffer);
     } else {
         sv_frame_t missing = fadeIn/2 - startFrame;
 
@@ -457,10 +457,10 @@
                  << ", missing = " << missing << endl;
         }
 
-        got = dtvm->getData(0, modelChannels - 1,
-                            startFrame,
-                            frames + fadeOut/2,
-                            m_channelBuffer);
+        got = dtvm->getMultiChannelData(0, modelChannels - 1,
+                                        startFrame,
+                                        frames + fadeOut/2,
+                                        m_channelBuffer);
 
         for (int c = 0; c < modelChannels; ++c) {
             m_channelBuffer[c] -= missing;
--- a/framework/Document.cpp	Mon Apr 20 09:21:32 2015 +0100
+++ b/framework/Document.cpp	Mon Jun 15 09:15:55 2015 +0100
@@ -52,10 +52,16 @@
     m_autoAlignment(false),
     m_align(new Align())
 {
-    connect(this, SIGNAL(modelAboutToBeDeleted(Model *)),
+    connect(this,
+            SIGNAL(modelAboutToBeDeleted(Model *)),
             ModelTransformerFactory::getInstance(),
             SLOT(modelAboutToBeDeleted(Model *)));
 
+    connect(ModelTransformerFactory::getInstance(),
+            SIGNAL(transformFailed(QString, QString)),
+            this,
+            SIGNAL(modelGenerationFailed(QString, QString)));
+
     connect(m_align, SIGNAL(alignmentComplete(AlignmentModel *)),
             this, SIGNAL(alignmentComplete(AlignmentModel *)));
 }
--- a/framework/MainWindowBase.cpp	Mon Apr 20 09:21:32 2015 +0100
+++ b/framework/MainWindowBase.cpp	Mon Jun 15 09:15:55 2015 +0100
@@ -60,8 +60,6 @@
 #include "data/fileio/AudioFileReaderFactory.h"
 #include "rdf/RDFImporter.h"
 
-#include "data/fft/FFTDataServer.h"
-
 #include "base/RecentFiles.h"
 
 #include "base/PlayParameterRepository.h"
@@ -165,6 +163,8 @@
     XSetErrorHandler(handle_x11_error);
 #endif
 
+    connect(this, SIGNAL(hideSplash()), this, SLOT(emitHideSplash()));
+    
     connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()),
 	    this, SLOT(documentModified()));
     connect(CommandHistory::getInstance(), SIGNAL(documentRestored()),
@@ -260,6 +260,8 @@
     if (withMIDIInput) {
         m_midiInput = new MIDIInput(QApplication::applicationName(), this);
     }
+
+    QTimer::singleShot(1500, this, SIGNAL(hideSplash()));
 }
 
 MainWindowBase::~MainWindowBase()
@@ -276,6 +278,12 @@
 }
 
 void
+MainWindowBase::emitHideSplash()
+{
+    emit hideSplash(this);
+}
+
+void
 MainWindowBase::finaliseMenus()
 {
     delete m_menuShortcutMapper;
@@ -588,8 +596,8 @@
     emit canMeasureLayer(haveCurrentLayer);
     emit canSelect(haveMainModel && haveCurrentPane);
     emit canPlay(haveMainModel && havePlayTarget);
-    emit canFfwd(true);
-    emit canRewind(true);
+    emit canFfwd(haveMainModel);
+    emit canRewind(haveMainModel);
     emit canPaste(haveClipboardContents);
     emit canInsertInstant(haveCurrentPane);
     emit canInsertInstantsAtBoundaries(haveCurrentPane && haveSelection);
@@ -3377,7 +3385,6 @@
         m_viewManager->setPlaybackModel(0);
     }
     m_playSource->removeModel(model);
-    FFTDataServer::modelAboutToBeDeleted(model);
 }
 
 void
--- a/framework/MainWindowBase.h	Mon Apr 20 09:21:32 2015 +0100
+++ b/framework/MainWindowBase.h	Mon Jun 15 09:15:55 2015 +0100
@@ -162,6 +162,7 @@
     void canSave(bool);
     void canSaveAs(bool);
     void hideSplash();
+    void hideSplash(QWidget *);
     void sessionLoaded();
     void audioFileLoaded();
     void replacedDocument();
@@ -293,6 +294,8 @@
 
     virtual void closeSession() = 0;
 
+    virtual void emitHideSplash();
+
     virtual void newerVersionAvailable(QString) { }
 
     virtual void menuActionMapperInvoked(QObject *);
--- a/framework/SVFileReader.cpp	Mon Apr 20 09:21:32 2015 +0100
+++ b/framework/SVFileReader.cpp	Mon Jun 15 09:15:55 2015 +0100
@@ -886,12 +886,14 @@
 	    } else {
 		cerr << "WARNING: SV-XML: Unknown model id " << modelId
 			  << " in layer definition" << endl;
-
-                // Don't add a layer with an unknown model id
-                m_document->deleteLayer(layer);
-                m_layers[id] = layer = 0;
-                return false;
-	    }
+                if (!layer->canExistWithoutModel()) {
+                    // Don't add a layer with an unknown model id
+                    // unless it explicitly supports this state
+                    m_document->deleteLayer(layer);
+                    m_layers[id] = layer = 0;
+                    return false;
+                }
+            }
 	}
 
         if (layer) layer->setProperties(attributes);