Mercurial > hg > piper-cpp
comparison 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 |
comparison
equal
deleted
inserted
replaced
168:718dd5404855 | 171:8d2b12442903 |
---|---|
164 | 164 |
165 m_config.channelCount = int(inputChannels); | 165 m_config.channelCount = int(inputChannels); |
166 m_config.stepSize = int(stepSize); | 166 m_config.stepSize = int(stepSize); |
167 m_config.blockSize = int(blockSize); | 167 m_config.blockSize = int(blockSize); |
168 | 168 |
169 m_outputs = m_client->configure(this, m_config); | 169 try { |
170 m_outputs = m_client->configure(this, m_config); | |
171 } catch (const std::exception &e) { | |
172 m_state = Failed; | |
173 throw; | |
174 } | |
170 | 175 |
171 if (!m_outputs.empty()) { | 176 if (!m_outputs.empty()) { |
172 m_state = Configured; | 177 m_state = Configured; |
173 return true; | 178 return true; |
174 } else { | 179 } else { |
183 } | 188 } |
184 if (m_state == Loaded) { | 189 if (m_state == Loaded) { |
185 // reset is a no-op if the plugin hasn't been initialised yet | 190 // reset is a no-op if the plugin hasn't been initialised yet |
186 return; | 191 return; |
187 } | 192 } |
188 | 193 |
189 m_client->reset(this, m_config); | 194 try { |
195 m_client->reset(this, m_config); | |
196 } catch (const std::exception &e) { | |
197 m_state = Failed; | |
198 throw; | |
199 } | |
190 | 200 |
191 m_state = Configured; | 201 m_state = Configured; |
192 } | 202 } |
193 | 203 |
194 virtual InputDomain getInputDomain() const { | 204 virtual InputDomain getInputDomain() const { |
249 if (m_state == Finished) { | 259 if (m_state == Finished) { |
250 m_state = Failed; | 260 m_state = Failed; |
251 throw std::logic_error("Plugin has already been disposed of"); | 261 throw std::logic_error("Plugin has already been disposed of"); |
252 } | 262 } |
253 | 263 |
254 //!!! ew | |
255 std::vector<std::vector<float> > vecbuf; | 264 std::vector<std::vector<float> > vecbuf; |
256 for (int c = 0; c < m_config.channelCount; ++c) { | 265 for (int c = 0; c < m_config.channelCount; ++c) { |
257 vecbuf.push_back(std::vector<float> | 266 vecbuf.push_back(std::vector<float> |
258 (inputBuffers[c], | 267 (inputBuffers[c], |
259 inputBuffers[c] + m_config.blockSize)); | 268 inputBuffers[c] + m_config.blockSize)); |
260 } | 269 } |
261 | 270 |
262 return m_client->process(this, vecbuf, timestamp); | 271 try { |
272 return m_client->process(this, vecbuf, timestamp); | |
273 } catch (const std::exception &e) { | |
274 m_state = Failed; | |
275 throw; | |
276 } | |
263 } | 277 } |
264 | 278 |
265 virtual FeatureSet getRemainingFeatures() { | 279 virtual FeatureSet getRemainingFeatures() { |
266 | 280 |
267 if (m_state == Failed) { | 281 if (m_state == Failed) { |
276 throw std::logic_error("Plugin has already been disposed of"); | 290 throw std::logic_error("Plugin has already been disposed of"); |
277 } | 291 } |
278 | 292 |
279 m_state = Finished; | 293 m_state = Finished; |
280 | 294 |
281 return m_client->finish(this); | 295 try { |
296 return m_client->finish(this); | |
297 } catch (const std::exception &e) { | |
298 m_state = Failed; | |
299 throw; | |
300 } | |
282 } | 301 } |
283 | 302 |
284 // Not Plugin methods, but needed by the PluginClient to support reloads: | 303 // Not Plugin methods, but needed by the PluginClient to support reloads: |
285 | 304 |
286 virtual float getInputSampleRate() const { | 305 virtual float getInputSampleRate() const { |