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

◆ add_audio_sink()

void MayaFlux::Nexus::add_audio_sink ( std::vector< AudioSink > &  sinks,
Buffers::BufferManager mgr,
uint32_t  channel,
std::function< Kakshya::DataVariant(const InfluenceContext &)>  fn = {},
std::string  fn_name = {} 
)

Create and register an audio sink on channel.

Parameters
sinksSink vector owned by the calling Emitter or Agent.
mgrBufferManager to register the AudioBuffer with.
channelOutput channel index.
fnOptional producer called each dispatch with InfluenceContext. Leave empty when data is supplied via push_audio_data().
fn_nameOptional identifier for state encoding, empty if anonymous.

Definition at line 18 of file Sinks.cpp.

24{
25 auto buf = std::make_shared<Buffers::AudioBuffer>(channel, Buffers::s_preferred_buffer_size);
26 auto writer = std::make_shared<Buffers::AudioWriteProcessor>();
27 buf->set_default_processor(writer);
28
29 mgr.add_buffer(buf, Buffers::ProcessingToken::AUDIO_BACKEND, channel);
30
31 sinks.push_back(AudioSink {
32 .buf = std::move(buf),
33 .writer = std::move(writer),
34 .fn = std::move(fn),
35 .fn_name = std::move(fn_name),
36 .channel = channel,
37 });
38
39 MF_DEBUG(Journal::Component::Buffers, Journal::Context::Init,
40 "Nexus: audio sink added on channel {}", channel);
41}
#define MF_DEBUG(comp, ctx,...)
uint32_t channel
std::string fn_name
void add_buffer(const std::shared_ptr< Buffer > &buffer, ProcessingToken token, uint32_t channel=0)
Adds a buffer to a token and channel.
std::shared_ptr< Buffers::AudioBuffer > buf
Definition Sinks.hpp:43
Holds the plumbing for one audio output registered from a Nexus object.
Definition Sinks.hpp:42

References MayaFlux::Buffers::BufferManager::add_buffer(), MayaFlux::Buffers::AUDIO_BACKEND, MayaFlux::Nexus::AudioSink::buf, MayaFlux::Journal::Buffers, channel, fn_name, MayaFlux::Journal::Init, MF_DEBUG, and MayaFlux::Buffers::s_preferred_buffer_size.

Referenced by MayaFlux::Nexus::Agent::sink_audio(), MayaFlux::Nexus::Emitter::sink_audio(), MayaFlux::Nexus::Agent::sink_audio(), and MayaFlux::Nexus::Emitter::sink_audio().

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