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

◆ file_to_stream() [1/2]

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 220 of file BufferOperation.cpp.

225{
226 auto file_container = io_manager->load_audio(filepath);
227 if (!file_container) {
228 error<std::runtime_error>(Journal::Component::Kriya, Journal::Context::AsyncIO, std::source_location::current(),
229 "Failed to load audio file: {}", filepath);
230 }
231
232 auto temp_buffer = std::make_shared<Buffers::SoundFileBridge>(0, file_container);
233 temp_buffer->setup_processors(Buffers::ProcessingToken::AUDIO_BACKEND);
234
236 op.m_source_audio_stream = temp_buffer->get_capture_stream();
237 op.m_target_audio_stream = std::move(target_stream);
238 op.m_load_length = cycle_count;
239 return op;
240}
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_audio_stream, m_target_audio_stream, and ROUTE.