16 size_t region_index {};
20 double transition_duration_ms = 0.0;
25 size_t active_segment_index = 0;
29 bool looping_enabled =
false;
36 : group_name(
std::move(name))
47 for (
const auto& segment : segments) {
48 total += segment.get_total_elements();
58 return std::ranges::any_of(segments,
69 if (active_segment_index < segments.size()) {
70 return &segments[active_segment_index];
80 for (
size_t i = 0; i < segments.size(); ++i) {
81 if (segments[i].contains_position(position)) {
94 attributes[key] = std::forward<T>(value);
100 template <
typename T>
103 auto it = attributes.find(key);
104 if (it != attributes.end()) {
106 return safe_any_cast<T>(it->second);
107 }
catch (
const std::bad_any_cast&) {
RegionSelectionPattern
Describes how regions are selected for processing or playback.
RegionTransition
Describes how transitions between regions are handled.
RegionState
Processing state for regions.
uint64_t get_total_volume() const
Get the total volume (elements) of all segments.
std::vector< uint64_t > loop_start
Loop start coordinates.
std::vector< uint64_t > current_position
Current read position.
std::vector< size_t > active_segment_indices
Multiple active segments (for overlapping)
OrganizedRegion(std::string name, size_t index)
std::optional< T > get_attribute(const std::string &key) const
Get processing metadata from this region.
void set_attribute(const std::string &key, T &&value)
Set processing metadata for this region.
const RegionSegment * get_active_segment() const
Get the active segment for current position.
OrganizedRegion()=default
std::unordered_map< std::string, std::any > attributes
Extensible metadata.
std::vector< RegionSegment > segments
Audio segments in this region.
std::optional< size_t > find_segment_for_position(const std::vector< uint64_t > &position) const
Find segment containing specific position.
bool contains_position(const std::vector< uint64_t > &position) const
Check if position is within any segment.
std::string group_name
Name of the region group.
std::vector< uint64_t > loop_end
Loop end coordinates.
A structured audio region with metadata and transition information.
bool contains_position(const std::vector< uint64_t > &pos) const
Check if a position is within this segment.
Represents a discrete segment of audio data with caching capabilities.