summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2016-03-20 09:18:53 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2016-03-20 09:18:53 +0100
commit9e6dbac98ab9cd9f92a2700d783a935fb8828d87 (patch)
treeb3b79d1e532250e939012593b48488841c692d53
parent86f236a025d3d5aae32d34eefc400ef16a76e0ef (diff)
Move VST setup code to init function.
-rw-r--r--plugin.h3
-rw-r--r--pluginlv2.h3
-rw-r--r--plugintest.cc1
-rw-r--r--pluginvst.cc12
-rw-r--r--pluginvst.h4
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
@@ -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;