Audacity 3.2.0
Functions
anonymous_namespace{Mix.cpp} Namespace Reference

Functions

template<typename T , typename F >
std::vector< T > initVector (size_t dim1, const F &f)
 
template<typename T >
std::vector< std::vector< T > > initVector (size_t dim1, size_t dim2)
 
void ConsiderStages (const Mixer::Stages &stages, size_t &blockSize)
 
size_t FindBufferSize (const Mixer::Inputs &inputs, const std::optional< Mixer::Stages > &masterEffects, size_t bufferSize)
 
auto NeedsDitherPred (const MixerOptions::StageSpecification &spec)
 

Function Documentation

◆ ConsiderStages()

void anonymous_namespace{Mix.cpp}::ConsiderStages ( const Mixer::Stages stages,
size_t &  blockSize 
)

Definition at line 52 of file Mix.cpp.

53{
54 for (const auto& stage : stages)
55 {
56 // Need an instance to query acceptable block size
57 const auto pInstance = stage.factory();
58 if (pInstance)
59 blockSize = std::min(blockSize, pInstance->SetBlockSize(blockSize));
60 // Cache the first factory call
61 stage.mpFirstInstance = move(pInstance);
62 }
63}
int min(int a, int b)

References min().

Referenced by FindBufferSize().

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

◆ FindBufferSize()

size_t anonymous_namespace{Mix.cpp}::FindBufferSize ( const Mixer::Inputs inputs,
const std::optional< Mixer::Stages > &  masterEffects,
size_t  bufferSize 
)

Definition at line 66 of file Mix.cpp.

69{
70 size_t blockSize = bufferSize;
71 for (const auto &input : inputs) {
72 const auto sequence = input.pSequence.get();
73 const auto nInChannels = sequence->NChannels();
74 if (!sequence) {
75 assert(false);
76 break;
77 }
78 ConsiderStages(input.stages, blockSize);
79 }
80 if (masterEffects)
81 ConsiderStages(*masterEffects, blockSize);
82
83 return blockSize;
84}
static const AttachedProjectObjects::RegisteredFactory masterEffects
void ConsiderStages(const Mixer::Stages &stages, size_t &blockSize)
Definition: Mix.cpp:52

References ConsiderStages(), and masterEffects.

Here is the call graph for this function:

◆ initVector() [1/2]

template<typename T , typename F >
std::vector< T > anonymous_namespace{Mix.cpp}::initVector ( size_t  dim1,
const F &  f 
)

Definition at line 32 of file Mix.cpp.

33{
34 std::vector<T> result( dim1 );
35 for (auto &row : result)
36 f(row);
37 return result;
38}

◆ initVector() [2/2]

template<typename T >
std::vector< std::vector< T > > anonymous_namespace{Mix.cpp}::initVector ( size_t  dim1,
size_t  dim2 
)

Definition at line 41 of file Mix.cpp.

42{
43 return initVector<std::vector<T>>(dim1,
44 [dim2](auto &row){ row.resize(dim2); });
45}

◆ NeedsDitherPred()

auto anonymous_namespace{Mix.cpp}::NeedsDitherPred ( const MixerOptions::StageSpecification spec)

Definition at line 86 of file Mix.cpp.

86 {
87 return spec.mpFirstInstance && spec.mpFirstInstance->NeedsDither();
88};
std::shared_ptr< EffectInstance > mpFirstInstance
Definition: MixerOptions.h:110

References MixerOptions::StageSpecification::mpFirstInstance.