Audacity 3.2.0
|
Manages and interacts with an AudioUnit, providing operations on audio effects. More...
#include <AudioUnitWrapper.h>
Classes | |
class | ParameterInfo |
Encapsulates parameter information for an AudioUnit. More... | |
Public Types | |
using | Parameters = PackedArray::Ptr< const AudioUnitParameterID > |
using | ParameterVisitor = std::function< bool(const ParameterInfo &pi, AudioUnitParameterID ID) > |
Return value: if true, continue visiting. More... | |
Public Member Functions | |
AudioUnitWrapper (AudioComponent component, Parameters *pParameters) | |
template<typename T > | |
OSStatus | GetFixedSizeProperty (AudioUnitPropertyID inID, T &property, AudioUnitScope inScope=kAudioUnitScope_Global, AudioUnitElement inElement=0) const |
template<typename T > | |
OSStatus | GetVariableSizeProperty (AudioUnitPropertyID inID, PackedArray::Ptr< T > &pObject, AudioUnitScope inScope=kAudioUnitScope_Global, AudioUnitElement inElement=0) const |
template<typename T > | |
OSStatus | SetProperty (AudioUnitPropertyID inID, const T &property, AudioUnitScope inScope=kAudioUnitScope_Global, AudioUnitElement inElement=0) const |
void | ForEachParameter (ParameterVisitor visitor) const |
bool | LoadPreset (const EffectDefinitionInterface &effect, const RegistryPath &group, EffectSettings &settings) const |
bool | LoadFactoryPreset (const EffectDefinitionInterface &effect, int id, EffectSettings *pSettings) const |
std::pair< CF_ptr< CFDataRef >, TranslatableString > | MakeBlob (const EffectDefinitionInterface &effect, const AudioUnitEffectSettings &settings, const wxCFStringRef &cfname, bool binary) const |
Obtain dump of the setting state of an AudioUnit instance. More... | |
TranslatableString | InterpretBlob (AudioUnitEffectSettings &settings, const wxString &group, const wxMemoryBuffer &buf) const |
Interpret the dump made before by MakeBlob. More... | |
bool | FetchSettings (AudioUnitEffectSettings &settings, bool fetchValues, bool fetchPreset=false) const |
May allocate memory, so should be called only in the main thread. More... | |
bool | StoreSettings (const EffectDefinitionInterface &effect, const AudioUnitEffectSettings &settings) const |
bool | CreateAudioUnit () |
AudioUnit | GetAudioUnit () const |
AudioComponent | GetComponent () const |
const Parameters & | GetParameters () const |
bool | SetRateAndChannels (double sampleRate, const wxString &identifier) |
Static Public Member Functions | |
static AudioUnitEffectSettings & | GetSettings (EffectSettings &settings) |
static const AudioUnitEffectSettings & | GetSettings (const EffectSettings &settings) |
static bool | MoveSettingsContents (AudioUnitEffectSettings &&src, AudioUnitEffectSettings &dst, bool merge) |
Copy, then clear the optionals in src. More... | |
Protected Attributes | |
const AudioComponent | mComponent |
AudioUnitCleanup< AudioUnit, AudioComponentInstanceDispose > | mUnit |
Parameters | mOwnParameters |
Parameters & | mParameters |
unsigned | mAudioIns { 2 } |
unsigned | mAudioOuts { 2 } |
Manages and interacts with an AudioUnit, providing operations on audio effects.
This class hosts the functionality for managing AudioUnit settings, presets, and parameters, allowing manipulation of audio processing units.
Definition at line 90 of file AudioUnitWrapper.h.
using AudioUnitWrapper::Parameters = PackedArray::Ptr<const AudioUnitParameterID> |
Definition at line 92 of file AudioUnitWrapper.h.
using AudioUnitWrapper::ParameterVisitor = std::function< bool(const ParameterInfo &pi, AudioUnitParameterID ID) > |
Return value: if true, continue visiting.
Definition at line 142 of file AudioUnitWrapper.h.
|
inline |
pParameters | if non-null, use those; else, fetch from the AudioUnit |
Definition at line 101 of file AudioUnitWrapper.h.
bool AudioUnitWrapper::CreateAudioUnit | ( | ) |
Definition at line 265 of file AudioUnitWrapper.cpp.
References GetVariableSizeProperty(), mComponent, mOwnParameters, mParameters, and mUnit.
Referenced by AudioUnitInstance::AudioUnitInstance(), and AudioUnitEffectBase::InitializePlugin().
bool AudioUnitWrapper::FetchSettings | ( | AudioUnitEffectSettings & | settings, |
bool | fetchValues, | ||
bool | fetchPreset = false |
||
) | const |
May allocate memory, so should be called only in the main thread.
Definition at line 149 of file AudioUnitWrapper.cpp.
References ForEachParameter(), GetFixedSizeProperty(), mUnit, MIR::anonymous_namespace{MirUtils.cpp}::pi, preset, and settings().
Referenced by AudioUnitEditor::FetchSettingsFromInstance(), InterpretBlob(), LoadFactoryPreset(), AudioUnitInstance::MakeMessage(), and AudioUnitEffectBase::MakeSettings().
void AudioUnitWrapper::ForEachParameter | ( | ParameterVisitor | visitor | ) | const |
Definition at line 317 of file AudioUnitWrapper.cpp.
References mParameters, mUnit, and MIR::anonymous_namespace{MirUtils.cpp}::pi.
Referenced by FetchSettings(), StoreSettings(), and AudioUnitEffectBase::SupportsAutomation().
|
inline |
Definition at line 182 of file AudioUnitWrapper.h.
References mUnit.
Referenced by AudioUnitInstance::EventListener(), and AudioUnitEditor::Notify().
|
inline |
|
inline |
Definition at line 109 of file AudioUnitWrapper.h.
References AudioUnitUtils::GetFixedSizeProperty(), and mUnit.
Referenced by FetchSettings(), AudioUnitEffectBase::GetFactoryPresets(), AudioUnitInstance::InitialBlockSize(), AudioUnitEffectBase::InitializePlugin(), LoadFactoryPreset(), and MakeBlob().
|
inline |
|
static |
Definition at line 36 of file AudioUnitWrapper.cpp.
References GetSettings(), and settings().
|
static |
Definition at line 27 of file AudioUnitWrapper.cpp.
References settings().
Referenced by AudioUnitEffectBase::ChoosePresetKey(), AudioUnitEffect::ExportPresets(), AudioUnitEditor::FetchSettingsFromInstance(), GetSettings(), AudioUnitEffect::ImportPresets(), LoadFactoryPreset(), LoadPreset(), AudioUnitEffectBase::LoadSettings(), AudioUnitEffectBase::MigrateOldConfigFile(), AudioUnitEditor::OnIdle(), AudioUnitInstance::ProcessInitialize(), AudioUnitEffectBase::SaveSettings(), AudioUnitEffectBase::SaveUserPreset(), and AudioUnitEditor::StoreSettingsToInstance().
|
inline |
Definition at line 120 of file AudioUnitWrapper.h.
References AudioUnitUtils::GetVariableSizeProperty(), and mUnit.
Referenced by CreateAudioUnit(), and AudioUnitEffectBase::GetChannelCounts().
TranslatableString AudioUnitWrapper::InterpretBlob | ( | AudioUnitEffectSettings & | settings, |
const wxString & | group, | ||
const wxMemoryBuffer & | buf | ||
) | const |
Interpret the dump made before by MakeBlob.
group | only for formatting error messages |
Definition at line 279 of file AudioUnitWrapper.cpp.
References FetchSettings(), SetProperty(), settings(), and XO().
Referenced by AudioUnitEffectBase::Import(), and LoadPreset().
bool AudioUnitWrapper::LoadFactoryPreset | ( | const EffectDefinitionInterface & | effect, |
int | id, | ||
EffectSettings * | pSettings | ||
) | const |
Definition at line 351 of file AudioUnitWrapper.cpp.
References FactoryDefaultsGroup(), FetchSettings(), GetFixedSizeProperty(), GetSettings(), LoadPreset(), and SetProperty().
Referenced by AudioUnitEffectBase::LoadFactoryPreset(), AudioUnitEffectBase::LoadSettings(), and StoreSettings().
bool AudioUnitWrapper::LoadPreset | ( | const EffectDefinitionInterface & | effect, |
const RegistryPath & | group, | ||
EffectSettings & | settings | ||
) | const |
Definition at line 327 of file AudioUnitWrapper.cpp.
References PluginSettings::GetConfig(), GetSettings(), InterpretBlob(), PRESET_KEY, PluginSettings::Private, and settings().
Referenced by LoadFactoryPreset(), and AudioUnitEffectBase::LoadPreset().
std::pair< CF_ptr< CFDataRef >, TranslatableString > AudioUnitWrapper::MakeBlob | ( | const EffectDefinitionInterface & | effect, |
const AudioUnitEffectSettings & | settings, | ||
const wxCFStringRef & | cfname, | ||
bool | binary | ||
) | const |
Obtain dump of the setting state of an AudioUnit instance.
binary | if false, then produce XML serialization instead; but AudioUnits does not need to be told the format again to reinterpret the blob |
Definition at line 385 of file AudioUnitWrapper.cpp.
References GetFixedSizeProperty(), PRESET_FORMAT, SetProperty(), settings(), StoreSettings(), and XO().
Referenced by AudioUnitEffectBase::Export(), and AudioUnitEffectBase::SavePreset().
|
static |
Copy, then clear the optionals in src.
Definition at line 240 of file AudioUnitWrapper.cpp.
References key, and AudioUnitEffectSettings::values.
Referenced by anonymous_namespace{AudioUnitInstance.cpp}::AudioUnitMessage::Assign(), and anonymous_namespace{AudioUnitInstance.cpp}::AudioUnitMessage::Merge().
|
inline |
Definition at line 131 of file AudioUnitWrapper.h.
References mUnit, and AudioUnitUtils::SetProperty().
Referenced by AudioUnitInstance::BypassEffect(), InterpretBlob(), LoadFactoryPreset(), MakeBlob(), AudioUnitInstance::ProcessInitialize(), and SetRateAndChannels().
bool AudioUnitWrapper::SetRateAndChannels | ( | double | sampleRate, |
const wxString & | identifier | ||
) |
Definition at line 426 of file AudioUnitWrapper.cpp.
References mAudioIns, mAudioOuts, anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, anonymous_namespace{wxCommandTargets.cpp}::scope, and SetProperty().
Referenced by AudioUnitEffectBase::InitializePlugin(), and AudioUnitInstance::ProcessInitialize().
bool AudioUnitWrapper::StoreSettings | ( | const EffectDefinitionInterface & | effect, |
const AudioUnitEffectSettings & | settings | ||
) | const |
Definition at line 189 of file AudioUnitWrapper.cpp.
References ForEachParameter(), LoadFactoryPreset(), MIR::anonymous_namespace{MirUtils.cpp}::pi, and settings().
Referenced by MakeBlob(), AudioUnitInstance::ProcessInitialize(), and AudioUnitEditor::StoreSettingsToInstance().
|
protected |
Definition at line 198 of file AudioUnitWrapper.h.
Referenced by AudioUnitInstance::AudioUnitInstance(), AudioUnitInstance::GetAudioInCount(), AudioUnitEffectBase::GetChannelCounts(), AudioUnitEffectBase::GetType(), AudioUnitEffectBase::MakeInstance(), AudioUnitInstance::ProcessBlock(), AudioUnitInstance::ProcessInitialize(), AudioUnitInstance::RealtimeAddProcessor(), and SetRateAndChannels().
|
protected |
Definition at line 199 of file AudioUnitWrapper.h.
Referenced by AudioUnitInstance::AudioUnitInstance(), AudioUnitInstance::GetAudioOutCount(), AudioUnitEffectBase::GetChannelCounts(), AudioUnitEffectBase::GetType(), AudioUnitEffectBase::MakeInstance(), AudioUnitInstance::ProcessBlock(), AudioUnitInstance::ProcessInitialize(), AudioUnitInstance::RealtimeAddProcessor(), and SetRateAndChannels().
|
protected |
Definition at line 191 of file AudioUnitWrapper.h.
Referenced by CreateAudioUnit(), GetComponent(), AudioUnitEffectBase::GetVersion(), AudioUnitEffectBase::MakeInstance(), and AudioUnitInstance::RealtimeAddProcessor().
|
protected |
Definition at line 194 of file AudioUnitWrapper.h.
Referenced by CreateAudioUnit().
|
protected |
Definition at line 195 of file AudioUnitWrapper.h.
Referenced by CreateAudioUnit(), ForEachParameter(), GetParameters(), AudioUnitEffectBase::InitializePlugin(), AudioUnitEffectBase::MakeInstance(), and AudioUnitInstance::RealtimeAddProcessor().
|
protected |
Definition at line 192 of file AudioUnitWrapper.h.
Referenced by AudioUnitInstance::BypassEffect(), CreateAudioUnit(), FetchSettings(), ForEachParameter(), GetAudioUnit(), GetFixedSizeProperty(), GetVariableSizeProperty(), AudioUnitWrapper::ParameterInfo::ParameterInfo(), AudioUnitInstance::ProcessBlock(), AudioUnitInstance::ProcessInitialize(), AudioUnitInstance::RealtimeProcessStart(), and SetProperty().