Audacity 3.2.0
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mixer Class Referencefinal

Functions for doing the mixdown of the tracks. More...

#include <Mix.h>

Collaboration diagram for Mixer:
[legend]

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
 
Mixeroperator= (const Mixer &)=delete
 
Mixeroperator= (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, sampleFormatNeedsDither (bool needsDither, double rate) const
 

Private Attributes

const unsigned mNumChannels
 
Inputs mInputs
 
const std::optional< StagesmMasterEffects
 
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< TimesAndSpeedmTimesAndSpeed
 
AudioGraph::Buffers mTemp
 
const std::vector< SampleBuffermBuffer
 
std::vector< MixerSourcemSources
 
std::vector< EffectSettingsmSettings
 
std::vector< AudioGraph::BuffersmStageBuffers
 
std::vector< std::unique_ptr< EffectStage > > mStages
 
std::unique_ptr< AudioGraph::SourcemDownmixStage
 
std::unique_ptr< AudioGraph::SourcemMasterDownmixStage
 
AudioGraph::SourcemDownstream {}
 

Detailed Description

Functions for doing the mixdown of the tracks.

Definition at line 30 of file Mix.h.

Member Typedef Documentation

◆ ApplyVolume

Definition at line 51 of file Mix.h.

◆ Inputs

using Mixer::Inputs = std::vector<Input>

Definition at line 49 of file Mix.h.

◆ MixerSpec

Definition at line 34 of file Mix.h.

◆ ResampleParameters

Definition at line 35 of file Mix.h.

◆ Stages

Definition at line 37 of file Mix.h.

◆ TimesAndSpeed

Definition at line 36 of file Mix.h.

◆ WarpOptions

Definition at line 33 of file Mix.h.

Constructor & Destructor Documentation

◆ Mixer() [1/3]

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

Precondition
all sequences in inputs are non-null
!!masterEffects && mixerSpec == nullptr && numOutChannels <= 2
Postcondition
BufferSize() <= outBufferSize (equality when no inputs have stages)
Parameters
mixerSpecNull or else must have a lifetime enclosing this object's

Definition at line 92 of file Mix.cpp.

99 : mNumChannels { numOutChannels }
100 , mInputs { move(inputs) }
101 , mMasterEffects { move(masterEffects) }
102 , mBufferSize { FindBufferSize(mInputs, mMasterEffects, outBufferSize) }
103 , mApplyVolume { applyVolume }
104 , mHighQuality { highQuality }
105 , mFormat { outFormat }
106 , mInterleaved { outInterleaved }
107 , mTimesAndSpeed { std::make_shared<TimesAndSpeed>(TimesAndSpeed {
108 startTime, stopTime, warpOptions.initialSpeed, startTime }) }
109
110 // non-interleaved
111 , mTemp { mNumChannels, mBufferSize, 1, 1 }
112 , mBuffer { initVector<SampleBuffer>(
114 [format = mFormat,
116 auto& buffer) { buffer.Allocate(size, format); }) }
118{
119 assert(BufferSize() <= outBufferSize);
120 const auto nChannelsIn =
121 std::accumulate(mInputs.begin(), mInputs.end(), size_t{},
122 [](auto sum, const auto &input){
123 return sum + input.pSequence->NChannels(); });
124
125 // Examine the temporary instances that were made in FindBufferSize
126 // This finds a sufficient, but not necessary, condition to do dithering
127 bool needsDither = std::any_of(mInputs.begin(), mInputs.end(),
128 [](const Input &input){
129 return std::any_of(input.stages.begin(), input.stages.end(), NeedsDitherPred); }
130 );
131 if (mMasterEffects)
132 needsDither |= std::any_of(
134
135 auto pMixerSpec = ( mixerSpec &&
136 mixerSpec->GetNumChannels() == mNumChannels &&
137 mixerSpec->GetNumTracks() == nChannelsIn
138 ) ? mixerSpec : nullptr;
139 mHasMixerSpec = pMixerSpec != nullptr;
140
141 // Reserve vectors first so we can take safe references to pushed elements
142 mSources.reserve(nChannelsIn);
143 // One stereo-capable stage per effect.
144 const auto nMasterStages = mMasterEffects ? mMasterEffects->size() : 0;
145 const auto nStages =
146 std::accumulate(
147 mInputs.begin(), mInputs.end(), 0,
148 [](auto sum, const auto& input) {
149 return sum + input.stages.size();
150 }) +
151 nMasterStages;
152 mSettings.reserve(nStages);
153 mStageBuffers.reserve(nStages);
154
155 size_t i = 0;
156 std::vector<std::unique_ptr<DownmixSource>> downmixSources;
157 for (auto &input : mInputs) {
158 const auto &sequence = input.pSequence;
159 if (!sequence) {
160 assert(false);
161 break;
162 }
163
164 auto &source = mSources.emplace_back(sequence, BufferSize(), outRate,
165 warpOptions, highQuality, mayThrow, mTimesAndSpeed);
166 AudioGraph::Source *pDownstream = &source;
167 for (const auto &stage : input.stages)
168 if (
169 auto& pNewDownstream =
170 RegisterEffectStage(*pDownstream, sequence->NChannels(), stage, outRate))
171 {
172 pDownstream = pNewDownstream.get();
173 }
174 downmixSources.emplace_back(
175 std::make_unique<SequenceDownmixSource>(
176 *pDownstream,
177 *sequence,
178 pMixerSpec ? &pMixerSpec->mMap[i] : nullptr
179 )
180 );
181
182 i += sequence->NChannels();
183 }
184
185 if (mMasterEffects && !mMasterEffects->empty())
186 {
187 mDownmixStage = std::make_unique<DownmixStage>(
188 std::move(downmixSources), mNumChannels, mBufferSize, ApplyVolume::MapChannels
189 );
190
191 AudioGraph::Source* pDownstream = mDownmixStage.get();
192 for (const auto& stage : *mMasterEffects)
193 {
194 if (
195 auto& pNewDownstream =
196 RegisterEffectStage(*pDownstream, mNumChannels, stage, outRate))
197 {
198 pDownstream = pNewDownstream.get();
199 }
200 }
201
202 //Effect stage could have more than mNumChannels output
203 //and expect at least 3 float buffers input to work correctly...
204 std::vector<std::unique_ptr<DownmixSource>> masterDownmixSources;
205 masterDownmixSources.push_back(std::make_unique<SimpleDonwmixSource>(*pDownstream, mNumChannels));
206 mMasterDownmixStage = std::make_unique<DownmixStage>(
207 std::move(masterDownmixSources), mNumChannels, mBufferSize, ApplyVolume::Mixdown);
209 }
210 else
211 {
212 mDownmixStage = std::make_unique<DownmixStage>(
213 std::move(downmixSources),
217 );
219 }
220
221 // Decide once at construction time
222 std::tie(mNeedsDither, mEffectiveFormat) = NeedsDither(needsDither, outRate);
223}
static const AttachedProjectObjects::RegisteredFactory masterEffects
Upstream producer of sample streams, taking Buffers as external context.
std::unique_ptr< EffectStage > & RegisterEffectStage(AudioGraph::Source &upstream, size_t numChannels, const MixerOptions::StageSpecification &stage, double outRate)
Definition: Mix.cpp:414
AudioGraph::Source * mDownstream
Definition: Mix.h:171
std::unique_ptr< AudioGraph::Source > mDownmixStage
Definition: Mix.h:169
std::vector< EffectSettings > mSettings
Definition: Mix.h:166
const std::vector< SampleBuffer > mBuffer
Definition: Mix.h:163
const sampleFormat mFormat
Definition: Mix.h:145
Inputs mInputs
Definition: Mix.h:131
MixerOptions::TimesAndSpeed TimesAndSpeed
Definition: Mix.h:36
AudioGraph::Buffers mTemp
Definition: Mix.h:160
const ApplyVolume mApplyVolume
Definition: Mix.h:143
std::pair< bool, sampleFormat > NeedsDither(bool needsDither, double rate) const
Definition: Mix.cpp:228
const unsigned mNumChannels
Definition: Mix.h:130
sampleFormat mEffectiveFormat
Definition: Mix.h:149
std::unique_ptr< AudioGraph::Source > mMasterDownmixStage
Definition: Mix.h:170
const std::optional< Stages > mMasterEffects
Definition: Mix.h:132
const bool mInterleaved
Definition: Mix.h:146
const size_t mBufferSize
Definition: Mix.h:135
bool mNeedsDither
Definition: Mix.h:150
std::vector< AudioGraph::Buffers > mStageBuffers
Definition: Mix.h:167
const bool mHighQuality
Definition: Mix.h:144
std::vector< MixerSource > mSources
Definition: Mix.h:165
size_t BufferSize() const
Definition: Mix.h:79
const std::shared_ptr< TimesAndSpeed > mTimesAndSpeed
Definition: Mix.h:153
bool mHasMixerSpec
Definition: Mix.h:151
unsigned GetNumTracks() const
Definition: MixerOptions.h:50
unsigned GetNumChannels() const
Definition: MixerOptions.h:47
auto NeedsDitherPred(const MixerOptions::StageSpecification &spec)
Definition: Mix.cpp:86
size_t FindBufferSize(const Mixer::Inputs &inputs, const std::optional< Mixer::Stages > &masterEffects, size_t bufferSize)
Definition: Mix.cpp:66

References anonymous_namespace{ExportPCM.cpp}::format, and size.

◆ Mixer() [2/3]

Mixer::Mixer ( const Mixer )
delete

◆ Mixer() [3/3]

Mixer::Mixer ( Mixer &&  )
deletenoexcept

◆ ~Mixer()

Mixer::~Mixer ( )
default

Member Function Documentation

◆ BufferSize()

size_t Mixer::BufferSize ( ) const
inline

Definition at line 79 of file Mix.h.

79{ return mBufferSize; }

Referenced by Process().

Here is the caller graph for this function:

◆ Clear()

void Mixer::Clear ( )
private

Definition at line 289 of file Mix.cpp.

290{
291 for (auto c = 0; c < mTemp.Channels(); ++c)
293}
unsigned Channels() const
void ClearBuffer(unsigned iChannel, size_t n)

References AudioGraph::Buffers::Channels(), AudioGraph::Buffers::ClearBuffer(), mBufferSize, and mTemp.

Referenced by Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EffectiveFormat()

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.

355{
356 return mEffectiveFormat;
357}

References mEffectiveFormat.

Referenced by MixAndRender().

Here is the caller graph for this function:

◆ GetBuffer() [1/2]

constSamplePtr Mixer::GetBuffer ( )

Retrieve the main buffer or the interleaved buffer.

Definition at line 344 of file Mix.cpp.

345{
346 return mBuffer[0].ptr();
347}

References mBuffer.

Referenced by MixAndRender().

Here is the caller graph for this function:

◆ GetBuffer() [2/2]

constSamplePtr Mixer::GetBuffer ( int  channel)

Retrieve one of the non-interleaved buffers.

Definition at line 349 of file Mix.cpp.

350{
351 return mBuffer[channel].ptr();
352}

References mBuffer.

◆ MixGetCurrentTime()

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.

360{
361 return mTimesAndSpeed->mTime;
362}

References mTimesAndSpeed.

Referenced by anonymous_namespace{ExportPluginHelpers.cpp}::EvalExportProgress(), and MixAndRender().

Here is the caller graph for this function:

◆ NeedsDither()

std::pair< bool, sampleFormat > Mixer::NeedsDither ( bool  needsDither,
double  rate 
) const
private

TODO: more-than-two-channels

Definition at line 228 of file Mix.cpp.

229{
230 // This will accumulate the widest effective format of any input
231 // clip
232 auto widestEffectiveFormat = narrowestSampleFormat;
233
234 // needsDither may already be given as true.
235 // There are many other possible disqualifiers for the avoidance of dither.
236 if (std::any_of(mSources.begin(), mSources.end(),
237 std::mem_fn(&MixerSource::VariableRates))
238 )
239 // We will call MixVariableRates(), so we need nontrivial resampling
240 needsDither = true;
241
242 for (const auto &input : mSources) {
243 auto &sequence = input.GetSequence();
244
245 if (sequence.GetRate() != rate)
246 // Also leads to MixVariableRates(), needs nontrivial resampling
247 needsDither = true;
249 !mHasMixerSpec &&
250 sequence.NChannels() > 1 && mNumChannels == 1)
251 {
252 needsDither = true;
253 }
256 for (auto c : {0, 1}) {
257 const auto volume = sequence.GetChannelVolume(c);
258 if (!(volume == 0.0 || volume == 1.0))
259 // Fractional volume may be applied even in MixSameRate
260 needsDither = true;
261 }
262 }
263 // Examine all tracks. (This ignores the time bounds for the mixer.
264 // If it did not, we might avoid dither in more cases. But if we fix
265 // that, remember that some mixers change their time bounds after
266 // construction, as when scrubbing.)
267 if (!sequence.HasTrivialEnvelope())
268 // Varying or non-unit volume may be applied even in MixSameRate
269 needsDither = true;
270 auto effectiveFormat = sequence.WidestEffectiveFormat();
271 if (effectiveFormat > mFormat)
272 // Real, not just nominal, precision loss would happen in at
273 // least one clip
274 needsDither = true;
275 widestEffectiveFormat =
276 std::max(widestEffectiveFormat, effectiveFormat);
277 }
278
279 if (needsDither)
280 // Results will be dithered to width mFormat
281 return { true, mFormat };
282 else {
283 // Results will not be dithered
284 assert(widestEffectiveFormat <= mFormat);
285 return { false, widestEffectiveFormat };
286 }
287}
@ narrowestSampleFormat
Two synonyms for previous values that might change if more values were added.
bool VariableRates() const
Definition: MixerSource.h:61

