Audacity 3.2.0
Classes | Functions | Variables
anonymous_namespace{VST3Wrapper.cpp} Namespace Reference

Classes

class  ComponentHandler
 
class  InputParameterChanges
 
struct  VST3EffectSettings
 
struct  VST3PluginCache
 

Functions

VST3PluginCacheGetCache (const VST3::UID &effectUid)
 
VST3PluginCacheCreateCache (const VST3::UID &effectUid)
 
Steinberg::Vst::SpeakerArrangement GetBusArragementForChannels (int32_t channelsCount, Steinberg::Vst::SpeakerArrangement defaultArragment)
 
std::map< Steinberg::Vst::ParamID, Steinberg::Vst::ParamValue > ParametersFromString (const wxString &str)
 
wxString ParametersToString (const std::map< Steinberg::Vst::ParamID, Steinberg::Vst::ParamValue > &params)
 
VST3EffectSettingsGetSettings (EffectSettings &settings)
 
const VST3EffectSettingsGetSettings (const EffectSettings &settings)
 
bool ActivateMainAudioBuses (Steinberg::Vst::IComponent &component)
 
bool SetupProcessing (Steinberg::Vst::IComponent &component, Steinberg::Vst::ProcessSetup &setup)
 
 IMPLEMENT_FUNKNOWN_METHODS (InputParameterChanges, Steinberg::Vst::IParameterChanges, Steinberg::Vst::IParameterChanges::iid)
 

Variables

constexpr auto processorStateKey = wxT("ProcessorState")
 
constexpr auto controllerStateKey = wxT("ControllerState")
 
constexpr auto parametersKey = wxT("Parameters")
 
std::map< std::string, VST3PluginCachesVST3PluginCache
 

Function Documentation

◆ ActivateMainAudioBuses()

bool anonymous_namespace{VST3Wrapper.cpp}::ActivateMainAudioBuses ( Steinberg::Vst::IComponent &  component)

Definition at line 126 of file VST3Wrapper.cpp.

127{
128 using namespace Steinberg;
129
130 constexpr int32 MaxChannelsPerAudioBus = 2;
131
132 std::vector<Vst::SpeakerArrangement> defaultInputSpeakerArrangements;
133 std::vector<Vst::SpeakerArrangement> defaultOutputSpeakerArrangements;
134
135 const auto processor = FUnknownPtr<Vst::IAudioProcessor>(&component);
136
137 for(int i = 0, count = component.getBusCount(Vst::kAudio, Vst::kInput); i < count; ++i)
138 {
139 Vst::BusInfo busInfo {};
140 Vst::SpeakerArrangement arrangement {0ull};
141
142 component.getBusInfo(Vst::kAudio, Vst::kInput, i, busInfo);
143
144 Vst::SpeakerArrangement defaultArragement {};
145 processor->getBusArrangement(Vst::kInput, i, defaultArragement);
146
147 arrangement =
148 busInfo.busType == Vst::kMain
149 ? GetBusArragementForChannels(busInfo.channelCount, defaultArragement)
150 : defaultArragement;
151
152 component.activateBus(Vst::kAudio, Vst::kInput, i, busInfo.busType == Vst::kMain);
153 defaultInputSpeakerArrangements.push_back(arrangement);
154 }
155 for(int i = 0, count = component.getBusCount(Vst::kAudio, Vst::kOutput); i < count; ++i)
156 {
157 Vst::BusInfo busInfo {};
158 Vst::SpeakerArrangement arrangement {0ull};
159
160 component.getBusInfo(Vst::kAudio, Vst::kOutput, i, busInfo);
161
162 Vst::SpeakerArrangement defaultArragement {};
163 processor->getBusArrangement(Vst::kOutput, i, defaultArragement);
164
165 arrangement =
166 busInfo.busType == Vst::kMain
167 ? GetBusArragementForChannels(busInfo.channelCount, defaultArragement)
168 : defaultArragement;
169
170 component.activateBus(Vst::kAudio, Vst::kOutput, i, busInfo.busType == Vst::kMain);
171 defaultOutputSpeakerArrangements.push_back(arrangement);
172 }
173 for(int i = 0, count = component.getBusCount(Vst::kEvent, Vst::kInput); i < count; ++i)
174 component.activateBus(Vst::kEvent, Vst::kInput, i, 0);
175 for(int i = 0, count = component.getBusCount(Vst::kEvent, Vst::kOutput); i < count; ++i)
176 component.activateBus(Vst::kEvent, Vst::kOutput, i, 0);
177
178 auto result = processor->setBusArrangements(
179 defaultInputSpeakerArrangements.empty() ? nullptr : defaultInputSpeakerArrangements.data(), defaultInputSpeakerArrangements.size(),
180 defaultOutputSpeakerArrangements.empty() ? nullptr : defaultOutputSpeakerArrangements.data(), defaultOutputSpeakerArrangements.size()
181 );
182
183 return result == kResultOk;
184}
Steinberg::Vst::SpeakerArrangement GetBusArragementForChannels(int32_t channelsCount, Steinberg::Vst::SpeakerArrangement defaultArragment)
Definition: VST3Wrapper.cpp:58

