VAE - Virtual Audio Engine 1
Small Data Driven Audio Engine
vae::core::MixerProcessor Class Reference

#include <vae_mixer_processor.hpp>

Collaboration diagram for vae::core::MixerProcessor:

Public Member Functions

void init ()
 
void mix (VoiceManger &manager, Bank &bank, SampleIndex frames)
 Process the mixers for a single bank. More...
 

Private Attributes

EffectsProcessor mEffectsProcessor
 

Detailed Description

Definition at line 12 of file vae_mixer_processor.hpp.

Member Function Documentation

◆ init()

void vae::core::MixerProcessor::init ( )
inline

Definition at line 15 of file vae_mixer_processor.hpp.

Here is the call graph for this function:

◆ mix()

void vae::core::MixerProcessor::mix ( VoiceManger manager,
Bank bank,
SampleIndex  frames 
)
inline

Process the mixers for a single bank.

Parameters
manager
banks
frames

mix all non master mixers start from back since mixer can only write to mixer with a lower id than themselves to avoid recursion

Definition at line 25 of file vae_mixer_processor.hpp.

27 {
28 VAE_PROFILER_SCOPE_NAMED("Bank Mixer Processor")
29 VAE_ASSERT(!bank.mixers.empty()) // can't happen
30
31 /**
32 * mix all non master mixers
33 * start from back since mixer can only write to mixer with
34 * a lower id than themselves to avoid recursion
35 */
36 for (Uint i = Uint(bank.mixers.size()) - 1; 0 < i; i--) {
37 VAE_PROFILER_SCOPE_NAMED("Process Mixer Channel")
38 auto& sourceMixer = bank.mixers[i];
39 // skip inactive mixers
40 if (sourceMixer.buffer.validSize() == 0) { continue; }
41
42 for (auto& effect : sourceMixer.effects) {
43 mEffectsProcessor.mix(effect, sourceMixer.buffer);
44 }
45
46 // Apply mixer volume
47 // TODO PERF VAE might be better to apply gain and mix in one go
48 sourceMixer.buffer.multiply(sourceMixer.gain);
49 auto& targetMixer = bank.mixers[sourceMixer.parent];
50
51 // mark mixer as active
52 targetMixer.buffer.setValidSize(frames);
53
54 targetMixer.buffer.add(sourceMixer.buffer);
55
56 // clear current mixer for next block
57 sourceMixer.buffer.set(0);
58 }
59
60 auto& masterMixer = bank.mixers[Mixer::MasterMixerHandle];
61 for (auto& effect : masterMixer.effects) {
62 mEffectsProcessor.mix(effect, masterMixer.buffer);
63 }
64 // Apply gain on master as well
65 masterMixer.buffer.multiply(masterMixer.gain);
66 // Master mixer will be mixed to the final output in the engine and then cleared
67 }
void mix(Effect &effect, ScratchBuffer &buffer)
unsigned int Uint
Definition: vae_types.hpp:46
static constexpr MixerHandle MasterMixerHandle
This is the master mixer for a bank.
Definition: vae_mixer.hpp:13
#define VAE_PROFILER_SCOPE_NAMED(name)
Profiles a scope and names it.
#define VAE_ASSERT(condition)
Definition: vae_util.hpp:11
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mEffectsProcessor

EffectsProcessor vae::core::MixerProcessor::mEffectsProcessor
private

Definition at line 13 of file vae_mixer_processor.hpp.


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