References DownmixStage::Discard, mApplyVolume, mFormat, mHasMixerSpec, DownmixStage::Mixdown, mNumChannels, mSources, narrowestSampleFormat, and MixerSource::VariableRates().

Here is the call graph for this function:

◆ operator=() [1/2]

Mixer & Mixer::operator= ( const Mixer )
delete

◆ operator=() [2/2]

Mixer & Mixer::operator= ( Mixer &&  )
deletenoexcept

◆ Process() [1/2]

size_t Mixer::Process ( )
inline
Postcondition
result: result <= BufferSize()

Definition at line 98 of file Mix.h.

98{ return Process(BufferSize()); }
size_t Process()
Definition: Mix.h:98

References BufferSize, and Process().

Referenced by Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Process() [2/2]

size_t Mixer::Process ( size_t  maxSamples)

Process a maximum of 'maxSamples' samples and put them into the buffer, at GetBuffer().

Precondition
maxSamples <= BufferSize()
Postcondition
result: result <= maxSamples
Returns
number of output samples, or 0, if there are no more samples that must be processed.

Definition at line 295 of file Mix.cpp.

296{
297 assert(maxToProcess <= BufferSize());
298
299 // MB: this is wrong! mT represented warped time, and mTime is too inaccurate to use
300 // it here. It's also unnecessary I think.
301 //if (mT >= mT1)
302 // return 0;
303
304 auto &[mT0, mT1, _, mTime] = *mTimesAndSpeed;
305 auto oldTime = mTime;
306 // backwards (as possibly in scrubbing)
307 const auto backwards = (mT0 > mT1);
308
309 Clear();
310
311 std::optional<size_t> maxOut;
312
313 maxOut = mDownstream->Acquire(mTemp, maxToProcess);
315
316 if (!maxOut)
317 return 0;
318
319 if (backwards)
320 mTime = std::clamp(mTime, mT1, oldTime);
321 else
322 mTime = std::clamp(mTime, oldTime, mT1);
323
324 const auto dstStride = (mInterleaved ? mNumChannels : 1);
325 auto ditherType = mNeedsDither
328 for (size_t c = 0; c < mNumChannels; ++c)
331 ? mBuffer[0].ptr() + (c * SAMPLE_SIZE(mFormat))
332 : mBuffer[c].ptr()
333 ),
334 mFormat, *maxOut, ditherType,
335 1, dstStride);
336
337 // MB: this doesn't take warping into account, replaced with code based on mSamplePos
338 //mT += (maxOut / mRate);
339
340 assert(*maxOut <= maxToProcess);
341 return *maxOut;
342}
@ none
Definition: Dither.h:20
#define _(s)
Definition: Internat.h:73
DitherType gLowQualityDither
These global variables are assigned at application startup or after change of preferences.
DitherType gHighQualityDither
void CopySamples(constSamplePtr src, sampleFormat srcFormat, samplePtr dst, sampleFormat dstFormat, size_t len, DitherType ditherType, unsigned int srcStride, unsigned int dstStride)
Copy samples from any format to any other format; apply dithering only if narrowing the format.
#define SAMPLE_SIZE(SampleFormat)
Definition: SampleFormat.h:52
constSamplePtr GetReadPosition(unsigned iChannel) const
Get accumulated data for one channel.
virtual std::optional< size_t > Acquire(Buffers &data, size_t bound)=0
Occupy vacant space in Buffers with some data.
virtual bool Release()=0
Caller is done examining last Acquire()d positions.
void Clear()
Definition: Mix.cpp:289

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterEffectStage()

