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)
 
size_t FindBufferSize (const Mixer::Inputs &inputs, size_t bufferSize)
 

Function Documentation

◆ FindBufferSize()

size_t anonymous_namespace{Mix.cpp}::FindBufferSize ( const Mixer::Inputs inputs,
size_t  bufferSize 
)

Definition at line 49 of file Mix.cpp.

50{
51 size_t blockSize = bufferSize;
52 const auto nTracks = inputs.size();
53 for (size_t i = 0; i < nTracks;) {
54 const auto &input = inputs[i];
55 const auto leader = input.pTrack.get();
56 const auto nInChannels = TrackList::Channels(leader).size();
57 if (!leader || i + nInChannels > nTracks) {
58 assert(false);
59 break;
60 }
61 auto increment = finally([&]{ i += nInChannels; });
62 for (const auto &stage : input.stages) {
63 // Need an instance to query acceptable block size
64 const auto pInstance = stage.factory();
65 if (pInstance)
66 blockSize = std::min(blockSize, pInstance->SetBlockSize(blockSize));
67 // Cache the first factory call
68 stage.mpFirstInstance = move(pInstance);
69 }
70 }
71 return blockSize;
72}
int min(int a, int b)
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1544

References TrackList::Channels(), and min().

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 31 of file Mix.cpp.

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

◆ 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 40 of file Mix.cpp.

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