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

◆ record()

MAYAFLUX_API std::pair< std::shared_ptr< BufferPipeline >, std::shared_ptr< Buffers::AudioBuffer > > MayaFlux::Kriya::record ( const std::shared_ptr< Vruta::TaskScheduler > & scheduler,
const std::shared_ptr< Buffers::BufferManager > & buffer_manager,
const std::shared_ptr< Kakshya::DynamicSoundStream > & stream,
uint32_t input_channel,
uint64_t cycles,
std::optional< uint32_t > monitor = std::nullopt,
uint32_t stream_channel = 0 )

Record a live input channel into one channel of a stream for a number of audio cycles.

Registers a listener on input_channel, captures it once per audio cycle and appends each block to stream at the write head of stream_channel. The pipeline starts at once and ends when cycles blocks have been written, or when its end() is called. A linear stream grows and keeps the whole take; a circular one keeps the newest frames. With a monitor channel the listener is also mixed to that output channel, so the input is heard.

The listener is released through the pipeline's on_complete, so setting another on_complete on the pipeline replaces the release and leaves the listener registered.

auto [pipeline, listener] = Kriya::record(scheduler, buffer_manager, stream, 0, 500);
std::pair< std::shared_ptr< BufferPipeline >, std::shared_ptr< Buffers::AudioBuffer > > record(const std::shared_ptr< Vruta::TaskScheduler > &scheduler, const std::shared_ptr< Buffers::BufferManager > &buffer_manager, const std::shared_ptr< Kakshya::DynamicSoundStream > &stream, uint32_t input_channel, uint64_t cycles, std::optional< uint32_t > monitor, uint32_t stream_channel)
Record a live input channel into one channel of a stream for a number of audio cycles.

To record again into the same listener once it has ended, use record_into, which registers the listener again. The stream keeps appending, so a linear stream then holds both takes.

auto again = Kriya::record_into(scheduler, buffer_manager, stream, listener, 0, 500);
std::shared_ptr< BufferPipeline > record_into(const std::shared_ptr< Vruta::TaskScheduler > &scheduler, const std::shared_ptr< Buffers::BufferManager > &buffer_manager, const std::shared_ptr< Kakshya::DynamicSoundStream > &stream, const std::shared_ptr< Buffers::AudioBuffer > &listener, uint32_t input_channel, uint64_t cycles, std::optional< uint32_t > monitor, uint32_t stream_channel)
Record a live input channel into a stream through a listener buffer you supply.
Parameters
schedulerScheduler that runs the pipeline.
buffer_managerManager that owns the input channels.
streamDestination.
input_channelInput channel to record.
cyclesAudio cycles to record, 0 to record until the pipeline ends.
monitorOutput channel to also hear the input on, or none.
stream_channelChannel of the stream that receives the signal.
Returns
The running pipeline and the listener buffer, or two null pointers when the scheduler, manager or stream is null.

Definition at line 323 of file BufferPipeline.cpp.

331{
332 if (!recording_arguments_valid(scheduler, buffer_manager, stream)) {
333 return { nullptr, nullptr };
334 }
335
336 auto listener = BufferOperation::capture_input_from(buffer_manager, input_channel, monitor).get_audio_buffer();
337 auto pipeline = run_recording(scheduler, buffer_manager, stream, listener, input_channel, cycles, monitor, stream_channel);
338
339 return { std::move(pipeline), std::move(listener) };
340}
static CaptureBuilder capture_input_from(const std::shared_ptr< Buffers::BufferManager > &buffer_manager, uint32_t input_channel, std::optional< uint32_t > monitor=std::nullopt)
Create CaptureBuilder for input channel with fluent configuration.
std::shared_ptr< Buffers::AudioBuffer > get_audio_buffer() const
Get the audio buffer this capture reads, or null for a graphics capture.
Definition Capture.hpp:351

References MayaFlux::Kriya::BufferOperation::capture_input_from(), and MayaFlux::Kriya::CaptureBuilder::get_audio_buffer().

Referenced by MayaFlux::record().

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