Mercurial > hg > piper-cpp
diff vamp-client/qt/AutoPlugin.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 | 52322dde68ea |
line wrap: on
line diff
--- a/vamp-client/qt/AutoPlugin.h Tue Jan 31 14:07:18 2017 +0000 +++ b/vamp-client/qt/AutoPlugin.h Tue Jan 31 15:07:39 2017 +0000 @@ -38,12 +38,21 @@ #include "ProcessQtTransport.h" #include "../CapnpRRClient.h" +#include "../Exceptions.h" #include <cstdint> namespace piper_vamp { namespace client { +/** + * This "plugin" make the Piper client abstraction behave like a local + * Vamp plugin, with its own server that lasts only for the lifetime + * of this plugin and serves only it. + * + * Note that any method may throw ServerCrashed, RequestTimedOut or + * ProtocolError exceptions. + */ class AutoPlugin : public Vamp::Plugin { public: @@ -129,7 +138,14 @@ virtual bool initialise(size_t inputChannels, size_t stepSize, size_t blockSize) { - return getPlugin()->initialise(inputChannels, stepSize, blockSize); + try { + return getPlugin()->initialise(inputChannels, stepSize, blockSize); + } catch (const ServiceError &e) { + // Sadly, the Vamp API has taught hosts to try to divine + // initialisation problems from a bool return value alone + log(std::string("AutoPlugin: initialise failed: ") + e.what()); + return false; + } } virtual void reset() {