Audacity 3.2.0
|
#include <CompressorInstance.h>
Public Member Functions | |
CompressorInstance (const PerTrackEffect &effect) | |
CompressorInstance (CompressorInstance &&other) | |
const std::optional< double > & | GetSampleRate () const |
float | GetLatencyMs () const |
void | SetOutputQueue (std::weak_ptr< DynamicRangeProcessorOutputPacketQueue >) |
void | SetMeterValuesQueue (std::weak_ptr< DynamicRangeProcessorMeterValuesQueue > queue) |
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 EffectInstanceWithBlockSize | |
~EffectInstanceWithBlockSize () override | |
size_t | GetBlockSize () const override |
size_t | SetBlockSize (size_t maxBlockSize) override |
Public Member Functions inherited from Observer::Publisher< Message, NotifyAll > | |
template<typename Alloc = std::allocator<Record>> | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (Publisher &&)=default |
Subscription | Subscribe (Callback callback) |
Connect a callback to the Publisher; later-connected are called earlier. More... | |
template<typename Object , typename Return , typename... Args> | |
Subscription | Subscribe (Object &obj, Return(Object::*callback)(Args...)) |
Overload of Subscribe takes an object and pointer-to-member-function. More... | |
Private Member Functions | |
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 | RealtimeResume () override |
bool | RealtimeAddProcessor (EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) override |
bool | RealtimeFinalize (EffectSettings &settings) noexcept override |
size_t | RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inbuf, float *const *outbuf, size_t numSamples) override |
void | RealtimePassThrough (size_t group, EffectSettings &settings, const float *const *inbuf, size_t numSamples) override |
Called instead of RealtimeProcess when the effect is bypassed. Default implementation does nothing. More... | |
void | InstanceInit (EffectSettings &settings, CompressorInstance &instance, int numChannels, float sampleRate) |
size_t | InstanceProcess (EffectSettings &settings, CompressorProcessor &instance, const float *const *inBlock, float *const *outBlock, size_t blockLen) |
EffectInstance::SampleCount | GetLatency (const EffectSettings &settings, double sampleRate) const 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... | |
Private Attributes | |
std::unique_ptr< CompressorProcessor > | mCompressor |
std::vector< CompressorInstance > | mSlaves |
long long | mSampleCounter = 0 |
std::optional< double > | mSampleRate |
std::weak_ptr< DynamicRangeProcessorOutputPacketQueue > | mOutputQueue |
std::weak_ptr< DynamicRangeProcessorMeterValuesQueue > | mCompressionValueQueue |
Additional Inherited Members | |
Public Types inherited from EffectInstance | |
using | Message = EffectSettingsAccess::Message |
using | SampleCount = uint64_t |
Public Types inherited from Observer::Publisher< Message, NotifyAll > | |
using | message_type = Message |
using | CallbackReturn = std::conditional_t< NotifyAll, void, bool > |
using | Callback = std::function< CallbackReturn(const Message &) > |
Type of functions that can be connected to the Publisher. More... | |
Static Public Attributes inherited from Observer::Publisher< Message, NotifyAll > | |
static constexpr bool | notifies_all = NotifyAll |
Protected Member Functions inherited from Observer::Publisher< Message, NotifyAll > | |
CallbackReturn | Publish (const Message &message) |
Send a message to connected callbacks. More... | |
Protected Attributes inherited from PerTrackEffect::Instance | |
const PerTrackEffect & | mProcessor |
Protected Attributes inherited from EffectInstanceWithBlockSize | |
size_t | mBlockSize { 0 } |
Definition at line 26 of file CompressorInstance.h.
|
explicit |
Audacity: A Digital Audio Editor
Matthieu Hodgkinson
Definition at line 16 of file CompressorInstance.cpp.
|
explicit |
Definition at line 22 of file CompressorInstance.cpp.
|
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 238 of file CompressorInstance.cpp.
Referenced by ProcessInitialize().
|
overrideprivatevirtual |
How many output buffers to allocate at once.
The result is not necessarily well defined before RealtimeInitialize
Implements EffectInstance.
Definition at line 233 of file CompressorInstance.cpp.
|
overrideprivatevirtual |
Default implementation returns 0
Reimplemented from EffectInstance.
Definition at line 226 of file CompressorInstance.cpp.
References anonymous_namespace{CompressorInstance.cpp}::GetDynamicRangeProcessorSettings(), DynamicRangeProcessorSettings::lookaheadMs, anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, and settings().
float CompressorInstance::GetLatencyMs | ( | ) | const |
Definition at line 38 of file CompressorInstance.cpp.
References mCompressor, and mSlaves.
Referenced by DynamicRangeProcessorHistoryPanel::OnTimer().
const std::optional< double > & CompressorInstance::GetSampleRate | ( | ) | const |
Definition at line 33 of file CompressorInstance.cpp.
References mSampleRate.
|
private |
Definition at line 206 of file CompressorInstance.cpp.
References EffectInstanceWithBlockSize::GetBlockSize(), anonymous_namespace{CompressorInstance.cpp}::GetDynamicRangeProcessorSettings(), mCompressionValueQueue, mCompressor, mOutputQueue, anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, and settings().
Referenced by ProcessInitialize(), and RealtimeAddProcessor().
|
private |
Definition at line 217 of file CompressorInstance.cpp.
References CompressorProcessor::ApplySettingsIfNeeded(), anonymous_namespace{CompressorInstance.cpp}::GetDynamicRangeProcessorSettings(), CompressorProcessor::Process(), and settings().
Referenced by ProcessBlock(), and RealtimeProcess().
|
overrideprivatevirtual |
Called for destructive effect computation.
Implements EffectInstance.
Definition at line 100 of file CompressorInstance.cpp.
References InstanceProcess(), mCompressor, and settings().
|
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 69 of file CompressorInstance.cpp.
References mSampleRate.
|
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 61 of file CompressorInstance.cpp.
References GetAudioInCount(), InstanceInit(), mSampleRate, anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, and settings().
|
overrideprivatevirtual |
Reimplemented from EffectInstance.
Definition at line 128 of file CompressorInstance.cpp.
References InstanceInit(), PerTrackEffect::Instance::mProcessor, mSlaves, anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, and settings().
|
overrideprivatevirtualnoexcept |
Reimplemented from EffectInstance.
Definition at line 137 of file CompressorInstance.cpp.
References Observer::Publisher< Message, NotifyAll >::Publish().
|
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 107 of file CompressorInstance.cpp.
References mSampleCounter, mSampleRate, mSlaves, Observer::Publisher< Message, NotifyAll >::Publish(), anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, and EffectInstanceWithBlockSize::SetBlockSize().
|
overrideprivatevirtual |
Called instead of RealtimeProcess
when the effect is bypassed. Default implementation does nothing.
Reimplemented from EffectInstance.
Definition at line 195 of file CompressorInstance.cpp.
References mSlaves.
|
overrideprivatevirtual |
Reimplemented from EffectInstance.
Definition at line 156 of file CompressorInstance.cpp.
References DynamicRangeProcessorOutputPacket::actualCompressionDb, anonymous_namespace{CompressorInstance.cpp}::GetOutputDb(), DynamicRangeProcessorOutputPacket::indexOfFirstSample, DynamicRangeProcessorOutputPacket::inputDb, InstanceProcess(), mSlaves, DynamicRangeProcessorOutputPacket::numSamples, DynamicRangeProcessorOutputPacket::outputDb, settings(), and DynamicRangeProcessorOutputPacket::targetCompressionDb.
|
overrideprivatevirtual |
Reimplemented from EffectInstance.
Definition at line 118 of file CompressorInstance.cpp.
References mSlaves, and Observer::Publisher< Message, NotifyAll >::Publish().
void CompressorInstance::SetMeterValuesQueue | ( | std::weak_ptr< DynamicRangeProcessorMeterValuesQueue > | queue | ) |
Definition at line 53 of file CompressorInstance.cpp.
References mCompressionValueQueue, and mSlaves.
void CompressorInstance::SetOutputQueue | ( | std::weak_ptr< DynamicRangeProcessorOutputPacketQueue > | outputQueue | ) |
Definition at line 45 of file CompressorInstance.cpp.
References mOutputQueue, and mSlaves.
Referenced by DynamicRangeProcessorHistoryPanel::InitializeForPlayback().
|
private |
Definition at line 91 of file CompressorInstance.h.
Referenced by InstanceInit(), and SetMeterValuesQueue().
|
private |
Definition at line 86 of file CompressorInstance.h.
Referenced by GetLatencyMs(), InstanceInit(), and ProcessBlock().
|
private |
Definition at line 90 of file CompressorInstance.h.
Referenced by InstanceInit(), and SetOutputQueue().
|
private |
Definition at line 88 of file CompressorInstance.h.
Referenced by RealtimeInitialize().
|
private |
Definition at line 89 of file CompressorInstance.h.
Referenced by GetSampleRate(), ProcessFinalize(), ProcessInitialize(), and RealtimeInitialize().
|
private |
Definition at line 87 of file CompressorInstance.h.
Referenced by GetLatencyMs(), RealtimeAddProcessor(), RealtimeInitialize(), RealtimePassThrough(), RealtimeProcess(), RealtimeResume(), SetMeterValuesQueue(), and SetOutputQueue().