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

◆ validate()

void ContiguousAccessProcessor::validate ( )
private

Validate the container's structure and output configuration.

Throws if configuration is invalid.

Definition at line 68 of file ContiguousAccessProcessor.cpp.

69{
70 if (m_total_elements == 0) {
71 std::cerr << "Warning: Container has no data elements" << '\n';
72 }
73
74 if (m_output_shape.size() != 2) {
75 throw std::runtime_error("Audio output shape must be [frames, channels]");
76 }
77
78 uint64_t frames_requested = m_output_shape[0];
79 uint64_t channels_requested = m_output_shape[1];
80 uint64_t available_channels = m_structure.get_channel_count();
81
82 if (frames_requested == 0 || channels_requested == 0) {
83 throw std::runtime_error("Frame and channel counts cannot be zero");
84 }
85
86 if (frames_requested > m_structure.get_samples_count_per_channel()) {
87 throw std::runtime_error("Requested frame count exceeds available samples per channel");
88 }
89
90 if (channels_requested > available_channels) {
91 throw std::runtime_error(
92 "Requested " + std::to_string(channels_requested) + " channels exceeds available " + std::to_string(available_channels) + " channels");
93 }
94
95 if (m_current_position.size() != available_channels) {
96 std::cerr << "Warning: Position vector size " << m_current_position.size()
97 << " doesn't match channel count " << available_channels << ", adjusting\n";
98 m_current_position.resize(available_channels, 0);
99 }
100
101 std::cout << "Audio processor: "
102 << (m_structure.organization == OrganizationStrategy::INTERLEAVED ? "interleaved" : "planar")
103 << " layout, processing " << frames_requested << "×" << channels_requested
104 << " blocks, " << m_current_position.size() << " channel positions\n";
105}
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)
static uint64_t get_channel_count(const std::vector< DataDimension > &dimensions)
Extract channel count from dimensions.
static uint64_t get_samples_count_per_channel(const std::vector< DataDimension > &dimensions)
Get samples per channel (time dimension only).

References MayaFlux::Kakshya::ContainerDataStructure::get_channel_count(), MayaFlux::Kakshya::ContainerDataStructure::get_samples_count_per_channel(), MayaFlux::Kakshya::INTERLEAVED, m_current_position, m_output_shape, m_structure, m_total_elements, and MayaFlux::Kakshya::ContainerDataStructure::organization.

Referenced by on_attach(), and set_output_size().

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