diff audio/AudioCallbackPlaySource.cpp @ 737:497d80d3b9c4

More useful error reporting in cases where auditioning plugin fails
author Chris Cannam
date Wed, 05 Feb 2020 12:33:24 +0000
parents ce698f8d0831
children 48001ed9143b 75390b1ebd2c
line wrap: on
line diff
--- a/audio/AudioCallbackPlaySource.cpp	Wed Feb 05 10:45:03 2020 +0000
+++ b/audio/AudioCallbackPlaySource.cpp	Wed Feb 05 12:33:24 2020 +0000
@@ -75,6 +75,7 @@
     m_levelsSet(false),
     m_auditioningPlugin(nullptr),
     m_auditioningPluginBypassed(false),
+    m_auditioningPluginFailed(false),
     m_playStartFrame(0),
     m_playStartFramePassed(false),
     m_timeStretcher(nullptr),
@@ -1012,7 +1013,12 @@
     m_mutex.lock();
     m_auditioningPlugin = plugin;
     m_auditioningPluginBypassed = false;
+    m_auditioningPluginFailed = false;
     m_mutex.unlock();
+
+    SVDEBUG << "AudioCallbackPlaySource::setAuditioningEffect: set plugin to "
+            << plugin << " and bypassed to " << m_auditioningPluginBypassed
+            << endl;
 }
 
 void
@@ -1364,26 +1370,44 @@
     if (m_auditioningPluginBypassed) return;
     RealTimePluginInstance *plugin = m_auditioningPlugin;
     if (!plugin) return;
-    
+
     if ((int)plugin->getAudioInputCount() != getTargetChannelCount()) {
-//        cout << "plugin input count " << plugin->getAudioInputCount() 
-//                  << " != our channel count " << getTargetChannelCount()
-//                  << endl;
+        if (!m_auditioningPluginFailed) {
+            SVCERR << "AudioCallbackPlaySource::applyAuditioningEffect: "
+                   << "Can't run plugin: plugin input count "
+                   << plugin->getAudioInputCount() 
+                   << " != our channel count " << getTargetChannelCount()
+                   << " (future errors for this plugin will be suppressed)"
+                   << endl;
+            m_auditioningPluginFailed = true;
+        }
         return;
     }
     if ((int)plugin->getAudioOutputCount() != getTargetChannelCount()) {
-//        cout << "plugin output count " << plugin->getAudioOutputCount() 
-//                  << " != our channel count " << getTargetChannelCount()
-//                  << endl;
+        if (!m_auditioningPluginFailed) {
+            SVCERR << "AudioCallbackPlaySource::applyAuditioningEffect: "
+                   << "Can't run plugin: plugin output count "
+                   << plugin->getAudioOutputCount() 
+                   << " != our channel count " << getTargetChannelCount()
+                   << " (future errors for this plugin will be suppressed)"
+                   << endl;
+            m_auditioningPluginFailed = true;
+        }
         return;
     }
     if ((int)plugin->getBufferSize() < count) {
-//        cout << "plugin buffer size " << plugin->getBufferSize() 
-//                  << " < our block size " << count
-//                  << endl;
+        if (!m_auditioningPluginFailed) {
+            SVCERR << "AudioCallbackPlaySource::applyAuditioningEffect: "
+                   << "Can't run plugin: plugin buffer size "
+                   << plugin->getBufferSize() 
+                   << " < our block size " << count
+                   << " (future errors for this plugin will be suppressed)"
+                   << endl;
+            m_auditioningPluginFailed = true;
+        }
         return;
     }
-
+    
     float **ib = plugin->getAudioInputBuffers();
     float **ob = plugin->getAudioOutputBuffers();