comparison src/vamp-hostsdk/PluginWrapper.cpp @ 538:8ffb8985ae8f

Add ability to disown a wrapped plugin - making it possible to use the adapters in some situations involving managed pointers that didn't work previously
author Chris Cannam
date Thu, 23 Apr 2020 11:39:34 +0100
parents 4a86f866bb6b
children
comparison
equal deleted inserted replaced
537:b9422f3e63a4 538:8ffb8985ae8f
42 42
43 namespace HostExt { 43 namespace HostExt {
44 44
45 PluginWrapper::PluginWrapper(Plugin *plugin) : 45 PluginWrapper::PluginWrapper(Plugin *plugin) :
46 Plugin(plugin->getInputSampleRate()), 46 Plugin(plugin->getInputSampleRate()),
47 m_plugin(plugin) 47 m_plugin(plugin),
48 m_pluginIsOwned(true)
48 { 49 {
49 } 50 }
50 51
51 PluginWrapper::~PluginWrapper() 52 PluginWrapper::~PluginWrapper()
52 { 53 {
53 delete m_plugin; 54 if (m_pluginIsOwned) {
55 delete m_plugin;
56 }
57 }
58
59 void
60 PluginWrapper::disownPlugin()
61 {
62 m_pluginIsOwned = false;
54 } 63 }
55 64
56 bool 65 bool
57 PluginWrapper::initialise(size_t channels, size_t stepSize, size_t blockSize) 66 PluginWrapper::initialise(size_t channels, size_t stepSize, size_t blockSize)
58 { 67 {