MayaFlux 0.1.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 64 of file DynamicSoundStream.cpp.

65{
66 if (data.empty()) {
67 return 0;
68 }
69
70 if (channel >= get_num_channels()) {
71 std::cerr << "Channel index " << channel << " exceeds available channels (" << get_num_channels() << ")" << '\n';
72 return 0;
73 }
74
75 uint64_t num_frames = data.size();
76 uint64_t required_end_frame = start_frame + num_frames;
77
78 if (m_auto_resize) {
79 if (required_end_frame > get_num_frames()) {
80 expand_to(required_end_frame);
81 }
82 } else {
83 uint64_t available_frames = (start_frame < get_num_frames()) ? (get_num_frames() - start_frame) : 0;
84
85 if (available_frames == 0) {
86 return 0;
87 }
88
89 if (num_frames > available_frames) {
90 num_frames = available_frames;
91 }
92
93 if (required_end_frame > m_num_frames) {
94 m_num_frames = required_end_frame;
96 }
97 }
98
99 return num_frames;
100}
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.

References expand_to(), MayaFlux::Kakshya::SoundStreamContainer::get_num_channels(), MayaFlux::Kakshya::SoundStreamContainer::get_num_frames(), m_auto_resize, MayaFlux::Kakshya::SoundStreamContainer::m_num_frames, 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: