Audacity 3.2.0
Namespaces | Macros | Functions
Mix.cpp File Reference
#include "Mix.h"
#include "MixerSource.h"
#include <cmath>
#include "EffectStage.h"
#include "Dither.h"
#include "Resample.h"
#include "WideSampleSequence.h"
#include "float_cast.h"
#include <numeric>
Include dependency graph for Mix.cpp:

Go to the source code of this file.

Namespaces

namespace  anonymous_namespace{Mix.cpp}
 

Macros

#define stackAllocate(T, count)   static_cast<T*>(alloca(count * sizeof(T)))
 

Functions

template<typename T , typename F >
std::vector< T > anonymous_namespace{Mix.cpp}::initVector (size_t dim1, const F &f)
 
template<typename T >
std::vector< std::vector< T > > anonymous_namespace{Mix.cpp}::initVector (size_t dim1, size_t dim2)
 
void anonymous_namespace{Mix.cpp}::ConsiderStages (const Mixer::Stages &stages, size_t &blockSize)
 
size_t anonymous_namespace{Mix.cpp}::FindBufferSize (const Mixer::Inputs &inputs, const std::optional< Mixer::Stages > &masterEffects, size_t bufferSize)
 
static void MixBuffers (unsigned numChannels, const unsigned char *channelFlags, const float *gains, const float &src, AudioGraph::Buffers &dests, int len)
 

Macro Definition Documentation

◆ stackAllocate

#define stackAllocate (   T,
  count 
)    static_cast<T*>(alloca(count * sizeof(T)))

Definition at line 282 of file Mix.cpp.

Function Documentation

◆ MixBuffers()

static void MixBuffers ( unsigned  numChannels,
const unsigned char *  channelFlags,
const float *  gains,
const float &  src,
AudioGraph::Buffers dests,
int  len 
)
static

Definition at line 268 of file Mix.cpp.

271{
272 const auto pSrc = &src;
273 for (unsigned int c = 0; c < numChannels; c++) {
274 if (!channelFlags[c])
275 continue;
276 auto dest = &dests.GetWritePosition(c);
277 for (int j = 0; j < len; ++j)
278 dest[j] += pSrc[j] * gains[c]; // the actual mixing process
279 }
280}
float & GetWritePosition(unsigned iChannel)
Get writable position for one channel.

References AudioGraph::Buffers::GetWritePosition().

Referenced by Mixer::Acquire().

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