diff vamp-client/PluginStub.h @ 171:8d2b12442903

Merge branch 'master' of https://github.com/piper-audio/piper-cpp
author Lucas Thompson <dev@lucas.im>
date Tue, 31 Jan 2017 15:07:39 +0000
parents 590b1a1fd955
children 3eb00e5c76c4
line wrap: on
line diff
--- a/vamp-client/PluginStub.h	Tue Jan 31 14:07:18 2017 +0000
+++ b/vamp-client/PluginStub.h	Tue Jan 31 15:07:39 2017 +0000
@@ -166,7 +166,12 @@
         m_config.stepSize = int(stepSize);
         m_config.blockSize = int(blockSize);
 
-        m_outputs = m_client->configure(this, m_config);
+        try {
+            m_outputs = m_client->configure(this, m_config);
+        } catch (const std::exception &e) {
+            m_state = Failed;
+            throw;
+        }
 
         if (!m_outputs.empty()) {
             m_state = Configured;
@@ -185,8 +190,13 @@
             // reset is a no-op if the plugin hasn't been initialised yet
             return;
         }
-        
-        m_client->reset(this, m_config);
+
+        try {
+            m_client->reset(this, m_config);
+        } catch (const std::exception &e) {
+            m_state = Failed;
+            throw;
+        }
 
         m_state = Configured;
     }
@@ -251,15 +261,19 @@
             throw std::logic_error("Plugin has already been disposed of");
         }
 
-        //!!! ew
         std::vector<std::vector<float> > vecbuf;
         for (int c = 0; c < m_config.channelCount; ++c) {
             vecbuf.push_back(std::vector<float>
                              (inputBuffers[c],
                               inputBuffers[c] + m_config.blockSize));
         }
-        
-        return m_client->process(this, vecbuf, timestamp);
+
+        try {
+            return m_client->process(this, vecbuf, timestamp);
+        } catch (const std::exception &e) {
+            m_state = Failed;
+            throw;
+        }
     }
 
     virtual FeatureSet getRemainingFeatures() {
@@ -278,7 +292,12 @@
 
         m_state = Finished;
 
-        return m_client->finish(this);
+        try {
+            return m_client->finish(this);
+        } catch (const std::exception &e) {
+            m_state = Failed;
+            throw;
+        }
     }
 
     // Not Plugin methods, but needed by the PluginClient to support reloads: