Audacity 3.2.0
|
#include <AudioUnitInstance.h>
Public Member Functions | |
AudioUnitInstance (const PerTrackEffect &effect, AudioComponent component, Parameters ¶meters, const wxString &identifier, unsigned audioIns, unsigned audioOuts, bool useLatency) | |
void | EventListener (const AudioUnitEvent *inEvent, AudioUnitParameterValue inParameterValue) |
std::unique_ptr< Message > | MakeMessage () const override |
Called on the main thread, in which the result may be cloned. More... | |
std::unique_ptr< Message > | MakeMessage (AudioUnitParameterID id, AudioUnitParameterValue value) const |
Public Member Functions inherited from PerTrackEffect::Instance | |
Instance (const PerTrackEffect &processor) | |
~Instance () override | |
bool | Process (EffectSettings &settings) final |
Uses the other virtual functions of this class. More... | |
bool | ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap) override |
bool | ProcessFinalize () noexcept override |
Public Member Functions inherited from EffectInstanceEx | |
virtual bool | Init () |
Call once to set up state for whole list of tracks to be processed. More... | |
virtual bool | Process (EffectSettings &settings)=0 |
Actually do the effect here. More... | |
~EffectInstanceEx () override | |
Public Member Functions inherited from EffectInstance | |
virtual | ~EffectInstance () |
virtual size_t | GetBlockSize () const =0 |
virtual size_t | SetBlockSize (size_t maxBlockSize)=0 |
virtual unsigned | GetAudioInCount () const =0 |
How many input buffers to allocate at once. More... | |
virtual unsigned | GetAudioOutCount () const =0 |
How many output buffers to allocate at once. More... | |
virtual bool | RealtimeInitialize (EffectSettings &settings, double sampleRate) |
virtual bool | RealtimeAddProcessor (EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) |
virtual bool | RealtimeSuspend () |
virtual bool | RealtimeResume () |
virtual std::unique_ptr< Message > | MakeMessage () const |
Called on the main thread, in which the result may be cloned. More... | |
virtual bool | UsesMessages () const noexcept |
virtual bool | RealtimeProcessStart (MessagePackage &package) |
settings are possibly changed, since last call, by an asynchronous dialog More... | |
virtual size_t | RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples) |
virtual void | RealtimePassThrough (size_t group, EffectSettings &settings, const float *const *inBuf, size_t numSamples) |
Called instead of RealtimeProcess when the effect is bypassed. Default implementation does nothing. More... | |
virtual bool | RealtimeProcessEnd (EffectSettings &settings) noexcept |
settings can be updated to let a dialog change appearance at idle More... | |
virtual bool | RealtimeFinalize (EffectSettings &settings) noexcept |
virtual size_t | GetTailSize () const |
virtual SampleCount | GetLatency (const EffectSettings &settings, double sampleRate) const |
virtual bool | NeedsDither () const |
virtual bool | ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap)=0 |
virtual bool | ProcessFinalize () noexcept=0 |
virtual size_t | ProcessBlock (EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen)=0 |
Called for destructive effect computation. More... | |
Public Member Functions inherited from AudioUnitWrapper | |
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) |
Private Member Functions | |
size_t | InitialBlockSize () const |
SampleCount | GetLatency (const EffectSettings &settings, double sampleRate) const override |
size_t | GetBlockSize () const override |
size_t | SetBlockSize (size_t maxBlockSize) override |
unsigned | GetAudioInCount () const override |
How many input buffers to allocate at once. More... | |
unsigned | GetAudioOutCount () const override |
How many output buffers to allocate at once. More... | |
bool | ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap) override |
bool | ProcessFinalize () noexcept override |
size_t | ProcessBlock (EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override |
Called for destructive effect computation. More... | |
bool | RealtimeInitialize (EffectSettings &settings, double sampleRate) override |
bool | RealtimeAddProcessor (EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) override |
bool | RealtimeFinalize (EffectSettings &settings) noexcept override |
bool | RealtimeSuspend () override |
bool | RealtimeResume () override |
bool | UsesMessages () const noexcept override |
bool | RealtimeProcessStart (MessagePackage &package) override |
settings are possibly changed, since last call, by an asynchronous dialog More... | |
size_t | RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inbuf, float *const *outbuf, size_t numSamples) override |
bool | RealtimeProcessEnd (EffectSettings &settings) noexcept override |
settings can be updated to let a dialog change appearance at idle More... | |
OSStatus | Render (AudioUnitRenderActionFlags *inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumFrames, AudioBufferList *ioData) |
bool | BypassEffect (bool bypass) |
Static Private Member Functions | |
static OSStatus | RenderCallback (void *inRefCon, AudioUnitRenderActionFlags *inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumFrames, AudioBufferList *ioData) |
Private Attributes | |
bool | mRecruited { false } |
Whether the master instance is now allocated to a group number. More... | |
std::vector< std::unique_ptr< AudioUnitInstance > > | mSlaves |
AudioUnitCleanup< AudioUnit, AudioUnitUninitialize > | mInitialization |
AudioTimeStamp | mTimeStamp {} |
PackedArray::Ptr< AudioBufferList > | mInputList |
PackedArray::Ptr< AudioBufferList > | mOutputList |
const wxString & | mIdentifier |
const size_t | mBlockSize |
const bool | mUseLatency |
Additional Inherited Members | |
Public Types inherited from EffectInstance | |
using | Message = EffectSettingsAccess::Message |
using | SampleCount = uint64_t |
Public Types inherited from AudioUnitWrapper | |
using | Parameters = PackedArray::Ptr< const AudioUnitParameterID > |
using | ParameterVisitor = std::function< bool(const ParameterInfo &pi, AudioUnitParameterID ID) > |
Return value: if true, continue visiting. More... | |
Static Public Member Functions inherited from AudioUnitWrapper | |
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 inherited from PerTrackEffect::Instance | |
const PerTrackEffect & | mProcessor |
Protected Attributes inherited from AudioUnitWrapper | |
const AudioComponent | mComponent |
AudioUnitCleanup< AudioUnit, AudioComponentInstanceDispose > | mUnit |
Parameters | mOwnParameters |
Parameters & | mParameters |
unsigned | mAudioIns { 2 } |
unsigned | mAudioOuts { 2 } |
Definition at line 19 of file AudioUnitInstance.h.
AudioUnitInstance::AudioUnitInstance | ( | const PerTrackEffect & | effect, |
AudioComponent | component, | ||
Parameters & | parameters, | ||
const wxString & | identifier, | ||
unsigned | audioIns, | ||
unsigned | audioOuts, | ||
bool | useLatency | ||
) |
Definition at line 58 of file AudioUnitInstance.cpp.
References AudioUnitWrapper::CreateAudioUnit(), AudioUnitWrapper::mAudioIns, and AudioUnitWrapper::mAudioOuts.
|
private |
Definition at line 422 of file AudioUnitInstance.cpp.
References AudioUnitWrapper::mUnit, and AudioUnitWrapper::SetProperty().
Referenced by ProcessInitialize(), RealtimeResume(), and RealtimeSuspend().
void AudioUnitInstance::EventListener | ( | const AudioUnitEvent * | inEvent, |
AudioUnitParameterValue | inParameterValue | ||
) |
Definition at line 388 of file AudioUnitInstance.cpp.
References AudioUnitWrapper::GetAudioUnit(), and mSlaves.
Referenced by AudioUnitEditor::EventListener().
|
overrideprivatevirtual |
How many input buffers to allocate at once.
If the instance processes channels independently, this can return 1 The result is not necessarily well defined before RealtimeInitialize
Implements EffectInstance.
Definition at line 96 of file AudioUnitInstance.cpp.
References AudioUnitWrapper::mAudioIns.
|
overrideprivatevirtual |
How many output buffers to allocate at once.
The result is not necessarily well defined before RealtimeInitialize
Implements EffectInstance.
Definition at line 101 of file AudioUnitInstance.cpp.
References AudioUnitWrapper::mAudioOuts.
|
overrideprivatevirtual |
Implements EffectInstance.
Definition at line 91 of file AudioUnitInstance.cpp.
References mBlockSize.
|
overrideprivatevirtual |
Default implementation returns 0
Reimplemented from EffectInstance.
Definition at line 106 of file AudioUnitInstance.cpp.
References AudioUnitUtils::GetFixedSizeProperty(), and anonymous_namespace{ClipSegmentTest.cpp}::sampleRate.
|
private |
Definition at line 73 of file AudioUnitInstance.cpp.
References AudioUnitWrapper::GetFixedSizeProperty().
|
overridevirtual |
Called on the main thread, in which the result may be cloned.
Default implementation returns a null
Reimplemented from EffectInstance.
Definition at line 285 of file AudioUnitInstance.cpp.
References AudioUnitWrapper::FetchSettings(), and settings().
Referenced by AudioUnitEditor::EventListener().
auto AudioUnitInstance::MakeMessage | ( | AudioUnitParameterID | id, |
AudioUnitParameterValue | value | ||
) | const |
Definition at line 294 of file AudioUnitInstance.cpp.
References id, and settings().
|
overrideprivatevirtual |
Called for destructive effect computation.
Implements EffectInstance.
Definition at line 188 of file AudioUnitInstance.cpp.
References PackedArray::Count(), AudioUnitWrapper::mAudioIns, AudioUnitWrapper::mAudioOuts, mInputList, mOutputList, mTimeStamp, and AudioUnitWrapper::mUnit.
|
overrideprivatevirtualnoexcept |
Called at end of destructive processing, for each (mono/stereo) track Default implementation does nothing, returns true This may be called during stack unwinding:
Implements EffectInstance.
Definition at line 181 of file AudioUnitInstance.cpp.
References mInputList, and mOutputList.
|
overrideprivatevirtual |
Called at start of destructive processing, for each (mono/stereo) track Default implementation does nothing, returns true
chanMap | null or array terminated with ChannelNameEOL. Do not retain the pointer |
GetAudioInCount()
and GetAudioOutCount()
are well defined Implements EffectInstance.
Definition at line 129 of file AudioUnitInstance.cpp.
References BypassEffect(), AudioUnitWrapper::GetSettings(), AudioUnitWrapper::mAudioIns, AudioUnitWrapper::mAudioOuts, mIdentifier, mInitialization, mInputList, mOutputList, PerTrackEffect::Instance::mProcessor, mTimeStamp, AudioUnitWrapper::mUnit, RenderCallback(), anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, AudioUnitWrapper::SetProperty(), AudioUnitWrapper::SetRateAndChannels(), settings(), and AudioUnitWrapper::StoreSettings().
Referenced by RealtimeInitialize().
|
overrideprivatevirtual |
Reimplemented from EffectInstance.
Definition at line 229 of file AudioUnitInstance.cpp.
References AudioUnitWrapper::mAudioIns, AudioUnitWrapper::mAudioOuts, mBlockSize, AudioUnitWrapper::mComponent, mIdentifier, AudioUnitWrapper::mParameters, PerTrackEffect::Instance::mProcessor, mRecruited, mSlaves, mUseLatency, anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, and settings().
|
overrideprivatevirtualnoexcept |
Reimplemented from EffectInstance.
Definition at line 250 of file AudioUnitInstance.cpp.
|
overrideprivatevirtual |
GetAudioInCount()
and GetAudioOutCount()
are well definedDefault implementation does nothing, returns false (so assume realtime is not supported). Other member functions related to realtime return true or zero, but will not be called, unless a derived class overrides RealtimeInitialize.
Reimplemented from EffectInstance.
Definition at line 223 of file AudioUnitInstance.cpp.
References ProcessInitialize(), anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, and settings().
|
overrideprivatevirtual |
Reimplemented from EffectInstance.
Definition at line 339 of file AudioUnitInstance.cpp.
References mBlockSize, mRecruited, mSlaves, and settings().
|
overrideprivatevirtualnoexcept |
settings can be updated to let a dialog change appearance at idle
Reimplemented from EffectInstance.
Definition at line 357 of file AudioUnitInstance.cpp.
|
overrideprivatevirtual |
settings are possibly changed, since last call, by an asynchronous dialog
Reimplemented from EffectInstance.
Definition at line 308 of file AudioUnitInstance.cpp.
References _, mSlaves, AudioUnitWrapper::mUnit, EffectInstance::MessagePackage::pMessage, settings(), and values.
|
overrideprivatevirtual |
Reimplemented from EffectInstance.
Definition at line 273 of file AudioUnitInstance.cpp.
References BypassEffect(), and mSlaves.
|
overrideprivatevirtual |
Reimplemented from EffectInstance.
Definition at line 261 of file AudioUnitInstance.cpp.
References BypassEffect(), and mSlaves.
|
private |
Definition at line 362 of file AudioUnitInstance.cpp.
References PackedArray::Count(), for(), mInputList, and size.
Referenced by RenderCallback().
|
staticprivate |
Definition at line 379 of file AudioUnitInstance.cpp.
References Render().
Referenced by ProcessInitialize().
|
overrideprivatevirtual |
Implements EffectInstance.
Definition at line 85 of file AudioUnitInstance.cpp.
References mBlockSize.
|
overrideprivatevirtualnoexcept |
If true, the effect makes no use EffectSettings for inter-thread comminication
Default implementation returns false. In future, all effects should be rewritten to use messages and this function will be removed.
Reimplemented from EffectInstance.
Definition at line 303 of file AudioUnitInstance.cpp.
|
private |
Definition at line 95 of file AudioUnitInstance.h.
Referenced by GetBlockSize(), RealtimeAddProcessor(), RealtimeProcess(), and SetBlockSize().
|
private |
Definition at line 94 of file AudioUnitInstance.h.
Referenced by ProcessInitialize(), and RealtimeAddProcessor().
|
private |
Definition at line 88 of file AudioUnitInstance.h.
Referenced by ProcessInitialize().
|
private |
Definition at line 90 of file AudioUnitInstance.h.
Referenced by ProcessBlock(), ProcessFinalize(), ProcessInitialize(), and Render().
|
private |
Definition at line 91 of file AudioUnitInstance.h.
Referenced by ProcessBlock(), ProcessFinalize(), and ProcessInitialize().
|
private |
Whether the master instance is now allocated to a group number.
Definition at line 85 of file AudioUnitInstance.h.
Referenced by RealtimeAddProcessor(), and RealtimeProcess().
|
private |
Definition at line 86 of file AudioUnitInstance.h.
Referenced by EventListener(), RealtimeAddProcessor(), RealtimeProcess(), RealtimeProcessStart(), RealtimeResume(), and RealtimeSuspend().
|
private |
Definition at line 89 of file AudioUnitInstance.h.
Referenced by ProcessBlock(), and ProcessInitialize().
|
private |
Definition at line 96 of file AudioUnitInstance.h.
Referenced by RealtimeAddProcessor().