![]() |
Audacity 3.2.0
|
Functions for doing the mixdown of the tracks. More...
#include <Mix.h>
Classes | |
struct | Input |
struct | Source |
Public Types | |
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, bool applytTrackGains=true) | |
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 bool | mApplyTrackGains |
const bool | mHighQuality |
const sampleFormat | mFormat |
const bool | mInterleaved |
sampleFormat | mEffectiveFormat |
bool | mNeedsDither |
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 |
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 , |
||
bool | applytTrackGains = true |
||
) |
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 |
|
inline |
|
private |
sampleFormat Mixer::EffectiveFormat | ( | ) | const |
Deduce the effective width of the output, which may be narrower than the stored format.
Definition at line 385 of file Mix.cpp.
References mEffectiveFormat.
Referenced by MixAndRender().
constSamplePtr Mixer::GetBuffer | ( | ) |
Retrieve the main buffer or the interleaved buffer.
Definition at line 375 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 390 of file Mix.cpp.
References mTimesAndSpeed.
Referenced by anonymous_namespace{ExportPluginHelpers.cpp}::EvalExportProgress(), and MixAndRender().
|
private |
TODO: more-than-two-channels
Definition at line 190 of file Mix.cpp.
References mApplyTrackGains, mFormat, mInputs, mSources, narrowestSampleFormat, and MixerSource::VariableRates().
|
inline |
result <= BufferSize()
Definition at line 91 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(), PackedArray::end(), floatSample, AudioGraph::Buffers::GetReadPosition(), gHighQualityDither, gLowQualityDither, anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, AudioGraph::IsMono(), mApplyTrackGains, mBuffer, mDecoratedSources, mFloatBuffers, mFormat, mHighQuality, mInterleaved, MixBuffers(), 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 395 of file Mix.cpp.
References _, mSources, and mTimesAndSpeed.
Referenced by SetSpeedForKeyboardScrubbing(), and SetTimesAndSpeed().
void Mixer::SetSpeedForKeyboardScrubbing | ( | double | speed, |
double | startTime | ||
) |
Definition at line 420 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 410 of file Mix.cpp.
References _, mTimesAndSpeed, and Reposition().
|
private |
Definition at line 133 of file Mix.h.
Referenced by NeedsDither(), and Process().
|
private |
Definition at line 155 of file Mix.h.
Referenced by GetBuffer(), and Process().
|
private |
|
private |
Definition at line 139 of file Mix.h.
Referenced by EffectiveFormat().
|
private |
|
private |
Definition at line 135 of file Mix.h.
Referenced by NeedsDither(), and Process().
|
private |
|
private |
Definition at line 122 of file Mix.h.
Referenced by NeedsDither().
|
private |
|
private |
|
private |
|
private |
Definition at line 157 of file Mix.h.
Referenced by NeedsDither(), and Reposition().
|
private |
|
private |
|
private |
|
private |
Definition at line 142 of file Mix.h.
Referenced by MixGetCurrentTime(), Process(), Reposition(), SetSpeedForKeyboardScrubbing(), and SetTimesAndSpeed().