Audacity 3.2.0
|
Functions for doing the mixdown of the tracks. More...
#include <Mix.h>
Classes | |
struct | Input |
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 > |
using | ApplyVolume = DownmixStage::ApplyVolume |
Public Member Functions | |
Mixer (Inputs inputs, std::optional< Stages > masterEffects, 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, ApplyVolume applyVolume=ApplyVolume::MapChannels) | |
Mixer (const Mixer &)=delete | |
Mixer (Mixer &&) noexcept=delete | |
Mixer & | operator= (const Mixer &)=delete |
Mixer & | operator= (Mixer &&) noexcept=delete |
~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::unique_ptr< EffectStage > & | RegisterEffectStage (AudioGraph::Source &upstream, size_t numChannels, const MixerOptions::StageSpecification &stage, double outRate) |
std::pair< bool, sampleFormat > | NeedsDither (bool needsDither, double rate) const |
Private Attributes | |
const unsigned | mNumChannels |
Inputs | mInputs |
const std::optional< Stages > | mMasterEffects |
const size_t | mBufferSize |
const ApplyVolume | mApplyVolume |
const bool | mHighQuality |
const sampleFormat | mFormat |
const bool | mInterleaved |
sampleFormat | mEffectiveFormat |
bool | mNeedsDither |
bool | mHasMixerSpec {false} |
const std::shared_ptr< TimesAndSpeed > | mTimesAndSpeed |
AudioGraph::Buffers | 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::unique_ptr< AudioGraph::Source > | mDownmixStage |
std::unique_ptr< AudioGraph::Source > | mMasterDownmixStage |
AudioGraph::Source * | mDownstream {} |
using Mixer::Inputs = std::vector<Input> |
using Mixer::Stages = std::vector<MixerOptions::StageSpecification> |
using Mixer::WarpOptions = MixerOptions::Warp |
Mixer::Mixer | ( | Inputs | inputs, |
std::optional< Stages > | masterEffects, | ||
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 , |
||
ApplyVolume | applyVolume = ApplyVolume::MapChannels |
||
) |
When creating with master effects stages applyGain
is ignored
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 92 of file Mix.cpp.
References anonymous_namespace{ExportPCM.cpp}::format, and size.
|
delete |
|
deletenoexcept |
|
default |
|
inline |
|
private |
Definition at line 289 of file Mix.cpp.
References AudioGraph::Buffers::Channels(), AudioGraph::Buffers::ClearBuffer(), mBufferSize, and mTemp.
Referenced by Process().
sampleFormat Mixer::EffectiveFormat | ( | ) | const |
Deduce the effective width of the output, which may be narrower than the stored format.
Definition at line 354 of file Mix.cpp.
References mEffectiveFormat.
Referenced by MixAndRender().
constSamplePtr Mixer::GetBuffer | ( | ) |
Retrieve the main buffer or the interleaved buffer.
Definition at line 344 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 359 of file Mix.cpp.
References mTimesAndSpeed.
Referenced by anonymous_namespace{ExportPluginHelpers.cpp}::EvalExportProgress(), and MixAndRender().
|
private |
TODO: more-than-two-channels
Definition at line 228 of file Mix.cpp.
References DownmixStage::Discard, mApplyVolume, mFormat, mHasMixerSpec, DownmixStage::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 295 of file Mix.cpp.
References _, AudioGraph::Source::Acquire(), BufferSize(), Clear(), CopySamples(), floatSample, AudioGraph::Buffers::GetReadPosition(), gHighQualityDither, gLowQualityDither, mBuffer, mDownstream, mFormat, mHighQuality, mInterleaved, mNeedsDither, mNumChannels, mTemp, mTimesAndSpeed, none, AudioGraph::Source::Release(), and SAMPLE_SIZE.
Referenced by MixAndRender().
|
private |
Definition at line 414 of file Mix.cpp.
References EffectStage::Create(), MixerOptions::StageSpecification::factory, factory, mBufferSize, MixerOptions::StageSpecification::mpFirstInstance, mSettings, mStageBuffers, mStages, MixerOptions::StageSpecification::settings, and settings().
void Mixer::Reposition | ( | double | t, |
bool | bSkipping = false |
||
) |
Reposition processing to absolute time next time Process() is called.
Definition at line 364 of file Mix.cpp.
References _, mSources, and mTimesAndSpeed.
Referenced by SetSpeedForKeyboardScrubbing(), and SetTimesAndSpeed().
void Mixer::SetSpeedForKeyboardScrubbing | ( | double | speed, |
double | startTime | ||
) |
Definition at line 389 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 379 of file Mix.cpp.
References _, mTimesAndSpeed, and Reposition().
|
private |
Definition at line 143 of file Mix.h.
Referenced by NeedsDither().
|
private |
Definition at line 163 of file Mix.h.
Referenced by GetBuffer(), and Process().
|
private |
Definition at line 135 of file Mix.h.
Referenced by Clear(), and RegisterEffectStage().
|
private |
|
private |
|
private |
Definition at line 149 of file Mix.h.
Referenced by EffectiveFormat().
|
private |
Definition at line 145 of file Mix.h.
Referenced by NeedsDither(), and Process().
|
private |
Definition at line 151 of file Mix.h.
Referenced by NeedsDither().
|
private |
|
private |
|
private |
|
private |
Definition at line 130 of file Mix.h.
Referenced by NeedsDither(), and Process().
|
private |
Definition at line 166 of file Mix.h.
Referenced by RegisterEffectStage().
|
private |
Definition at line 165 of file Mix.h.
Referenced by NeedsDither(), and Reposition().
|
private |
Definition at line 167 of file Mix.h.
Referenced by RegisterEffectStage().
|
private |
Definition at line 168 of file Mix.h.
Referenced by RegisterEffectStage().
|
private |
|
private |
Definition at line 153 of file Mix.h.
Referenced by MixGetCurrentTime(), Process(), Reposition(), SetSpeedForKeyboardScrubbing(), and SetTimesAndSpeed().