std::unique_ptr< EffectStage > & Mixer::RegisterEffectStage ( AudioGraph::Source upstream,
size_t  numChannels,
const MixerOptions::StageSpecification stage,
double  outRate 
)
private

Definition at line 414 of file Mix.cpp.

418{
419 // Make a mutable copy of stage.settings
420 auto& settings = mSettings.emplace_back(stage.settings);
421 // TODO: more-than-two-channels
422 // Like mFloatBuffers but padding not needed for soxr
423 // Allocate one extra buffer to hold dummy zero inputs
424 // (Issue 3854)
425 auto& stageInput = mStageBuffers.emplace_back(3, mBufferSize, 1);
426 const auto& factory = [&stage] {
427 // Avoid unnecessary repeated calls to the factory
428 return stage.mpFirstInstance ? move(stage.mpFirstInstance) :
429 stage.factory();
430 };
431 auto& pNewDownstream = mStages.emplace_back(EffectStage::Create(
432 -1, numChannels, upstream, stageInput, factory, settings, outRate,
433 std::nullopt));
434 if (!pNewDownstream)
435 {
436 // Just omit the failed stage from rendering
437 // TODO propagate the error?
438 mStageBuffers.pop_back();
439 mSettings.pop_back();
440 }
441 return pNewDownstream;
442}
static RegisteredToolbarFactory factory
static Settings & settings()
Definition: TrackInfo.cpp:51
static std::unique_ptr< EffectStage > Create(int channel, int nInputChannels, Source &upstream, Buffers &inBuffers, const Factory &factory, EffectSettings &settings, double sampleRate, std::optional< sampleCount > genLength)
Satisfies postcondition of constructor or returns null.
Definition: EffectStage.cpp:79
std::vector< std::unique_ptr< EffectStage > > mStages
Definition: Mix.h:168
std::shared_ptr< EffectInstance > mpFirstInstance
Definition: MixerOptions.h:110

