4 #include <ossia/detail/flat_map.hpp>
8 #include <pluginterfaces/base/funknown.h>
9 #include <pluginterfaces/gui/iplugview.h>
10 #include <pluginterfaces/vst/ivstaudioprocessor.h>
11 #include <pluginterfaces/vst/ivstcomponent.h>
12 #include <pluginterfaces/vst/ivstunits.h>
14 #include <string_view>
16 #include <public.sdk/source/vst/hosting/hostclasses.h>
17 #include <public.sdk/source/vst/hosting/module.h>
18 #include <public.sdk/source/vst/hosting/plugprovider.h>
22 class ApplicationPlugin;
25 inline QString fromString(
const Steinberg::Vst::String128& str)
28 return [] <
typename T>(
const T& str) {
29 using char_type = std::decay_t<decltype(str[0])>;
30 if constexpr(std::is_same_v<char_type, char16_t>)
31 return QString::fromUtf16(str);
33 return QString::fromWCharArray(str);
36 return QString::fromUtf16(str);
40 using MIDIControls = ossia::flat_map<std::pair<int, int>, Steinberg::Vst::ParamID>;
54 const VST3::UID& uid,
double sr,
int max_bs);
55 operator bool()
const noexcept {
return component && processor; }
58 VST3::Hosting::Module::Ptr mdl;
59 Steinberg::Vst::IComponent* component{};
60 Steinberg::Vst::IAudioProcessor* processor{};
61 Steinberg::Vst::IEditController* controller{};
62 Steinberg::Vst::IUnitInfo* units{};
63 Steinberg::IPlugView* view{};
70 void loadProcessorStateToController();
72 void start(
double sample_rate,
int max_bs);
75 bool supportsDouble{};
82 MIDIControls midiControls{};
84 Steinberg::Vst::ProgramListInfo programs;
87 #if __cpp_concepts >= 201907
89 concept BusVisitor = requires(T&& vis)
91 vis.audioIn(Steinberg::Vst::BusInfo{},
int{});
92 vis.audioOut(Steinberg::Vst::BusInfo{},
int{});
93 vis.eventIn(Steinberg::Vst::BusInfo{},
int{});
94 vis.eventOut(Steinberg::Vst::BusInfo{},
int{});
96 void forEachBus(BusVisitor
auto&& visitor, Steinberg::Vst::IComponent& component)
99 void forEachBus(T&& visitor, Steinberg::Vst::IComponent& component)
103 =
component.getBusCount(Steinberg::Vst::kAudio, Steinberg::Vst::kInput);
105 =
component.getBusCount(Steinberg::Vst::kEvent, Steinberg::Vst::kInput);
107 =
component.getBusCount(Steinberg::Vst::kAudio, Steinberg::Vst::kOutput);
109 =
component.getBusCount(Steinberg::Vst::kEvent, Steinberg::Vst::kOutput);
111 Steinberg::Vst::BusInfo bus;
112 for(
int i = 0; i < audio_ins; i++)
114 component.getBusInfo(Steinberg::Vst::kAudio, Steinberg::Vst::kInput, i, bus);
115 visitor.audioIn(bus, i);
118 for(
int i = 0; i < event_ins; i++)
120 component.getBusInfo(Steinberg::Vst::kEvent, Steinberg::Vst::kInput, i, bus);
121 visitor.eventIn(bus, i);
124 for(
int i = 0; i < audio_outs; i++)
126 component.getBusInfo(Steinberg::Vst::kAudio, Steinberg::Vst::kOutput, i, bus);
127 visitor.audioOut(bus, i);
130 for(
int i = 0; i < event_outs; i++)
132 component.getBusInfo(Steinberg::Vst::kEvent, Steinberg::Vst::kOutput, i, bus);
133 visitor.eventOut(bus, i);
Definition: score-plugin-vst3/Vst3/ApplicationPlugin.hpp:86
Definition: score-plugin-vst3/Vst3/EffectModel.hpp:41
T & component(const score::Components &c)
component Fetch a Component from Components by type
Definition: ComponentUtils.hpp:20
Definition: Plugin.hpp:43