MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ register_source()

bool MayaFlux::Buffers::MixProcessor::register_source ( std::shared_ptr< AudioBuffer source,
double  mix_level = 1.0,
bool  once = false 
)

register an AudioBuffer source to be mixed into the output of specified channel

Parameters
sourceAudioBuffer to register
mix_levelLevel of mixing for this source (default: 1.0)
onceIf true, the source will be mixed only once and then removed (default: false)

Definition at line 31 of file MixProcessor.cpp.

32{
33 if (!source || source->get_data().empty()) {
34 return false;
35 }
36
37 auto it = std::find_if(m_sources.begin(), m_sources.end(),
38 [&source](const MixSource& s) {
39 return s.matches_buffer(source);
40 });
41
42 if (it != m_sources.end()) {
43 it->mix_level = mix_level;
44 it->once = once;
45 it->refresh_data();
46 return true;
47 }
48
49 m_sources.emplace_back(source, mix_level, once);
50 return true;
51}
std::vector< MixSource > m_sources

References m_sources.