summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2016-07-14 11:57:30 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2016-07-14 16:35:07 +0200
commit53b6cbafc8923cb6e305a7e868b502069ece5177 (patch)
treea834a789438b4599a818456b98685a69599b1005
parent1be0af889aaf6d3baba1cad14914a5771c66839c (diff)
Introduce VST plugin information.
-rw-r--r--plugin.h25
-rw-r--r--pluginlv2.h9
-rw-r--r--pluginvst.cc52
-rw-r--r--pluginvst.h30
4 files changed, 109 insertions, 7 deletions
diff --git a/plugin.h b/plugin.h
index 7864bb9..6519827 100644
--- a/plugin.h
+++ b/plugin.h
@@ -33,6 +33,23 @@
class MidiEvent;
+//! Contains the same plugin categories as the VST enum VstPlugCategory
+enum class PluginCategory
+{
+ Unknown = 0, // Unknown, category not implemented
+ Effect, // Simple Effect
+ Synth, // VST Instrument (Synths, samplers,...)
+ Analysis, // Scope, Tuner, ...
+ Mastering, // Dynamics, ...
+ Spacializer, // Panners, ...
+ RoomFx, // Delays and Reverbs
+ SurroundFx, // Dedicated surround processor
+ Restoration, // Denoiser, ...
+ OfflineProcess, // Offline Process
+ Shell, // Plug-in is container of other plug-ins
+ Generator // ToneGenerator, ...
+};
+
//! Abstract base-class for plugin implementations.
class Plugin {
public:
@@ -46,7 +63,7 @@ public:
virtual bool getFreeWheel() const = 0;
//! This method is called by the host when the free-wheel mode changes.
- virtual void onFreeWheelChange(bool freewheel) = 0;
+ virtual void onFreeWheelChange(bool freewheel) {}
//! Call this to get current samplerate.
@@ -106,6 +123,12 @@ public:
//! Get unique plugin id.
virtual std::string getId() = 0;
+ // Functions used to set plugin information for VST
+ virtual std::string effectName() = 0;
+ virtual std::string vendorString() = 0;
+ virtual std::string productString() = 0;
+ virtual PluginCategory pluginCategory() = 0;
+
//! Process callback.
virtual void process(std::size_t pos,
const std::vector<MidiEvent>& input_events,
diff --git a/pluginlv2.h b/pluginlv2.h
index a1408fa..2c91dcc 100644
--- a/pluginlv2.h
+++ b/pluginlv2.h
@@ -54,9 +54,6 @@ public:
//! Get current free-wheel mode.
bool getFreeWheel() const override;
- //! This method is called by the host when the free-wheel mode changes.
- virtual void onFreeWheelChange(bool freewheel) override = 0;
-
//! Call this to get current samplerate.
float getSamplerate() override;
@@ -115,6 +112,12 @@ public:
//! Get unique plugin id.
std::string getId() override = 0;
+ // Functions used to set plugin information for VST
+ std::string effectName() override = 0;
+ std::string vendorString() override = 0;
+ std::string productString() override = 0;
+ PluginCategory pluginCategory() override = 0;
+
virtual void process(std::size_t pos,
const std::vector<MidiEvent>& input_events,
std::vector<MidiEvent>& output_events,
diff --git a/pluginvst.cc b/pluginvst.cc
index 7de518e..66dc9b7 100644
--- a/pluginvst.cc
+++ b/pluginvst.cc
@@ -133,6 +133,9 @@ void PluginVST::init()
AudioEffectX::isSynth(getNumberOfMidiInputs() > 0);
+ // We might produce output when there is no input.
+ AudioEffectX::noTail(false);
+
if(hasGUI())
{
editor = std::make_shared<UI>(*this);
@@ -217,6 +220,55 @@ void PluginVST::setBlockSize(VstInt32 blockSize)
onFramesizeChange(blockSize);
}
+bool PluginVST::getEffectName(char* name)
+{
+ vst_strncpy (name, this->effectName().c_str(), kVstMaxEffectNameLen);
+ return true;
+}
+
+bool PluginVST::getVendorString(char* text)
+{
+ vst_strncpy (text, this->vendorString().c_str(), kVstMaxVendorStrLen);
+ return true;
+}
+
+bool PluginVST::getProductString(char* text)
+{
+ vst_strncpy (text, this->productString().c_str(), kVstMaxProductStrLen);
+ return true;
+}
+
+VstPlugCategory PluginVST::getPlugCategory()
+{
+ switch(this->pluginCategory())
+ {
+ case PluginCategory::Unknown:
+ return kPlugCategUnknown;
+ case PluginCategory::Effect:
+ return kPlugCategEffect;
+ case PluginCategory::Synth:
+ return kPlugCategSynth;
+ case PluginCategory::Analysis:
+ return kPlugCategAnalysis;
+ case PluginCategory::Mastering:
+ return kPlugCategMastering;
+ case PluginCategory::Spacializer:
+ return kPlugCategSpacializer;
+ case PluginCategory::RoomFx:
+ return kPlugCategRoomFx;
+ case PluginCategory::SurroundFx:
+ return kPlugSurroundFx;
+ case PluginCategory::Restoration:
+ return kPlugCategRestoration;
+ case PluginCategory::OfflineProcess:
+ return kPlugCategOfflineProcess;
+ case PluginCategory::Shell:
+ return kPlugCategShell;
+ case PluginCategory::Generator:
+ return kPlugCategGenerator;
+ }
+}
+
VstInt32 PluginVST::processEvents(VstEvents* events)
{
// For each process cycle, processEvents() is called once before a
diff --git a/pluginvst.h b/pluginvst.h
index 2ae746a..e65a2ef 100644
--- a/pluginvst.h
+++ b/pluginvst.h
@@ -50,9 +50,6 @@ public:
//! Get current free-wheel mode.
bool getFreeWheel() const override;
- //! This method is called by the host when the free-wheel mode changes.
- virtual void onFreeWheelChange(bool freewheel) override = 0;
-
//! Call this to get current samplerate.
float getSamplerate() override;
@@ -109,9 +106,36 @@ public:
virtual std::size_t getNumberOfMidiOutputs() override = 0;
+
+ // VST plugin information
+
//! Get unique plugin id.
std::string getId() override = 0;
+ // Functions used to set plugin information for VST
+
+ //! Returns value which is then used by getEffectName
+ std::string effectName() override = 0;
+ //! Returns value which is then used by getVendorString
+ std::string vendorString() override = 0;
+ //! Returns value which is then used by getProductString
+ std::string productString() override = 0;
+ //! Returns value which is then used by getPlugCategory
+ PluginCategory pluginCategory() override = 0;
+
+ //! Fill \e text with a string identifying the effect
+ bool getEffectName(char* name);
+
+ //! Fill \e text with a string identifying the vendor
+ bool getVendorString(char* text);
+
+ //! Fill \e text with a string identifying the product name
+ bool getProductString(char* text);
+
+ //! Specify a category that fits the plug (#VstPlugCategory)
+ virtual VstPlugCategory getPlugCategory() override;
+
+
virtual void process(std::size_t pos,
const std::vector<MidiEvent>& input_events,
std::vector<MidiEvent>& output_events,