diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-03-20 09:18:53 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-03-20 09:18:53 +0100 |
commit | 9e6dbac98ab9cd9f92a2700d783a935fb8828d87 (patch) | |
tree | b3b79d1e532250e939012593b48488841c692d53 | |
parent | 86f236a025d3d5aae32d34eefc400ef16a76e0ef (diff) |
Move VST setup code to init function.
-rw-r--r-- | plugin.h | 3 | ||||
-rw-r--r-- | pluginlv2.h | 3 | ||||
-rw-r--r-- | plugintest.cc | 1 | ||||
-rw-r--r-- | pluginvst.cc | 12 | ||||
-rw-r--r-- | pluginvst.h | 4 |
5 files changed, 19 insertions, 4 deletions
@@ -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 @@ -90,6 +90,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! uint32_t hash = sdbm_hash(getId()); @@ -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; |