Audacity 3.2.0
|
Combines multiple audio graph sources into a single source. More...
#include <DownmixStage.h>
Public Types | |
enum class | ApplyVolume { Discard , MapChannels , Mixdown } |
Public Types inherited from AudioGraph::Source | |
using | Buffers = AudioGraph::Buffers |
Public Member Functions | |
DownmixStage (std::vector< std::unique_ptr< DownmixSource > > downmixSources, size_t numChannels, size_t bufferSize, ApplyVolume applyGain) | |
~DownmixStage () override | |
bool | AcceptsBuffers (const Buffers &buffers) const override |
bool | AcceptsBlockSize (size_t blockSize) const override |
std::optional< size_t > | Acquire (Buffers &data, size_t maxToProcess) override |
Occupy vacant space in Buffers with some data. More... | |
sampleCount | Remaining () const override |
Result includes any amount Acquired and not yet Released. More... | |
bool | Release () override |
Caller is done examining last Acquire()d positions. More... | |
Public Member Functions inherited from AudioGraph::Source | |
virtual | ~Source () |
virtual bool | AcceptsBuffers (const Buffers &buffers) const =0 |
virtual bool | AcceptsBlockSize (size_t blockSize) const =0 |
virtual std::optional< size_t > | Acquire (Buffers &data, size_t bound)=0 |
Occupy vacant space in Buffers with some data. More... | |
virtual sampleCount | Remaining () const =0 |
Result includes any amount Acquired and not yet Released. More... | |
virtual bool | Release ()=0 |
Caller is done examining last Acquire()d positions. More... | |
virtual bool | Terminates () const |
Needed only to make some postconditions assertable; defaults true. More... | |
Private Attributes | |
std::vector< std::unique_ptr< DownmixSource > > | mDownmixSources |
AudioGraph::Buffers | mFloatBuffers |
size_t | mNumChannels |
ApplyVolume | mApplyVolume |
Combines multiple audio graph sources into a single source.
Definition at line 20 of file DownmixStage.h.
|
strong |
Enumerator | |
---|---|
Discard | |
MapChannels | |
Mixdown |
Definition at line 23 of file DownmixStage.h.
DownmixStage::DownmixStage | ( | std::vector< std::unique_ptr< DownmixSource > > | downmixSources, |
size_t | numChannels, | ||
size_t | bufferSize, | ||
ApplyVolume | applyGain | ||
) |
Definition at line 42 of file DownmixStage.cpp.
|
overridedefault |
|
overridevirtual |
Implements AudioGraph::Source.
Definition at line 68 of file DownmixStage.cpp.
References AudioGraph::Buffers::BufferSize(), and mFloatBuffers.
Referenced by AcceptsBuffers().
|
overridevirtual |
Implements AudioGraph::Source.
Definition at line 62 of file DownmixStage.cpp.
References AcceptsBlockSize(), AudioGraph::Buffers::BlockSize(), AudioGraph::Buffers::Channels(), and mNumChannels.
|
overridevirtual |
Occupy vacant space in Buffers with some data.
May exceeed a single block of production Can assume same buffer is passed each time, while the caller advances it over the previous production, or discards it, or rotates the buffer. May rewind or rotate the buffer.
data
or nullopt to fail AcceptsBuffers(data)
AcceptsBlockSize(data.BlockSize())
bound <= data.BlockSize()
data.BlockSize() <= data.Remaining()
!result || *result <= bound
!result || *result <= data.Remaining()
!result || *result <= Remaining()
data.Remaining() > 0
!result || bound == 0 || Remaining() == 0 || *result > 0
(progress guarantee) !Terminates()
or Remaining()
was not previously defined, or is unchanged Implements AudioGraph::Source.
Definition at line 73 of file DownmixStage.cpp.
References AudioGraph::Buffers::Advance(), AudioGraph::Buffers::Channels(), AudioGraph::Buffers::ClearBuffer(), Discard, AudioGraph::Buffers::GetReadPosition(), mApplyVolume, mDownmixSources, mFloatBuffers, anonymous_namespace{DownmixStage.cpp}::MixBuffers(), Mixdown, mNumChannels, AudioGraph::Buffers::Rotate(), and stackAllocate.
|
overridevirtual |
Caller is done examining last Acquire()d positions.
May be called only after at least one successful call to Acquire()
!Terminates()
or Remaining()
reduced by what was last returned by Acquire()
Implements AudioGraph::Source.
Definition at line 144 of file DownmixStage.cpp.
|
overridevirtual |
Result includes any amount Acquired and not yet Released.
May be undefined before the first successful call to Acquire()
result >= 0
Implements AudioGraph::Source.
Definition at line 135 of file DownmixStage.cpp.
References mDownmixSources.
|
private |
Definition at line 35 of file DownmixStage.h.
Referenced by Acquire().
|
private |
Definition at line 31 of file DownmixStage.h.
Referenced by Acquire(), and Remaining().
|
private |
Definition at line 33 of file DownmixStage.h.
Referenced by AcceptsBlockSize(), and Acquire().
|
private |
Definition at line 34 of file DownmixStage.h.
Referenced by AcceptsBuffers(), and Acquire().