References GetBusArragementForChannels().

Referenced by SetupProcessing().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateCache()

VST3PluginCache & anonymous_namespace{VST3Wrapper.cpp}::CreateCache ( const VST3::UID &  effectUid)

Definition at line 50 of file VST3Wrapper.cpp.

51{
52 const auto key = effectUid.toString();
53 assert(sVST3PluginCache.find(key) == sVST3PluginCache.end());
54 const auto result = sVST3PluginCache.insert(std::pair { key, VST3PluginCache {} });
55 return result.first->second;
56}
static const AudacityProject::AttachedObjects::RegisteredFactory key
std::map< std::string, VST3PluginCache > sVST3PluginCache
Definition: VST3Wrapper.cpp:39

References key, and sVST3PluginCache.

Referenced by VST3Wrapper::VST3Wrapper().

Here is the caller graph for this function:

◆ GetBusArragementForChannels()

Steinberg::Vst::SpeakerArrangement anonymous_namespace{VST3Wrapper.cpp}::GetBusArragementForChannels ( int32_t  channelsCount,
Steinberg::Vst::SpeakerArrangement  defaultArragment 
)

Definition at line 58 of file VST3Wrapper.cpp.

60{
61 if (channelsCount == 1)
62 return defaultArragment;
63
64 return Steinberg::Vst::SpeakerArr::kStereo;
65}

Referenced by ActivateMainAudioBuses().

Here is the caller graph for this function:

◆ GetCache()

VST3PluginCache * anonymous_namespace{VST3Wrapper.cpp}::GetCache ( const VST3::UID &  effectUid)

Definition at line 41 of file VST3Wrapper.cpp.

42{
43 const auto key = effectUid.toString();
44 auto it = sVST3PluginCache.find(key);
45 if(it != sVST3PluginCache.end())
46 return &it->second;
47 return nullptr;
48}

References key, and sVST3PluginCache.

Referenced by VST3Wrapper::FetchSettings(), VST3Wrapper::FindFactoryPresets(), VST3Wrapper::InitializeComponents(), VST3Wrapper::LoadPreset(), and VST3Wrapper::VST3Wrapper().

Here is the caller graph for this function:

◆ GetSettings() [1/2]

const VST3EffectSettings & anonymous_namespace{VST3Wrapper.cpp}::GetSettings ( const EffectSettings settings)

Definition at line 117 of file VST3Wrapper.cpp.

118{
119 auto vst3settings = settings.cast<VST3EffectSettings>();
120 assert(vst3settings);
121 return *vst3settings;
122}
static Settings & settings()
Definition: TrackInfo.cpp:47

References settings().

Referenced by VST3Wrapper::ConsumeChanges(), VST3Wrapper::CopySettingsContents(), VST3Wrapper::FetchSettings(), anonymous_namespace{VST3Wrapper.cpp}::ComponentHandler::FlushCache(), VST3Wrapper::FlushParameters(), VST3Wrapper::LoadSettings(), VST3Wrapper::LoadUserPreset(), anonymous_namespace{VST3Wrapper.cpp}::ComponentHandler::performEdit(), VST3Wrapper::SaveSettings(), VST3Wrapper::SaveUserPreset(), and VST3Wrapper::StoreSettings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSettings() [2/2]

