![]() |
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 | Restart () |
Restart processing at beginning of buffer next time Process() is called. More... | |
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< AudioGraph::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 |
||
) |
inputTracks
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 75 of file Mix.cpp.
|
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 386 of file Mix.cpp.
References mEffectiveFormat.
Referenced by MixAndRender().
constSamplePtr Mixer::GetBuffer | ( | ) |
Retrieve the main buffer or the interleaved buffer.
Definition at line 376 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 391 of file Mix.cpp.
References mTimesAndSpeed.
Referenced by MixAndRender().
|
private |
TODO: more-than-two-channels
Definition at line 191 of file Mix.cpp.
References mApplyTrackGains, mFormat, mInputs, mSources, narrowestSampleFormat, and MixerSource::VariableRates().
|
inline |
result <= BufferSize()
Definition at line 89 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 272 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, Track::LeftChannel, mApplyTrackGains, mBuffer, mDecoratedSources, mFloatBuffers, mFormat, mHighQuality, mInterleaved, MixBuffers(), mNeedsDither, mNumChannels, Track::MonoChannel, mTemp, mTimesAndSpeed, none, Track::RightChannel, 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 418 of file Mix.cpp.
References _, mSources, and mTimesAndSpeed.
Referenced by SetSpeedForKeyboardScrubbing(), and SetTimesAndSpeed().
void Mixer::Restart | ( | ) |
Restart processing at beginning of buffer next time Process() is called.
void Mixer::SetSpeedForKeyboardScrubbing | ( | double | speed, |
double | startTime | ||
) |
Definition at line 442 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 432 of file Mix.cpp.
References _, mTimesAndSpeed, and Reposition().
|
private |
Definition at line 134 of file Mix.h.
Referenced by NeedsDither(), and Process().
|
private |
Definition at line 156 of file Mix.h.
Referenced by GetBuffer(), and Process().
|
private |
|
private |
Definition at line 140 of file Mix.h.
Referenced by EffectiveFormat().
|
private |
|
private |
Definition at line 136 of file Mix.h.
Referenced by NeedsDither(), and Process().
|
private |
|
private |
Definition at line 123 of file Mix.h.
Referenced by NeedsDither().
|
private |
|
private |
|
private |
|
private |
Definition at line 158 of file Mix.h.
Referenced by NeedsDither(), and Reposition().
|
private |
|
private |
|
private |
|
private |
Definition at line 143 of file Mix.h.
Referenced by MixGetCurrentTime(), Process(), Reposition(), SetSpeedForKeyboardScrubbing(), and SetTimesAndSpeed().