changeset 57:eb596ef12041

* Factor out uses of "Sonic Visualiser" in "common" code to applicationName() * Add ability to show work title + artist in top-left of pane (thinking of Vect but may be useful in SV in future) * A few other generalisations useful for Vect
author Chris Cannam
date Fri, 09 Nov 2007 17:46:58 +0000
parents 75ad3f8f65aa
children 621c2edd1693
files audioio/AudioCallbackPlaySource.cpp audioio/AudioCallbackPlaySource.h audioio/AudioJACKTarget.cpp framework/Document.cpp framework/MainWindowBase.cpp
diffstat 5 files changed, 40 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp	Thu Nov 08 16:14:32 2007 +0000
+++ b/audioio/AudioCallbackPlaySource.cpp	Fri Nov 09 17:46:58 2007 +0000
@@ -35,9 +35,11 @@
 
 const size_t AudioCallbackPlaySource::m_ringBufferSize = 131071;
 
-AudioCallbackPlaySource::AudioCallbackPlaySource(ViewManager *manager) :
+AudioCallbackPlaySource::AudioCallbackPlaySource(ViewManager *manager,
+                                                 QString clientName) :
     m_viewManager(manager),
     m_audioGenerator(new AudioGenerator()),
+    m_clientName(clientName),
     m_readBuffers(0),
     m_writeBuffers(0),
     m_readBufferFill(0),
--- a/audioio/AudioCallbackPlaySource.h	Thu Nov 08 16:14:32 2007 +0000
+++ b/audioio/AudioCallbackPlaySource.h	Fri Nov 09 17:46:58 2007 +0000
@@ -52,7 +52,7 @@
     Q_OBJECT
 
 public:
-    AudioCallbackPlaySource(ViewManager *);
+    AudioCallbackPlaySource(ViewManager *, QString clientName);
     virtual ~AudioCallbackPlaySource();
     
     /**
@@ -226,6 +226,8 @@
      */
     void clearSoloModelSet();
 
+    QString getClientName() const { return m_clientName; }
+
 signals:
     void modelReplaced();
 
@@ -247,8 +249,9 @@
     void modelChanged(size_t startFrame, size_t endFrame);
 
 protected:
-    ViewManager                     *m_viewManager;
-    AudioGenerator                  *m_audioGenerator;
+    ViewManager                      *m_viewManager;
+    AudioGenerator                   *m_audioGenerator;
+    QString                           m_clientName;
 
     class RingBufferVector : public std::vector<RingBuffer<float> *> {
     public:
--- a/audioio/AudioJACKTarget.cpp	Thu Nov 08 16:14:32 2007 +0000
+++ b/audioio/AudioJACKTarget.cpp	Fri Nov 09 17:46:58 2007 +0000
@@ -219,8 +219,9 @@
 #endif
 
     JackStatus status = JackStatus(0);
-    m_client = jack_client_open("Sonic Visualiser", options, &status);
-
+    m_client = jack_client_open(source->getClientName().toLocal8Bit().data(),
+                                options, &status);
+    
     if (!m_client) {
         std::cerr << "AudioJACKTarget: Failed to connect to JACK server: status code "
                   << status << std::endl;
--- a/framework/Document.cpp	Thu Nov 08 16:14:32 2007 +0000
+++ b/framework/Document.cpp	Fri Nov 09 17:46:58 2007 +0000
@@ -737,10 +737,12 @@
     
     ModelTransformerFactory *factory = ModelTransformerFactory::getInstance();
 
+    PluginTransformer::ExecutionContext context =
+        factory->getDefaultContextForTransformer(id, aggregate);
+//    context.stepSize = context.blockSize/2;
+
     Model *transformOutput = factory->transform
-        (id, aggregate,
-         factory->getDefaultContextForTransformer(id, aggregate),
-         "<plugin param-serialise=\"1\"/>");
+        (id, aggregate, context, "<plugin param-serialise=\"1\"/>");
 
     SparseTimeValueModel *path = dynamic_cast<SparseTimeValueModel *>
         (transformOutput);
--- a/framework/MainWindowBase.cpp	Thu Nov 08 16:14:32 2007 +0000
+++ b/framework/MainWindowBase.cpp	Fri Nov 09 17:46:58 2007 +0000
@@ -152,7 +152,8 @@
     connect(m_paneStack, SIGNAL(paneDeleteButtonClicked(Pane *)),
             this, SLOT(paneDeleteButtonClicked(Pane *)));
 
-    m_playSource = new AudioCallbackPlaySource(m_viewManager);
+    m_playSource = new AudioCallbackPlaySource(m_viewManager,
+                                               QApplication::applicationName());
 
     connect(m_playSource, SIGNAL(sampleRateMismatch(size_t, size_t, bool)),
 	    this,           SLOT(sampleRateMismatch(size_t, size_t, bool)));
@@ -424,6 +425,18 @@
 
     View::ModelSet soloModels = p->getModels();
     
+    View::ModelSet sources;
+    for (View::ModelSet::iterator mi = soloModels.begin();
+         mi != soloModels.end(); ++mi) {
+        if (*mi && (*mi)->getSourceModel()) {
+            sources.insert((*mi)->getSourceModel());
+        }
+    }
+    for (View::ModelSet::iterator mi = sources.begin();
+         mi != sources.end(); ++mi) {
+        soloModels.insert(*mi);
+    }
+
     for (View::ModelSet::iterator mi = soloModels.begin();
          mi != soloModels.end(); ++mi) {
         if (dynamic_cast<RangeSummarisableTimeValueModel *>(*mi)) {
@@ -870,13 +883,15 @@
 
 	if (m_sessionFile == "") {
             //!!! shouldn't be dealing directly with title from here -- call a method
-	    setWindowTitle(tr("Sonic Visualiser: %1")
+	    setWindowTitle(tr("%1: %2")
+                           .arg(QApplication::applicationName())
                            .arg(source.getLocation()));
 	    CommandHistory::getInstance()->clear();
 	    CommandHistory::getInstance()->documentSaved();
 	    m_documentModified = false;
 	} else {
-	    setWindowTitle(tr("Sonic Visualiser: %1 [%2]")
+	    setWindowTitle(tr("%1: %2 [%3]")
+                           .arg(QApplication::applicationName())
 			   .arg(QFileInfo(m_sessionFile).fileName())
 			   .arg(source.getLocation()));
 	    if (m_documentModified) {
@@ -1180,7 +1195,8 @@
 
     if (ok) {
 
-	setWindowTitle(tr("Sonic Visualiser: %1")
+	setWindowTitle(tr("%1: %2")
+                       .arg(QApplication::applicationName())
 		       .arg(source.getLocation()));
 
 	if (!source.isRemote()) m_sessionFile = source.getLocalFilename();
@@ -1201,7 +1217,7 @@
         }
 
     } else {
-	setWindowTitle(tr("Sonic Visualiser"));
+	setWindowTitle(QApplication::applicationName());
     }
 
     return ok ? FileOpenSucceeded : FileOpenFailed;
@@ -1330,7 +1346,8 @@
 {
     AddPaneCommand *command = new AddPaneCommand(this);
     CommandHistory::getInstance()->addCommand(command);
-    return command->getPane();
+    Pane *pane = command->getPane();
+    return pane;
 }
 
 void