References EffectStage::Create(), MixerOptions::StageSpecification::factory, factory, mBufferSize, MixerOptions::StageSpecification::mpFirstInstance, mSettings, mStageBuffers, mStages, MixerOptions::StageSpecification::settings, and settings().

Here is the call graph for this function:

◆ Reposition()

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.

365{
366 const auto &[mT0, mT1, _, __] = *mTimesAndSpeed;
367 auto &mTime = mTimesAndSpeed->mTime;
368 mTime = t;
369 const bool backwards = (mT1 < mT0);
370 if (backwards)
371 mTime = std::clamp(mTime, mT1, mT0);
372 else
373 mTime = std::clamp(mTime, mT0, mT1);
374
375 for (auto &source : mSources)
376 source.Reposition(mTime, bSkipping);
377}

References _, mSources, and mTimesAndSpeed.

Referenced by SetSpeedForKeyboardScrubbing(), and SetTimesAndSpeed().

Here is the caller graph for this function:

◆ SetSpeedForKeyboardScrubbing()

void Mixer::SetSpeedForKeyboardScrubbing ( double  speed,
double  startTime 
)

Definition at line 389 of file Mix.cpp.

390{
391 wxASSERT(std::isfinite(speed));
392 auto &[mT0, mT1, mSpeed, _] = *mTimesAndSpeed;
393
394 // Check if the direction has changed
395 if ((speed > 0.0 && mT1 < mT0) || (speed < 0.0 && mT1 > mT0)) {
396 // It's safe to use 0 and std::numeric_limits<double>::max(),
397 // because Mixer::MixVariableRates() doesn't sample past the start
398 // or end of the audio in a track.
399 if (speed > 0.0 && mT1 < mT0) {
400 mT0 = 0;
401 mT1 = std::numeric_limits<double>::max();
402 }
403 else {
404 mT0 = std::numeric_limits<double>::max();
405 mT1 = 0;
406 }
407
408 Reposition(startTime, true);
409 }
410
411 mSpeed = fabs(speed);
412}
void Reposition(double t, bool bSkipping=false)
Reposition processing to absolute time next time Process() is called.
Definition: Mix.cpp:364

