Audacity 3.2.0
|
Functions for doing the mixdown of the tracks. More...
#include <Mix.h>
Classes | |
struct | Input |
struct | Source |
Public Types | |
enum class | ApplyGain { Discard , MapChannels , Mixdown } |
using | WarpOptions = MixerOptions::Warp |
using | MixerSpec = MixerOptions::Downmix |
using | ResampleParameters = MixerOptions::ResampleParameters |
using | TimesAndSpeed = MixerOptions::TimesAndSpeed |
using | Stages = std::vector< MixerOptions::StageSpecification > |
using | Inputs = std::vector< Input > |
Public Member Functions | |
Mixer (Inputs inputs, bool mayThrow, const WarpOptions &warpOptions, double startTime, double stopTime, unsigned numOutChannels, size_t outBufferSize, bool outInterleaved, double outRate, sampleFormat outFormat, bool highQuality=true, MixerSpec *mixerSpec=nullptr, ApplyGain applyGain=ApplyGain::MapChannels) | |
Mixer (const Mixer &)=delete | |
Mixer & | operator= (const Mixer &)=delete |
virtual | ~Mixer () |
size_t | BufferSize () const |
size_t | Process (size_t maxSamples) |
size_t | Process () |
void | Reposition (double t, bool bSkipping=false) |
Reposition processing to absolute time next time Process() is called. More... | |
void | SetTimesAndSpeed (double t0, double t1, double speed, bool bSkipping=false) |
Used in scrubbing and other nonuniform playback policies. More... | |
void | SetSpeedForKeyboardScrubbing (double speed, double startTime) |
double | MixGetCurrentTime () |
Current time in seconds (unwarped, i.e. always between startTime and stopTime) More... | |
constSamplePtr | GetBuffer () |
Retrieve the main buffer or the interleaved buffer. More... | |
constSamplePtr | GetBuffer (int channel) |
Retrieve one of the non-interleaved buffers. More... | |
sampleFormat | EffectiveFormat () const |
Deduce the effective width of the output, which may be narrower than the stored format. More... | |
Private Member Functions | |
void | Clear () |
std::pair< bool, sampleFormat > | NeedsDither (bool needsDither, double rate) const |
Private Attributes | |
const unsigned | mNumChannels |
Inputs | mInputs |
const size_t | mBufferSize |
const ApplyGain | mApplyGain |
const bool | mHighQuality |
const sampleFormat | mFormat |
const bool | mInterleaved |
sampleFormat | mEffectiveFormat |
bool | mNeedsDither |
bool | mHasMixerSpec {false} |
const std::shared_ptr< TimesAndSpeed > | mTimesAndSpeed |
AudioGraph::Buffers | mFloatBuffers |
std::vector< std::vector< float > > | mTemp |
const std::vector< SampleBuffer > | mBuffer |
std::vector< MixerSource > | mSources |
std::vector< EffectSettings > | mSettings |
std::vector< AudioGraph::Buffers > | mStageBuffers |
std::vector< std::unique_ptr< EffectStage > > | mStages |
std::vector< Source > | mDecoratedSources |
using Mixer::Inputs = std::vector<Input> |
using Mixer::Stages = std::vector<MixerOptions::StageSpecification> |
using Mixer::WarpOptions = MixerOptions::Warp |
|
strong |
Mixer::Mixer | ( | Inputs | inputs, |
bool | mayThrow, | ||
const WarpOptions & | warpOptions, | ||
double | startTime, | ||
double | stopTime, | ||
unsigned | numOutChannels, | ||
size_t | outBufferSize, | ||
bool | outInterleaved, | ||
double | outRate, | ||
sampleFormat | outFormat, | ||
bool | highQuality = true , |
||
MixerSpec * | mixerSpec = nullptr , |
||
ApplyGain | applyGain = ApplyGain::MapChannels |
||
) |
inputs
are non-null BufferSize() <= outBufferSize
(equality when no inputs have stages) mixerSpec | Null or else must have a lifetime enclosing this object's |
Definition at line 71 of file Mix.cpp.
References anonymous_namespace{ExportPCM.cpp}::format, and size.
|
delete |
|
virtualdefault |
|
inline |
|
private |
sampleFormat Mixer::EffectiveFormat | ( | ) | const |
Deduce the effective width of the output, which may be narrower than the stored format.
Definition at line 388 of file Mix.cpp.
References mEffectiveFormat.
Referenced by MixAndRender().
constSamplePtr Mixer::GetBuffer | ( | ) |
Retrieve the main buffer or the interleaved buffer.
Definition at line 378 of file Mix.cpp.
References mBuffer.
Referenced by MixAndRender().
constSamplePtr Mixer::GetBuffer | ( | int | channel | ) |
double Mixer::MixGetCurrentTime | ( | ) |
Current time in seconds (unwarped, i.e. always between startTime and stopTime)
This value is not accurate, it's useful for progress bars and indicators, but nothing else.
Definition at line 393 of file Mix.cpp.
References mTimesAndSpeed.
Referenced by anonymous_namespace{ExportPluginHelpers.cpp}::EvalExportProgress(), and MixAndRender().
|
private |
TODO: more-than-two-channels
Definition at line 189 of file Mix.cpp.
References Discard, mApplyGain, mFormat, mHasMixerSpec, Mixdown, mNumChannels, mSources, narrowestSampleFormat, and MixerSource::VariableRates().
|
inline |
result <= BufferSize()
Definition at line 98 of file Mix.h.
References BufferSize, and Process().
Referenced by Process().
size_t Mixer::Process | ( | size_t | maxSamples | ) |
Process a maximum of 'maxSamples' samples and put them into the buffer, at GetBuffer().
maxSamples <= BufferSize()
result <= maxSamples
Definition at line 271 of file Mix.cpp.
References _, AudioGraph::Buffers::Advance(), BufferSize(), AudioGraph::Buffers::Channels(), Clear(), staffpad::vo::copy(), CopySamples(), Discard, details::end(), floatSample, AudioGraph::Buffers::GetReadPosition(), gHighQualityDither, gLowQualityDither, anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, AudioGraph::IsMono(), mApplyGain, mBuffer, mDecoratedSources, mFloatBuffers, mFormat, mHasMixerSpec, mHighQuality, mInterleaved, MixBuffers(), Mixdown, mNeedsDither, mNumChannels, mTemp, mTimesAndSpeed, none, AudioGraph::Buffers::Rotate(), SAMPLE_SIZE, and stackAllocate.
Referenced by MixAndRender().
void Mixer::Reposition | ( | double | t, |
bool | bSkipping = false |
||
) |
Reposition processing to absolute time next time Process() is called.
Definition at line 398 of file Mix.cpp.
References _, mSources, and mTimesAndSpeed.
Referenced by SetSpeedForKeyboardScrubbing(), and SetTimesAndSpeed().
void Mixer::SetSpeedForKeyboardScrubbing | ( | double | speed, |
double | startTime | ||
) |
Definition at line 423 of file Mix.cpp.
References _, mTimesAndSpeed, and Reposition().
void Mixer::SetTimesAndSpeed | ( | double | t0, |
double | t1, | ||
double | speed, | ||
bool | bSkipping = false |
||
) |
Used in scrubbing and other nonuniform playback policies.
Definition at line 413 of file Mix.cpp.
References _, mTimesAndSpeed, and Reposition().
|
private |
Definition at line 140 of file Mix.h.
Referenced by NeedsDither(), and Process().
|
private |
Definition at line 163 of file Mix.h.
Referenced by GetBuffer(), and Process().
|
private |
|
private |
Definition at line 146 of file Mix.h.
Referenced by EffectiveFormat().
|
private |
|
private |
Definition at line 142 of file Mix.h.
Referenced by NeedsDither(), and Process().
|
private |
Definition at line 148 of file Mix.h.
Referenced by NeedsDither(), and Process().
|
private |
|
private |
|
private |
Definition at line 128 of file Mix.h.
Referenced by NeedsDither(), and Process().
|
private |
|
private |
Definition at line 165 of file Mix.h.
Referenced by NeedsDither(), and Reposition().
|
private |
|
private |
|
private |
|
private |
Definition at line 150 of file Mix.h.
Referenced by MixGetCurrentTime(), Process(), Reposition(), SetSpeedForKeyboardScrubbing(), and SetTimesAndSpeed().