diff audioio/AudioGenerator.cpp @ 180:98ba77e0d897

* Merge from sv-match-alignment branch (excluding alignment-specific document). - add aggregate wave model (not yet complete enough to be added as a true model in a layer, but there's potential) - add play solo mode - add alignment model -- unused in plain SV - fix two plugin leaks - add m3u playlist support (opens all files at once, potentially hazardous) - fix retrieval of pre-encoded URLs - add ability to resample audio files on import, so as to match rates with other files previously loaded; add preference for same - add preliminary support in transform code for range and rate of transform input - reorganise preferences dialog, move dark-background option to preferences, add option for temporary directory location
author Chris Cannam
date Fri, 28 Sep 2007 13:56:38 +0000
parents b4110b17bca8
children ebd906049fb6
line wrap: on
line diff
--- a/audioio/AudioGenerator.cpp	Fri Sep 21 09:13:11 2007 +0000
+++ b/audioio/AudioGenerator.cpp	Fri Sep 28 13:56:38 2007 +0000
@@ -47,7 +47,8 @@
 
 AudioGenerator::AudioGenerator() :
     m_sourceSampleRate(0),
-    m_targetChannelCount(1)
+    m_targetChannelCount(1),
+    m_soloing(false)
 {
     connect(PlayParameterRepository::getInstance(),
             SIGNAL(playPluginIdChanged(const Model *, QString)),
@@ -352,6 +353,26 @@
     return m_pluginBlockSize;
 }
 
+void
+AudioGenerator::setSoloModelSet(std::set<Model *> s)
+{
+    QMutexLocker locker(&m_mutex);
+
+    std::cerr << "setting solo set" << std::endl;
+
+    m_soloModelSet = s;
+    m_soloing = true;
+}
+
+void
+AudioGenerator::clearSoloModelSet()
+{
+    QMutexLocker locker(&m_mutex);
+
+    m_soloModelSet.clear();
+    m_soloing = false;
+}
+
 size_t
 AudioGenerator::mixModel(Model *model, size_t startFrame, size_t frameCount,
 			 float **buffer, size_t fadeIn, size_t fadeOut)
@@ -375,6 +396,15 @@
         return frameCount;
     }
 
+    if (m_soloing) {
+        if (m_soloModelSet.find(model) == m_soloModelSet.end()) {
+#ifdef DEBUG_AUDIO_GENERATOR
+            std::cout << "AudioGenerator::mixModel(" << model << "): not one of the solo'd models" << std::endl;
+#endif
+            return frameCount;
+        }
+    }
+
     float gain = parameters->getPlayGain();
     float pan = parameters->getPlayPan();