References _, mTimesAndSpeed, and Reposition().

Here is the call graph for this function:

◆ SetTimesAndSpeed()

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.

380{
381 wxASSERT(std::isfinite(speed));
382 auto &[mT0, mT1, mSpeed, _] = *mTimesAndSpeed;
383 mT0 = t0;
384 mT1 = t1;
385 mSpeed = fabs(speed);
386 Reposition(t0, bSkipping);
387}

References _, mTimesAndSpeed, and Reposition().

Here is the call graph for this function:

Member Data Documentation

◆ mApplyVolume

const ApplyVolume Mixer::mApplyVolume
private

Definition at line 143 of file Mix.h.

Referenced by NeedsDither().

◆ mBuffer

const std::vector<SampleBuffer> Mixer::mBuffer
private

Definition at line 163 of file Mix.h.

Referenced by GetBuffer(), and Process().

◆ mBufferSize

const size_t Mixer::mBufferSize
private

Definition at line 135 of file Mix.h.

Referenced by Clear(), and RegisterEffectStage().

◆ mDownmixStage

std::unique_ptr<AudioGraph::Source> Mixer::mDownmixStage
private

Definition at line 169 of file Mix.h.

◆ mDownstream

AudioGraph::Source* Mixer::mDownstream {}
private

Definition at line 171 of file Mix.h.

