iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
IPlugVST3_Controller.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the iPlug 2 library. Copyright (C) the iPlug 2 developers.
5
6 See LICENSE.txt for more info.
7
8 ==============================================================================
9*/
10
11#ifndef _IPLUGAPI_
12#define _IPLUGAPI_
13
19#undef stricmp
20#undef strnicmp
21#include "public.sdk/source/vst/vsteditcontroller.h"
22#include "pluginterfaces/vst/ivstchannelcontextinfo.h"
23
24#include "IPlugAPIBase.h"
25
26#include "IPlugVST3_View.h"
27#include "IPlugVST3_ControllerBase.h"
28#include "IPlugVST3_Common.h"
29
30BEGIN_IPLUG_NAMESPACE
31
34class IPlugVST3Controller : public Steinberg::Vst::EditControllerEx1
35 , public Steinberg::Vst::IMidiMapping
36 , public Steinberg::Vst::ChannelContext::IInfoListener
37 , public IPlugAPIBase
39{
40public:
41 using ViewType = IPlugVST3View<IPlugVST3Controller>;
42
43 struct InstanceInfo
44 {
45 Steinberg::FUID mOtherGUID;
46 };
47
48 IPlugVST3Controller(const InstanceInfo& info, const Config& config);
49 virtual ~IPlugVST3Controller();
50
51 // IEditController
52 Steinberg::tresult PLUGIN_API initialize(Steinberg::FUnknown* context) override;
53#if defined OS_LINUX
54 Steinberg::tresult PLUGIN_API terminate() override;
55 bool EnsureLinuxIdleTimer(Steinberg::FUnknown* context);
56#endif
57 Steinberg::IPlugView* PLUGIN_API createView(Steinberg::FIDString name) override;
58 Steinberg::tresult PLUGIN_API setComponentState(Steinberg::IBStream* pState) override; // receives the processor's state
59 Steinberg::tresult PLUGIN_API setState(Steinberg::IBStream* pState) override;
60 Steinberg::tresult PLUGIN_API getState(Steinberg::IBStream* pState) override;
61
62 Steinberg::Vst::ParamValue PLUGIN_API getParamNormalized (Steinberg::Vst::ParamID tag) override;
63 Steinberg::tresult PLUGIN_API setParamNormalized(Steinberg::Vst::ParamID tag, Steinberg::Vst::ParamValue value) override;
64 // ComponentBase
65 Steinberg::tresult PLUGIN_API notify(Steinberg::Vst::IMessage* message) override;
66
67 // IMidiMapping
68 Steinberg::tresult PLUGIN_API getMidiControllerAssignment(Steinberg::int32 busIndex, Steinberg::int16 channel, Steinberg::Vst::CtrlNumber midiCCNumber, Steinberg::Vst::ParamID& tag) override;
69
70 // IUnitInfo
71 Steinberg::tresult PLUGIN_API getProgramName(Steinberg::Vst::ProgramListID listId, Steinberg::int32 programIndex, Steinberg::Vst::String128 name /*out*/) override
72 {
73 return GetProgramName(this, listId, programIndex, name);
74 }
75
76 Steinberg::int32 PLUGIN_API getProgramListCount() override
77 {
78 return GetProgramListCount(this);
79 }
80
81 Steinberg::tresult PLUGIN_API getProgramListInfo(Steinberg::int32 listIndex, Steinberg::Vst::ProgramListInfo& info) override
82 {
83 return GetProgramListInfo(this, listIndex, info);
84 }
85
86 // IInfoListener
87 Steinberg::tresult PLUGIN_API setChannelContextInfos(Steinberg::Vst::IAttributeList* list) override;
88
90 void GetTrackColor(int& r, int& g, int& b) override { r = (mChannelColor>>16)&0xff; g = (mChannelColor>>8)&0xff; b = mChannelColor&0xff; };
91
93 void GetTrackName(WDL_String& str) override { str = mChannelName; };
94
96 int GetTrackIndex() override { return mChannelIndex; };
97
99 void GetTrackNamespace(WDL_String& str) override { str = mChannelNamespace; };
100
102 int GetTrackNamespaceIndex() override { return mChannelNamespaceIndex; };
103
104 // Interface
105 OBJ_METHODS(IPlugVST3Controller, EditControllerEx1)
106 DEFINE_INTERFACES
107 DEF_INTERFACE(IMidiMapping)
108 DEF_INTERFACE(IInfoListener)
109 END_DEFINE_INTERFACES(EditControllerEx1)
110 REFCOUNT_METHODS(EditControllerEx1)
111
112 // IPlugAPIBase
113 void BeginInformHostOfParamChange(int idx) override { beginEdit(idx); }
114 void InformHostOfParamChange(int idx, double normalizedValue) override { performEdit(idx, normalizedValue); }
115 void EndInformHostOfParamChange(int idx) override { endEdit(idx); }
116 void InformHostOfPresetChange() override { /* TODO: */}
118 bool EditorResize(int viewWidth, int viewHeight) override;
119 void DirtyParametersFromUI() override;
120
121 // IEditorDelegate
122 void SendMidiMsgFromUI(const IMidiMsg& msg) override;
123 void SendSysexMsgFromUI(const ISysEx& msg) override;
124 void SendArbitraryMsgFromUI(int msgTag, int ctrlTag = kNoTag, int dataSize = 0, const void* pData = nullptr) override;
125 void SendParameterValueFromUI(int paramIdx, double normalisedValue) override;
126
127 Steinberg::Vst::IComponentHandler* GetComponentHandler() const { return componentHandler; }
128 ViewType* GetView() const { return mView; }
129
130private:
131#if defined OS_LINUX
132 Steinberg::IPtr<IPlugVST3Timer> mLinuxIdleTimer;
133#endif
134 ViewType* mView = nullptr;
135 bool mPlugIsInstrument;
136 bool mDoesMidiIn;
137 Steinberg::FUID mProcessorGUID;
138};
139
140END_IPLUG_NAMESPACE
141
142#endif // _IPLUGAPI_
The base class of an IPlug plug-in, which interacts with the different plug-in APIs.
Definition: IPlugAPIBase.h:43
Shared VST3 controller code.
void UpdateParameterDetails(IPlugAPIBase *pPlug, Steinberg::Vst::IComponentHandler *pHandler)
Refreshes the VST3 parameter infos and values from the IParams and tells the host to re-read them.
VST3 Controller API-base class for a distributed IPlug VST3 plug-in.
void GetTrackColor(int &r, int &g, int &b) override
Get the color of the track that the plug-in is inserted on.
void DirtyParametersFromUI() override
In a distributed VST3 or WAM plugin, if you modify the parameters on the UI side (e....
void GetTrackName(WDL_String &str) override
Get the name of the track that the plug-in is inserted on.
int GetTrackNamespaceIndex() override
Get the namespace index of the track that the plug-in is inserted on.
int GetTrackIndex() override
Get the index of the track that the plug-in is inserted on.
void EndInformHostOfParamChange(int idx) override
Implemented by the API class, called by the UI (or by a delegate) at the end of a parameter change ge...
void GetTrackNamespace(WDL_String &str) override
Get the namespace of the track that the plug-in is inserted on.
void InformHostOfPresetChange() override
Implemented by the API class, called by the UI (etc) when the plug-in initiates a program/preset chan...
DEFINE_INTERFACES void BeginInformHostOfParamChange(int idx) override
Implemented by the API class, called by the UI (or by a delegate) at the beginning of a parameter cha...
void InformHostOfParameterDetailsChange() override
Implemented by the API class.
void InformHostOfParamChange(int idx, double normalizedValue) override
Implemented by the API class, called by the UI via SetParameterValue() with the value of a parameter ...
bool EditorResize(int viewWidth, int viewHeight) override
Implementations call into the APIs resize hooks returns a bool to indicate whether the DAW or plugin ...
Encapsulates a MIDI message and provides helper functions.
Definition: IPlugMidi.h:31
A struct for dealing with SysEx messages.
Definition: IPlugMidi.h:539