VST3EffectSettings & anonymous_namespace{VST3Wrapper.cpp}::GetSettings ( EffectSettings settings)

Definition at line 110 of file VST3Wrapper.cpp.

111{
112 auto vst3settings = settings.cast<VST3EffectSettings>();
113 assert(vst3settings);
114 return *vst3settings;
115}

References settings().

Here is the call graph for this function:

◆ IMPLEMENT_FUNKNOWN_METHODS()

anonymous_namespace{VST3Wrapper.cpp}::IMPLEMENT_FUNKNOWN_METHODS ( InputParameterChanges  ,
Steinberg::Vst::IParameterChanges  ,
Steinberg::Vst::IParameterChanges::iid   
)

◆ ParametersFromString()

std::map< Steinberg::Vst::ParamID, Steinberg::Vst::ParamValue > anonymous_namespace{VST3Wrapper.cpp}::ParametersFromString ( const wxString &  str)

Definition at line 78 of file VST3Wrapper.cpp.

79{
80 std::map<Steinberg::Vst::ParamID, Steinberg::Vst::ParamValue> result;
81 wxStringTokenizer tokenizer(str, ";");
82 while(tokenizer.HasMoreTokens())
83 {
84 auto token = tokenizer.GetNextToken();
85
86 const auto split = token.Find('=');
87 if(split == wxNOT_FOUND)
88 continue;
89
90 unsigned long id;
91 double value;
92 if(!token.Left(split).ToULong(&id) ||
93 !token.Right(token.Length() - split - 1).ToDouble(&value))
94 continue;
95
96 result[id] = value;
97 }
98 return result;
99}
#define str(a)
int id

References id, and str.

Referenced by VST3Wrapper::LoadSettings(), and VST3Wrapper::LoadUserPreset().

Here is the caller graph for this function:

◆ ParametersToString()

wxString anonymous_namespace{VST3Wrapper.cpp}::ParametersToString ( const std::map< Steinberg::Vst::ParamID, Steinberg::Vst::ParamValue > &  params)

Definition at line 101 of file VST3Wrapper.cpp.

102{
103 wxString result;
104 for(auto& p : params)
105 result.Append(wxString::Format(
106 "%lu=%f;", static_cast<unsigned long>(p.first), p.second));
107 return result;
108}
EffectDistortionSettings params
Definition: Distortion.cpp:77

References params.

Referenced by VST3Wrapper::SaveSettings(), and VST3Wrapper::SaveUserPreset().

Here is the caller graph for this function:

◆ SetupProcessing()

bool anonymous_namespace{VST3Wrapper.cpp}::SetupProcessing ( Steinberg::Vst::IComponent &  component,
Steinberg::Vst::ProcessSetup &  setup 
)

Definition at line 187 of file VST3Wrapper.cpp.

188{
189 using namespace Steinberg;
190 auto processor = FUnknownPtr<Vst::IAudioProcessor>(&component);
191
192 if(processor->setupProcessing(setup) == kResultOk)
193 {
194 //We don't (yet) support custom input/output channel configuration
195 //on the host side. No support for event bus. Use default bus and
196 //channel configuration
197 return ActivateMainAudioBuses(component);
198 }
199 return false;
200}
bool ActivateMainAudioBuses(Steinberg::Vst::IComponent &component)

References ActivateMainAudioBuses().

Referenced by VST3Wrapper::FlushParameters(), VST3Wrapper::Initialize(), and VST3Wrapper::InitializeComponents().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ controllerStateKey

constexpr auto anonymous_namespace{VST3Wrapper.cpp}::controllerStateKey = wxT("ControllerState")
constexpr

◆ parametersKey

constexpr auto anonymous_namespace{VST3Wrapper.cpp}::parametersKey = wxT("Parameters")
constexpr

◆ processorStateKey

constexpr auto anonymous_namespace{VST3Wrapper.cpp}::processorStateKey = wxT("ProcessorState")
constexpr

◆ sVST3PluginCache

std::map<std::string, VST3PluginCache> anonymous_namespace{VST3Wrapper.cpp}::sVST3PluginCache

Definition at line 39 of file VST3Wrapper.cpp.

Referenced by CreateCache(), and GetCache().