Struct thl::dsp::slicing::SliceMap#
-
struct SliceMap#
Collaboration diagram for thl::dsp::slicing::SliceMap:
Slice boundaries of one sample, in frames.
m_bounds[0] == 0,m_bounds[m_count] == m_total_frames, strictly ascending; slice k is[m_bounds[k], m_bounds[k + 1]). Trivially copyable with a fixed capacity, so a host can hand a whole map to the audio thread by value (seqlock, atomic swap of a copy, message queue).The map belongs to a sample length, not to a sample: alternative sources of the same length (pitch-shifted copies, round-robins) share it, and boundary_frame() rescales for a source of another length.
Public Functions
-
inline bool valid() const#
Structurally sound: 1..k_max_slices strictly ascending slices that cover the whole sample.
-
inline size_t boundary_frame(size_t k, size_t total_frames) const#
Boundary k (0..m_count) as a frame of a source
total_frameslong (exact when the lengths match, rounded otherwise).
-
inline float normalized_bound(size_t k) const#
Boundary k as a fraction of the sample.
-
inline std::vector<float> normalized_bounds() const#
All boundaries as fractions of the sample (allocates).
Public Members
-
uint32_t m_count = {0}#
Number of slices; 0 = no map.
-
uint64_t m_total_frames = {0}#
-
std::array<uint64_t, k_max_slices + 1> m_bounds = {}#
Public Static Functions
-
static inline SliceMap grid(size_t count, size_t total_frames)#
countequal slices of a sampletotal_frameslong.
-
inline bool valid() const#