diff widgets/PluginParameterDialog.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
line wrap: on
line diff
--- a/widgets/PluginParameterDialog.cpp	Fri Jan 24 15:11:08 2020 +0000
+++ b/widgets/PluginParameterDialog.cpp	Fri Mar 20 16:31:23 2020 +0000
@@ -43,7 +43,7 @@
 
 #include "base/Debug.h"
 
-PluginParameterDialog::PluginParameterDialog(Vamp::PluginBase *plugin,
+PluginParameterDialog::PluginParameterDialog(std::shared_ptr<Vamp::PluginBase> plugin,
                                              QWidget *parent) :
     QDialog(parent),
     m_plugin(plugin),
@@ -368,9 +368,7 @@
 
     if (showWindowSize) {
 
-        Vamp::Plugin *fePlugin = dynamic_cast<Vamp::Plugin *>(m_plugin);
-        if (!fePlugin) fePlugin = dynamic_cast<Vamp::PluginHostAdapter *>(m_plugin);
-        if (!fePlugin) fePlugin = dynamic_cast<Vamp::HostExt::PluginWrapper *>(m_plugin);
+        auto fePlugin = std::dynamic_pointer_cast<Vamp::Plugin>(m_plugin);
         int size = 1024;
         int increment = 1024;
         if (fePlugin) {