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

◆ validate_single_channel()

uint64_t MayaFlux::Kakshya::DynamicSoundStream::validate_single_channel ( std::span< const double >  data,
uint64_t  start_frame = 0,
uint32_t  channel = 0 
)
private

Definition at line 67 of file DynamicSoundStream.cpp.

68{
69 if (data.empty()) {
70 return 0;
71 }
72
73 if (channel >= get_num_channels()) {
74 MF_ERROR(Journal::Component::Kakshya, Journal::Context::ContainerProcessing, "Channel index {} exceeds available channels ({})", channel, get_num_channels());
75 return 0;
76 }
77
78 uint64_t num_frames = data.size();
79 uint64_t required_end_frame = start_frame + num_frames;
80
81 if (m_auto_resize) {
82 if (required_end_frame > get_num_frames()) {
83 expand_to(required_end_frame);
84 }
85 } else {
86 uint64_t available_frames = (start_frame < get_num_frames()) ? (get_num_frames() - start_frame) : 0;
87
88 if (available_frames == 0) {
89 return 0;
90 }
91
92 if (num_frames > available_frames) {
93 num_frames = available_frames;
94 }
95
96 if (required_end_frame > m_num_frames) {
97 m_num_frames = required_end_frame;
99 }
100 }
101
102 return num_frames;
103}
#define MF_ERROR(comp, ctx,...)
bool m_auto_resize
Enable automatic capacity expansion.
uint64_t get_num_frames() const override
Get the number of frames in the primary (temporal) dimension.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.

References MayaFlux::Journal::ContainerProcessing, expand_to(), MayaFlux::Kakshya::SoundStreamContainer::get_num_channels(), MayaFlux::Kakshya::SoundStreamContainer::get_num_frames(), MayaFlux::Journal::Kakshya, m_auto_resize, MayaFlux::Kakshya::SoundStreamContainer::m_num_frames, MF_ERROR, and MayaFlux::Kakshya::SoundStreamContainer::setup_dimensions().

Referenced by write_frames().

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