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

◆ file_to_stream()

BufferOperation MayaFlux::Kriya::BufferOperation::file_to_stream ( const std::shared_ptr< IO::IOManager > &  io_manager,
const std::string &  filepath,
std::shared_ptr< Kakshya::DynamicSoundStream target_stream,
uint32_t  cycle_count = 0 
)
static

Create operation to route file data to DynamicSoundStream.

Parameters
io_managerIOManager for file loading
filepathPath to audio file
target_streamTarget DynamicSoundStream
cycle_countNumber of cycles to read (0 = entire file)
Returns
BufferOperation configured for file to stream routing

Definition at line 80 of file BufferOperation.cpp.

85{
86 auto file_container = io_manager->load_audio(filepath);
87 if (!file_container) {
88 error<std::runtime_error>(Journal::Component::Kriya, Journal::Context::AsyncIO, std::source_location::current(),
89 "Failed to load audio file: {}", filepath);
90 }
91
92 auto temp_buffer = std::make_shared<Buffers::SoundFileBridge>(0, file_container);
93 temp_buffer->setup_processors(Buffers::ProcessingToken::AUDIO_BACKEND);
94
96 op.m_source_container = temp_buffer->get_capture_stream();
97 op.m_target_container = std::move(target_stream);
98 op.m_load_length = cycle_count;
99 return op;
100}
BufferOperation(OpType type, BufferCapture capture)
@ ROUTE
Route data to destination (buffer or container)
@ AUDIO_BACKEND
Standard audio processing backend configuration.
@ AsyncIO
Async I/O operations ( network, streaming)
@ Kriya
Automatable tasks and fluent scheduling api for Nodes and Buffers.

References MayaFlux::Journal::AsyncIO, MayaFlux::Buffers::AUDIO_BACKEND, MayaFlux::Journal::Kriya, m_load_length, m_source_container, m_target_container, and ROUTE.