52 std::uint32_t
max_channels() const noexcept {
return max_channels_; }
58 std::uint64_t num_frames,
59 double sample_rate)
noexcept;
63 std::uint64_t frames)
noexcept;
66 std::uint64_t frames)
noexcept;
76 std::uint64_t audio_safe_generation = 0) noexcept;
80 std::uint64_t audio_safe_generation = 0) noexcept;
98 std::uint32_t channel)
const noexcept;
102 std::size_t active_count)
noexcept;
106 std::uint32_t channel)
const noexcept;
107 [[deprecated(
"Use channel_data(PublishedSampleView, channel) for audio reads; raw slot access is test/manual-only")]]
108 const float*
channel_data(std::uint32_t slot_index, std::uint32_t channel)
const noexcept;
111 struct SlotMetadata {
112 std::uint32_t num_channels = 0;
113 std::uint64_t num_frames = 0;
114 double sample_rate = 0.0;
117 template<
typename SampleType>
118 bool write_slot_impl(std::uint32_t slot_index,
120 std::uint64_t frames)
noexcept;
121 template<
typename SampleType>
123 std::uint64_t frames,
125 std::uint64_t audio_safe_generation)
noexcept;
127 bool valid_slot(std::uint32_t slot_index)
const noexcept;
128 float* mutable_channel_data(std::uint32_t slot_index, std::uint32_t channel)
noexcept;
129 const float* slot_channel_data_unchecked(std::uint32_t slot_index,
130 std::uint32_t channel)
const noexcept;
131 void clear_metadata(std::uint32_t slot_index)
noexcept;
133 std::vector<float> storage_;
134 std::vector<std::atomic<std::uint8_t>> states_;
135 std::vector<std::atomic_bool> write_committed_;
136 std::vector<SlotMetadata> metadata_;
137 std::vector<std::atomic<std::uint64_t>> retire_after_generation_;
140 std::uint32_t slot_count_ = 0;
141 std::uint32_t max_channels_ = 0;
142 std::uint64_t max_frames_per_slot_ = 0;
143 std::uint64_t publish_generation_ = 0;
145 void clear_unprepared() noexcept;
Non-owning view over multi-channel audio sample data.
Definition buffer.hpp:30
const float * channel_data(std::uint32_t slot_index, std::uint32_t channel) const noexcept
bool write_slot(std::uint32_t slot_index, BufferView< float > source, std::uint64_t frames) noexcept
SampleSlotState slot_state(std::uint32_t slot_index) const noexcept
std::uint32_t slot_count() const noexcept
Definition sample_slot_bank.hpp:51
bool acknowledge_audio_generation(std::uint64_t generation) noexcept
std::uint64_t max_frames_per_slot() const noexcept
Definition sample_slot_bank.hpp:53
bool complete_slot(std::uint32_t slot_index) noexcept
const float * channel_data(const PublishedSampleView &view, std::uint32_t channel) const noexcept
int reserve_slot(std::uint32_t num_channels, std::uint64_t num_frames, double sample_rate) noexcept
const float * slot_channel_data_for_test(std::uint32_t slot_index, std::uint32_t channel) const noexcept
bool release_slot(std::uint32_t slot_index) noexcept
double slot_sample_rate(std::uint32_t slot_index) const noexcept
bool publish_slot(std::uint32_t slot_index) noexcept
bool publish_from_buffer(BufferView< const float > source, std::uint64_t frames, double sample_rate, std::uint64_t audio_safe_generation=0) noexcept
bool slot_view_valid(const PublishedSampleView &view) const noexcept
static std::uint64_t oldest_active_generation(const PublishedSampleView ¤t, const PublishedSampleView *active_views, std::size_t active_count) noexcept
PublishedSampleView read_published_view() const noexcept
Definition sample_slot_bank.hpp:86
bool write_slot(std::uint32_t slot_index, BufferView< const float > source, std::uint64_t frames) noexcept
std::uint32_t slot_num_channels(std::uint32_t slot_index) const noexcept
std::uint32_t max_channels() const noexcept
Definition sample_slot_bank.hpp:52
bool prepare(std::uint32_t slot_count, std::uint32_t max_channels, std::uint64_t max_frames_per_slot)
std::uint64_t slot_num_frames(std::uint32_t slot_index) const noexcept
Lock-free reader/writer for reading multi-field structs as consistent snapshots.
Definition seqlock.hpp:42
Definition analyzer_provider.hpp:12
SampleSlotState
Definition sample_slot_bank.hpp:13
@ Reserved
Definition sample_slot_bank.hpp:15
@ Published
Definition sample_slot_bank.hpp:18
@ Writing
Definition sample_slot_bank.hpp:16
@ Retired
Definition sample_slot_bank.hpp:19
@ Completed
Definition realtime_sample_recorder.hpp:19
@ Free
Definition instrument_voice_allocator.hpp:18
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
Lock-free sequence-lock for coherent multi-field snapshots.
Definition sample_slot_bank.hpp:22
double sample_rate
Definition sample_slot_bank.hpp:28
bool valid
Definition sample_slot_bank.hpp:23
std::uint32_t slot_index
Definition sample_slot_bank.hpp:24
std::uint64_t generation
Definition sample_slot_bank.hpp:25
std::uint64_t num_frames
Definition sample_slot_bank.hpp:27
std::uint32_t num_channels
Definition sample_slot_bank.hpp:26