diff base/PlayParameters.cpp @ 391:5858cc462d0a

* Fix #1628781 changes to layer visibility and mute should use a command * Also use a command for changes to layer playback pan, gain, plugin settings * Refactor PlayParameterRepository to remove dependency on audioio from base * Fix failure to save play parameters for main model in session file
author Chris Cannam
date Thu, 13 Mar 2008 14:06:03 +0000
parents 70a232b1f12a
children b4a8d8221eaf
line wrap: on
line diff
--- a/base/PlayParameters.cpp	Thu Mar 13 12:41:20 2008 +0000
+++ b/base/PlayParameters.cpp	Thu Mar 13 14:06:03 2008 +0000
@@ -22,11 +22,40 @@
 void
 PlayParameters::copyFrom(const PlayParameters *pp)
 {
-    m_playMuted = pp->isPlayMuted();
-    m_playPan = pp->getPlayPan();
-    m_playGain = pp->getPlayGain();
-    m_playPluginId = pp->getPlayPluginId();
-    m_playPluginConfiguration = pp->getPlayPluginConfiguration();
+    bool changed = false;
+
+    if (m_playMuted != pp->isPlayMuted()) {
+        m_playMuted = pp->isPlayMuted();
+        emit playMutedChanged(m_playMuted);
+        emit playAudibleChanged(!m_playMuted);
+        changed = true;
+    }
+
+    if (m_playPan != pp->getPlayPan()) {
+        m_playPan = pp->getPlayPan();
+        emit playPanChanged(m_playPan);
+        changed = true;
+    }
+
+    if (m_playGain != pp->getPlayGain()) {
+        m_playGain = pp->getPlayGain();
+        emit playGainChanged(m_playGain);
+        changed = true;
+    }
+
+    if (m_playPluginId != pp->getPlayPluginId()) {
+        m_playPluginId = pp->getPlayPluginId();
+        emit playPluginIdChanged(m_playPluginId);
+        changed = true;
+    }
+    
+    if (m_playPluginConfiguration != pp->getPlayPluginConfiguration()) {
+        m_playPluginConfiguration = pp->getPlayPluginConfiguration();
+        emit playPluginConfigurationChanged(m_playPluginConfiguration);
+        changed = true;
+    }
+
+    if (changed) emit playParametersChanged();
 }
 
 void
@@ -53,10 +82,12 @@
 PlayParameters::setPlayMuted(bool muted)
 {
 //    std::cerr << "PlayParameters: setPlayMuted(" << muted << ")" << std::endl;
-    m_playMuted = muted;
-    emit playMutedChanged(muted);
-    emit playAudibleChanged(!muted);
-    emit playParametersChanged();
+    if (m_playMuted != muted) {
+        m_playMuted = muted;
+        emit playMutedChanged(muted);
+        emit playAudibleChanged(!muted);
+        emit playParametersChanged();
+    }
 }
 
 void