Mercurial > hg > vamp-plugin-sdk
changeset 500:4a86f866bb6b
The PluginRateExtractor hack was exploiting undefined behaviour. Let's just give in and make that API official
author | Chris Cannam |
---|---|
date | Mon, 11 Dec 2017 13:22:11 +0000 |
parents | 8ede825a54f6 |
children | 90571dcc371a d129bf797f24 |
files | src/vamp-hostsdk/PluginWrapper.cpp vamp-sdk/Plugin.h |
diffstat | 2 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/vamp-hostsdk/PluginWrapper.cpp Mon Dec 11 09:27:57 2017 +0000 +++ b/src/vamp-hostsdk/PluginWrapper.cpp Mon Dec 11 13:22:11 2017 +0000 @@ -42,15 +42,8 @@ namespace HostExt { -class PluginRateExtractor : public Plugin -{ -public: - PluginRateExtractor() : Plugin(0) { } - float getRate() const { return m_inputSampleRate; } -}; - PluginWrapper::PluginWrapper(Plugin *plugin) : - Plugin(((PluginRateExtractor *)plugin)->getRate()), + Plugin(plugin->getInputSampleRate()), m_plugin(plugin) { }
--- a/vamp-sdk/Plugin.h Mon Dec 11 09:27:57 2017 +0000 +++ b/vamp-sdk/Plugin.h Mon Dec 11 13:22:11 2017 +0000 @@ -437,6 +437,11 @@ */ virtual std::string getType() const { return "Feature Extraction Plugin"; } + /** + * Retrieve the input sample rate set on construction. + */ + float getInputSampleRate() const { return m_inputSampleRate; } + protected: Plugin(float inputSampleRate) : m_inputSampleRate(inputSampleRate) { }