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

Classes

class  ComponentHandler
 
class  InputParameterChanges
 
struct  VST3EffectSettings
 

Functions

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")
 

Function Documentation

◆ ActivateMainAudioBuses()

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

Definition at line 96 of file VST3Wrapper.cpp.

97{
98 using namespace Steinberg;
99
100 constexpr int32 MaxChannelsPerAudioBus = 2;
101
102 std::vector<Vst::SpeakerArrangement> defaultInputSpeakerArrangements;
103 std::vector<Vst::SpeakerArrangement> defaultOutputSpeakerArrangements;
104
105 const auto processor = FUnknownPtr<Vst::IAudioProcessor>(&component);
106
107 for(int i = 0, count = component.getBusCount(Vst::kAudio, Vst::kInput); i < count; ++i)
108 {
109 Vst::BusInfo busInfo {};
110 Vst::SpeakerArrangement arrangement {0ull};
111
112 component.getBusInfo(Vst::kAudio, Vst::kInput, i, busInfo);
113
114 Vst::SpeakerArrangement defaultArragement {};
115 processor->getBusArrangement(Vst::kInput, i, defaultArragement);
116
117 arrangement =
118 busInfo.busType == Vst::kMain
119 ? GetBusArragementForChannels(busInfo.channelCount, defaultArragement)
120 : Vst::SpeakerArr::kEmpty;
121
122 component.activateBus(Vst::kAudio, Vst::kInput, i, busInfo.busType == Vst::kMain);
123 defaultInputSpeakerArrangements.push_back(arrangement);
124 }
125 for(int i = 0, count = component.getBusCount(Vst::kAudio, Vst::kOutput); i < count; ++i)
126 {
127 Vst::BusInfo busInfo {};
128 Vst::SpeakerArrangement arrangement {0ull};
129
130 component.getBusInfo(Vst::kAudio, Vst::kOutput, i, busInfo);
131
132 Vst::SpeakerArrangement defaultArragement {};
133 processor->getBusArrangement(Vst::kOutput, i, defaultArragement);
134
135 arrangement =
136 busInfo.busType == Vst::kMain
137 ? GetBusArragementForChannels(busInfo.channelCount, defaultArragement)
138 : Vst::SpeakerArr::kEmpty;
139
140 component.activateBus(Vst::kAudio, Vst::kOutput, i, busInfo.busType == Vst::kMain);
141 defaultOutputSpeakerArrangements.push_back(arrangement);
142 }
143 for(int i = 0, count = component.getBusCount(Vst::kEvent, Vst::kInput); i < count; ++i)
144 component.activateBus(Vst::kEvent, Vst::kInput, i, 0);
145 for(int i = 0, count = component.getBusCount(Vst::kEvent, Vst::kOutput); i < count; ++i)
146 component.activateBus(Vst::kEvent, Vst::kOutput, i, 0);
147
148 auto result = processor->setBusArrangements(
149 defaultInputSpeakerArrangements.empty() ? nullptr : defaultInputSpeakerArrangements.data(), defaultInputSpeakerArrangements.size(),
150 defaultOutputSpeakerArrangements.empty() ? nullptr : defaultOutputSpeakerArrangements.data(), defaultOutputSpeakerArrangements.size()
151 );
152
153 return result == kResultOk;
154}
Steinberg::Vst::SpeakerArrangement GetBusArragementForChannels(int32_t channelsCount, Steinberg::Vst::SpeakerArrangement defaultArragment)
Definition: VST3Wrapper.cpp:28

References GetBusArragementForChannels().

Referenced by SetupProcessing().

Here is the call graph for this function:
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 28 of file VST3Wrapper.cpp.

30{
31 if (channelsCount == 1)
32 return defaultArragment;
33
34 return Steinberg::Vst::SpeakerArr::kStereo;
35}

Referenced by ActivateMainAudioBuses().

Here is the caller graph for this function:

◆ GetSettings() [1/2]

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

Definition at line 87 of file VST3Wrapper.cpp.

88{
89 auto vst3settings = settings.cast<VST3EffectSettings>();
90 assert(vst3settings);
91 return *vst3settings;
92}
static Settings & settings()
Definition: TrackInfo.cpp:87

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 80 of file VST3Wrapper.cpp.

81{
82 auto vst3settings = settings.cast<VST3EffectSettings>();
83 assert(vst3settings);
84 return *vst3settings;
85}

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 48 of file VST3Wrapper.cpp.

49{
50 std::map<Steinberg::Vst::ParamID, Steinberg::Vst::ParamValue> result;
51 wxStringTokenizer tokenizer(str, ";");
52 while(tokenizer.HasMoreTokens())
53 {
54 auto token = tokenizer.GetNextToken();
55
56 const auto split = token.Find('=');
57 if(split == wxNOT_FOUND)
58 continue;
59
60 unsigned long id;
61 double value;
62 if(!token.Left(split).ToULong(&id) ||
63 !token.Right(token.Length() - split - 1).ToDouble(&value))
64 continue;
65
66 result[id] = value;
67 }
68 return result;
69}
#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 71 of file VST3Wrapper.cpp.

72{
73 wxString result;
74 for(auto& p : params)
75 result.Append(wxString::Format(
76 "%lu=%f;", static_cast<unsigned long>(p.first), p.second));
77 return result;
78}
EffectDistortionSettings params
Definition: Distortion.cpp:75

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 157 of file VST3Wrapper.cpp.

158{
159 using namespace Steinberg;
160 auto processor = FUnknownPtr<Vst::IAudioProcessor>(&component);
161
162 if(processor->setupProcessing(setup) == kResultOk)
163 {
164 //We don't (yet) support custom input/output channel configuration
165 //on the host side. No support for event bus. Use default bus and
166 //channel configuration
167 return ActivateMainAudioBuses(component);
168 }
169 return false;
170}
bool ActivateMainAudioBuses(Steinberg::Vst::IComponent &component)
Definition: VST3Wrapper.cpp:96

References ActivateMainAudioBuses().

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

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