Mercurial > hg > piper-cpp
comparison vamp-client/PiperStubPlugin.h @ 91:c897c9a8daf1
Implement reset()
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Thu, 13 Oct 2016 11:33:19 +0100 |
parents | 6429a99abcad |
children |
comparison
equal
deleted
inserted
replaced
90:6429a99abcad | 91:c897c9a8daf1 |
---|---|
19 Loaded, Configured, Finished | 19 Loaded, Configured, Finished |
20 }; | 20 }; |
21 | 21 |
22 public: | 22 public: |
23 PiperStubPlugin(PiperStubPluginClientInterface *client, | 23 PiperStubPlugin(PiperStubPluginClientInterface *client, |
24 std::string pluginKey, | |
24 float inputSampleRate, | 25 float inputSampleRate, |
26 int adapterFlags, | |
25 Vamp::HostExt::PluginStaticData psd, | 27 Vamp::HostExt::PluginStaticData psd, |
26 Vamp::HostExt::PluginConfiguration defaultConfig) : | 28 Vamp::HostExt::PluginConfiguration defaultConfig) : |
27 Plugin(inputSampleRate), | 29 Plugin(inputSampleRate), |
28 m_client(client), | 30 m_client(client), |
31 m_key(pluginKey), | |
32 m_adapterFlags(adapterFlags), | |
29 m_state(Loaded), | 33 m_state(Loaded), |
30 m_psd(psd), | 34 m_psd(psd), |
31 m_defaultConfig(defaultConfig), | 35 m_defaultConfig(defaultConfig), |
32 m_config(defaultConfig) | 36 m_config(defaultConfig) |
33 { } | 37 { } |
35 virtual ~PiperStubPlugin() { | 39 virtual ~PiperStubPlugin() { |
36 if (m_state != Finished) { | 40 if (m_state != Finished) { |
37 (void)m_client->finish(this); | 41 (void)m_client->finish(this); |
38 } | 42 } |
39 } | 43 } |
40 | 44 |
41 virtual std::string getIdentifier() const { | 45 virtual std::string getIdentifier() const { |
42 return m_psd.basic.identifier; | 46 return m_psd.basic.identifier; |
43 } | 47 } |
44 | 48 |
45 virtual std::string getName() const { | 49 virtual std::string getName() const { |
117 return false; | 121 return false; |
118 } | 122 } |
119 } | 123 } |
120 | 124 |
121 virtual void reset() { | 125 virtual void reset() { |
122 //!!! hm, how to deal with this? there is no reset() in Piper! | 126 |
123 throw "Please do not call this function again."; | 127 if (m_state == Loaded) { |
128 // reset is a no-op if the plugin hasn't been initialised yet | |
129 return; | |
130 } | |
131 | |
132 m_client->reset(this, m_config); | |
133 | |
134 m_state = Configured; | |
124 } | 135 } |
125 | 136 |
126 virtual InputDomain getInputDomain() const { | 137 virtual InputDomain getInputDomain() const { |
127 return m_psd.inputDomain; | 138 return m_psd.inputDomain; |
128 } | 139 } |
196 | 207 |
197 m_state = Finished; | 208 m_state = Finished; |
198 | 209 |
199 return m_client->finish(this); | 210 return m_client->finish(this); |
200 } | 211 } |
212 | |
213 // Not Plugin methods, but needed by the PiperClient to support reloads: | |
214 | |
215 virtual float getInputSampleRate() const { | |
216 return m_inputSampleRate; | |
217 } | |
218 | |
219 virtual std::string getPluginKey() const { | |
220 return m_key; | |
221 } | |
222 | |
223 virtual int getAdapterFlags() const { | |
224 return m_adapterFlags; | |
225 } | |
201 | 226 |
202 private: | 227 private: |
203 PiperStubPluginClientInterface *m_client; | 228 PiperStubPluginClientInterface *m_client; |
229 std::string m_key; | |
230 int m_adapterFlags; | |
204 State m_state; | 231 State m_state; |
205 Vamp::HostExt::PluginStaticData m_psd; | 232 Vamp::HostExt::PluginStaticData m_psd; |
206 OutputList m_outputs; | 233 OutputList m_outputs; |
207 Vamp::HostExt::PluginConfiguration m_defaultConfig; | 234 Vamp::HostExt::PluginConfiguration m_defaultConfig; |
208 Vamp::HostExt::PluginConfiguration m_config; | 235 Vamp::HostExt::PluginConfiguration m_config; |