Mercurial > hg > piper-cpp
comparison vamp-client/stub.h @ 88:bf2e6f939f9f
Rename, + adjust finish
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Wed, 12 Oct 2016 19:02:31 +0100 |
parents | db9a6ab618bc |
children |
comparison
equal
deleted
inserted
replaced
87:7a77a374b6b2 | 88:bf2e6f939f9f |
---|---|
8 | 8 |
9 namespace piper { //!!! should be something else | 9 namespace piper { //!!! should be something else |
10 | 10 |
11 class PiperStubPlugin; | 11 class PiperStubPlugin; |
12 | 12 |
13 class PiperClientBase | 13 class PiperClientStubRequirements |
14 { | 14 { |
15 public: | 15 public: |
16 virtual | 16 virtual |
17 Vamp::Plugin::OutputList | 17 Vamp::Plugin::OutputList |
18 configure(PiperStubPlugin *plugin, | 18 configure(PiperStubPlugin *plugin, |
33 enum State { | 33 enum State { |
34 Loaded, Configured, Finished | 34 Loaded, Configured, Finished |
35 }; | 35 }; |
36 | 36 |
37 public: | 37 public: |
38 PiperStubPlugin(PiperClientBase *client, | 38 PiperStubPlugin(PiperClientStubRequirements *client, |
39 float inputSampleRate, | 39 float inputSampleRate, |
40 Vamp::HostExt::PluginStaticData psd, | 40 Vamp::HostExt::PluginStaticData psd, |
41 Vamp::HostExt::PluginConfiguration defaultConfig) : | 41 Vamp::HostExt::PluginConfiguration defaultConfig) : |
42 Plugin(inputSampleRate), | 42 Plugin(inputSampleRate), |
43 m_client(client), | 43 m_client(client), |
47 m_config(defaultConfig) | 47 m_config(defaultConfig) |
48 { } | 48 { } |
49 | 49 |
50 virtual ~PiperStubPlugin() { | 50 virtual ~PiperStubPlugin() { |
51 if (m_state != Finished) { | 51 if (m_state != Finished) { |
52 std::cerr << "WARNING: PiperStubPlugin destroyed without finish() call, may be a server-side resource leak" << std::endl; | 52 (void)m_client->finish(this); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 virtual std::string getIdentifier() const { | 56 virtual std::string getIdentifier() const { |
57 return m_psd.basic.identifier; | 57 return m_psd.basic.identifier; |
213 | 213 |
214 return m_client->finish(this); | 214 return m_client->finish(this); |
215 } | 215 } |
216 | 216 |
217 private: | 217 private: |
218 PiperClientBase *m_client; | 218 PiperClientStubRequirements *m_client; |
219 State m_state; | 219 State m_state; |
220 Vamp::HostExt::PluginStaticData m_psd; | 220 Vamp::HostExt::PluginStaticData m_psd; |
221 OutputList m_outputs; | 221 OutputList m_outputs; |
222 Vamp::HostExt::PluginConfiguration m_defaultConfig; | 222 Vamp::HostExt::PluginConfiguration m_defaultConfig; |
223 Vamp::HostExt::PluginConfiguration m_config; | 223 Vamp::HostExt::PluginConfiguration m_config; |