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

◆ iterate_region_channels()

MAYAFLUX_API void MayaFlux::Kakshya::iterate_region_channels ( const std::vector< Region > &  regions,
const std::shared_ptr< SignalSourceContainer > &  source,
uint32_t  num_channels,
const RegionTaper taper,
const RegionWriteFn write_fn 
)

Iterate over a set of regions, extracting per-channel samples and dispatching them to a write callback.

For each region in regions and each channel in [0, num_channels), extracts double samples via get_region_data, optionally applies taper in-place, then calls write_fn with the region index, channel index, and sample span. Regions or channels that yield empty data are silently skipped.

Parameters
regionsOrdered set of regions to iterate.
sourceContainer supplying the sample data.
num_channelsNumber of channels to extract per region.
taperOptional in-place taper. Pass {} to skip.
write_fnCallback receiving (region_idx, channel, samples).

Definition at line 438 of file RegionUtils.cpp.

444{
445 for (size_t ri = 0; ri < regions.size(); ++ri) {
446 auto variants = source->get_region_data(regions[ri]);
447 for (uint32_t ch = 0; ch < num_channels; ++ch) {
448 if (ch >= variants.size())
449 continue;
450 std::vector<double> storage;
451 extract_from_variant<double>(variants[ch], storage);
452 if (storage.empty())
453 continue;
454 if (taper)
455 taper(std::span<double>(storage.data(), storage.size()));
456 write_fn(ri, ch, std::span<double>(storage.data(), storage.size()));
457 }
458 }
459}
Eigen::MatrixXd storage

References storage.