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

◆ create_writer() [1/2]

std::shared_ptr< SoundFileWriter > MayaFlux::IO::IOManager::create_writer ( const std::string &  filepath,
uint32_t  channels,
uint32_t  sample_rate = 48000,
AVCodecID  codec_id = AV_CODEC_ID_NONE 
)

Construct an open SoundFileWriter the caller drives manually.

Allocates, opens, and returns a writer ready to accept write() calls. IOManager does not track this writer; the caller is responsible for calling close() when done.

Parameters
filepathOutput file path. Extension determines container format.
channelsNumber of channels in all submitted data.
sample_ratePCM sample rate in Hz.
codec_idEncoder override; AV_CODEC_ID_NONE = container default.
Returns
Open SoundFileWriter, or nullptr if open() failed.

Definition at line 488 of file IOManager.cpp.

492{
493 auto writer = std::make_shared<SoundFileWriter>();
494 if (!writer->open(filepath, channels, sample_rate, codec_id)) {
496 "create_writer: open failed for '{}': {}", filepath, writer->last_error());
497 return nullptr;
498 }
499
500 {
501 std::lock_guard lock(m_writers_mutex);
502 m_writers.push_back(writer);
503 }
504 return writer;
505}
#define MF_ERROR(comp, ctx,...)
uint32_t channels
std::vector< std::shared_ptr< SoundFileWriter > > m_writers
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.

References channels, MayaFlux::Journal::FileIO, MayaFlux::Journal::IO, m_writers, m_writers_mutex, and MF_ERROR.