From 9e6dbac98ab9cd9f92a2700d783a935fb8828d87 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 20 Mar 2016 09:18:53 +0100 Subject: Move VST setup code to init function. --- plugin.h | 3 +++ pluginlv2.h | 3 +++ plugintest.cc | 1 + pluginvst.cc | 12 ++++++++---- pluginvst.h | 4 ++++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/plugin.h b/plugin.h index 0c58771..7864bb9 100644 --- a/plugin.h +++ b/plugin.h @@ -39,6 +39,9 @@ public: //! Implement this to create a new plugin instance. static Plugin* create(); + //! Init function for setting up plugin parameters. + virtual void init() = 0; + //! Get current free-wheel mode. virtual bool getFreeWheel() const = 0; diff --git a/pluginlv2.h b/pluginlv2.h index 61fef02..a1408fa 100644 --- a/pluginlv2.h +++ b/pluginlv2.h @@ -48,6 +48,9 @@ class PluginLV2 public: virtual ~PluginLV2() = default; + //! Not used in LV2 + void init() override {} + //! Get current free-wheel mode. bool getFreeWheel() const override; diff --git a/plugintest.cc b/plugintest.cc index 93debb2..283ba7b 100644 --- a/plugintest.cc +++ b/plugintest.cc @@ -53,6 +53,7 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) PluginTest::PluginTest(audioMasterCallback audioMaster) : PluginVST(audioMaster) { + init(); } #endif diff --git a/pluginvst.cc b/pluginvst.cc index 63b504e..33eb1b8 100644 --- a/pluginvst.cc +++ b/pluginvst.cc @@ -89,6 +89,14 @@ static uint32_t sdbm_hash(std::string input) // PluginVST::PluginVST(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 0, 0) +{ +} + +PluginVST::~PluginVST() +{ +} + +void PluginVST::init() { // virtual void setUniqueID (VstInt32 iD) // Must be called to set the plug-ins unique ID! @@ -132,10 +140,6 @@ PluginVST::PluginVST(audioMasterCallback audioMaster) } } -PluginVST::~PluginVST() -{ -} - void PluginVST::open() { // Called when plug-in is initialized. diff --git a/pluginvst.h b/pluginvst.h index 8e7334e..d4bd1a5 100644 --- a/pluginvst.h +++ b/pluginvst.h @@ -43,6 +43,10 @@ class PluginVST , public AudioEffectX { public: + //! Call this to set up number of inputs/outpus, unique id etc... + //! IMPORTANT: This must be called form the constructor. + void init() override; + //! Get current free-wheel mode. bool getFreeWheel() const override; -- cgit v1.2.3