diff widgets/PluginParameterBox.cpp @ 1581:11660e0c896f audio-source-refactor

Use shared_ptr for plugin instances throughout; also descriptors are copyable
author Chris Cannam
date Fri, 20 Mar 2020 16:31:23 +0000
parents c8a6fd3f9dff
children 19da7fa80c3c
line wrap: on
line diff
--- a/widgets/PluginParameterBox.cpp	Fri Jan 24 15:11:08 2020 +0000
+++ b/widgets/PluginParameterBox.cpp	Fri Mar 20 16:31:23 2020 +0000
@@ -34,7 +34,8 @@
 
 #include <cmath>
 
-PluginParameterBox::PluginParameterBox(Vamp::PluginBase *plugin, QWidget *parent) :
+PluginParameterBox::PluginParameterBox(std::shared_ptr<Vamp::PluginBase> plugin,
+                                       QWidget *parent) :
     QFrame(parent),
     m_plugin(plugin),
     m_programCombo(nullptr)
@@ -100,7 +101,7 @@
         float value = m_plugin->getParameter(params[i].identifier);
 
         int hint = PortHint::NoHint;
-        RealTimePluginInstance *rtpi = dynamic_cast<RealTimePluginInstance *>
+        auto rtpi = std::dynamic_pointer_cast<RealTimePluginInstance>
             (m_plugin);
         if (rtpi) {
             hint = rtpi->getParameterDisplayHint(i);