changeset 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 4b58b8f44be7
children 48001ed9143b 75390b1ebd2c
files audio/AudioCallbackPlaySource.cpp audio/AudioCallbackPlaySource.h
diffstat 2 files changed, 36 insertions(+), 11 deletions(-) [+]
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();
 
--- a/audio/AudioCallbackPlaySource.h	Wed Feb 05 10:45:03 2020 +0000
+++ b/audio/AudioCallbackPlaySource.h	Wed Feb 05 12:33:24 2020 +0000
@@ -371,6 +371,7 @@
     bool                              m_levelsSet;
     RealTimePluginInstance           *m_auditioningPlugin;
     bool                              m_auditioningPluginBypassed;
+    bool                              m_auditioningPluginFailed;
     Scavenger<RealTimePluginInstance> m_pluginScavenger;
     sv_frame_t                        m_playStartFrame;
     bool                              m_playStartFramePassed;