Referenced by Process().

◆ mEffectiveFormat

sampleFormat Mixer::mEffectiveFormat
private

Definition at line 149 of file Mix.h.

Referenced by EffectiveFormat().

◆ mFormat

const sampleFormat Mixer::mFormat
private

Definition at line 145 of file Mix.h.

Referenced by NeedsDither(), and Process().

◆ mHasMixerSpec

bool Mixer::mHasMixerSpec {false}
private

Definition at line 151 of file Mix.h.

Referenced by NeedsDither().

◆ mHighQuality

const bool Mixer::mHighQuality
private

Definition at line 144 of file Mix.h.

Referenced by Process().

◆ mInputs

Inputs Mixer::mInputs
private

Definition at line 131 of file Mix.h.

◆ mInterleaved

const bool Mixer::mInterleaved
private

Definition at line 146 of file Mix.h.

Referenced by Process().

◆ mMasterDownmixStage

std::unique_ptr<AudioGraph::Source> Mixer::mMasterDownmixStage
private

Definition at line 170 of file Mix.h.

◆ mMasterEffects

const std::optional<Stages> Mixer::mMasterEffects
private

Definition at line 132 of file Mix.h.

◆ mNeedsDither

bool Mixer::mNeedsDither
private

Definition at line 150 of file Mix.h.

Referenced by Process().

◆ mNumChannels

const unsigned Mixer::mNumChannels
private

Definition at line 130 of file Mix.h.

Referenced by NeedsDither(), and Process().

◆ mSettings

std::vector<EffectSettings> Mixer::mSettings
private

Definition at line 166 of file Mix.h.

Referenced by RegisterEffectStage().

◆ mSources

std::vector<MixerSource> Mixer::mSources
private

Definition at line 165 of file Mix.h.

Referenced by NeedsDither(), and Reposition().

◆ mStageBuffers

std::vector<AudioGraph::Buffers> Mixer::mStageBuffers
private

Definition at line 167 of file Mix.h.

Referenced by RegisterEffectStage().

◆ mStages

std::vector<std::unique_ptr<EffectStage> > Mixer::mStages
private

Definition at line 168 of file Mix.h.

Referenced by RegisterEffectStage().

◆ mTemp

AudioGraph::Buffers Mixer::mTemp
private

Definition at line 160 of file Mix.h.

Referenced by Clear(), and Process().

◆ mTimesAndSpeed

const std::shared_ptr<TimesAndSpeed> Mixer::mTimesAndSpeed
private

The documentation for this class was generated from the following files: