100 bool transport_jumped = false) noexcept;
102 std::uint32_t frames,
103 bool transport_jumped = false) noexcept;
117 [[deprecated(
"Use materialize_snapshot_quiescent() or materialize_held_snapshot()")]]
126 std::uint64_t
max_frames() const noexcept {
return max_frames_; }
135 struct TimedCommand {
137 std::uint32_t offset = 0;
138 std::uint32_t order = 0;
141 template<
typename SampleType>
143 std::uint32_t frames,
144 bool transport_jumped)
noexcept;
146 template<
typename SampleType>
148 std::uint32_t source_offset,
149 std::uint32_t frames)
noexcept;
156 void clear_storage() noexcept;
158 void push_simple_event(
std::uint64_t sequence_id,
160 std::uint32_t block_offset) noexcept;
162 void publish_frames_recorded() noexcept;
164 std::uint32_t& count,
165 std::uint32_t block_frames) noexcept;
167 std::uint32_t count) noexcept;
169 std::uint32_t block_offset) noexcept;
171 std::uint32_t block_offset) noexcept;
172 void complete_recording(
std::uint64_t sequence_id,
std::uint32_t block_offset) noexcept;
173 void cancel_recording(
std::uint64_t sequence_id,
std::uint32_t block_offset) noexcept;
174 float* mutable_channel_data(
std::uint32_t channel) noexcept;
179 std::vector<
float> storage_;
180 std::vector<
float*> mutable_ptrs_;
183 std::uint32_t num_channels_ = 0;
184 std::uint64_t max_frames_ = 0;
185 std::uint64_t target_frames_ = 0;
186 std::uint64_t frames_recorded_ = 0;
187 std::uint64_t active_sequence_id_ = 0;
188 double sample_rate_ = 0.0;
189 bool cancel_on_transport_jump_ = true;
190 bool prepared_ = false;
192 std::atomic<
std::uint8_t> state_snapshot_{
194 std::atomic<std::uint64_t> frames_recorded_snapshot_{0};
195 std::atomic<std::uint64_t> total_recorded_frames_{0};
196 std::atomic<std::uint64_t> dropped_commands_{0};
197 std::atomic<std::uint64_t> dropped_events_{0};
Non-owning view over multi-channel audio sample data.
Definition buffer.hpp:30
bool materialize_held_snapshot(const RollingAudioCaptureBuffer &capture, const RollingAudioCaptureSnapshot &snapshot) noexcept
RealtimeSampleRecorderStats stats() const noexcept
static constexpr std::size_t kCommandQueueCapacity
Definition realtime_sample_recorder.hpp:82
double sample_rate() const noexcept
Definition realtime_sample_recorder.hpp:128
static constexpr std::size_t kEventQueueCapacity
Definition realtime_sample_recorder.hpp:83
bool pop_event(RealtimeSampleRecorderEvent &event) noexcept
bool prepare(const RealtimeSampleRecorderConfig &config)
std::uint32_t num_channels() const noexcept
Definition realtime_sample_recorder.hpp:125
void process(BufferView< const float > source, std::uint32_t frames, bool transport_jumped=false) noexcept
std::uint64_t frames_recorded() const noexcept
bool enqueue_command(const RealtimeSampleRecorderCommand &command) noexcept
bool materialize_snapshot(const RollingAudioCaptureBuffer &capture, const RollingAudioCaptureSnapshot &snapshot) noexcept
bool materialize_snapshot_quiescent(const RollingAudioCaptureBuffer &capture, const RollingAudioCaptureSnapshot &snapshot) noexcept
const float * channel_data(std::uint32_t channel) const noexcept
RealtimeSampleRecorder()=default
std::uint64_t max_frames() const noexcept
Definition realtime_sample_recorder.hpp:126
RealtimeSampleRecorderState state() const noexcept
bool consume_completed_recording() noexcept
Definition rolling_audio_capture_buffer.hpp:75
Definition analyzer_provider.hpp:12
RealtimeSampleRecorderEventType
Definition realtime_sample_recorder.hpp:37
@ CommandRejected
Definition realtime_sample_recorder.hpp:39
@ Started
Definition realtime_sample_recorder.hpp:40
@ CommandAccepted
Definition realtime_sample_recorder.hpp:38
RealtimeSampleRecorderState
Definition realtime_sample_recorder.hpp:14
@ Completed
Definition realtime_sample_recorder.hpp:19
@ Completing
Definition realtime_sample_recorder.hpp:18
@ Cancelled
Definition realtime_sample_recorder.hpp:20
@ Recording
Definition realtime_sample_recorder.hpp:17
@ Armed
Definition realtime_sample_recorder.hpp:16
@ Idle
Definition realtime_sample_recorder.hpp:15
RealtimeSampleRecorderCommandType
Definition realtime_sample_recorder.hpp:24
@ Stop
Definition realtime_sample_recorder.hpp:27
@ Reset
Definition realtime_sample_recorder.hpp:29
@ Arm
Definition realtime_sample_recorder.hpp:25
@ Start
Definition realtime_sample_recorder.hpp:26
@ Cancel
Definition realtime_sample_recorder.hpp:28
@ Idle
Definition instrument_envelope.hpp:9
RealtimeSampleRecorderTimingType
Definition realtime_sample_recorder.hpp:32
@ Immediate
Definition realtime_sample_recorder.hpp:33
@ BlockOffset
Definition realtime_sample_recorder.hpp:34
@ Failed
Definition finite_time_stretch.hpp:23
Definition generated_event_source.hpp:33
SequencerStateChannel is the audio-safe transport for a plugin's structured NON-parameter state: the ...
Definition audio_device_manager.hpp:48
Definition realtime_sample_recorder.hpp:51
RealtimeSampleRecorderCommandType type
Definition realtime_sample_recorder.hpp:53
std::uint64_t max_frames
Definition realtime_sample_recorder.hpp:55
RealtimeSampleRecorderTiming timing
Definition realtime_sample_recorder.hpp:54
bool cancel_on_transport_jump
Definition realtime_sample_recorder.hpp:56
std::uint64_t sequence_id
Definition realtime_sample_recorder.hpp:52
Definition realtime_sample_recorder.hpp:67
std::uint64_t max_frames
Definition realtime_sample_recorder.hpp:69
double sample_rate
Definition realtime_sample_recorder.hpp:70
std::uint32_t num_channels
Definition realtime_sample_recorder.hpp:68
Definition realtime_sample_recorder.hpp:59
std::uint64_t sequence_id
Definition realtime_sample_recorder.hpp:60
std::uint32_t block_offset
Definition realtime_sample_recorder.hpp:64
RealtimeSampleRecorderState state
Definition realtime_sample_recorder.hpp:62
std::uint64_t frames_recorded
Definition realtime_sample_recorder.hpp:63
RealtimeSampleRecorderEventType type
Definition realtime_sample_recorder.hpp:61
Definition realtime_sample_recorder.hpp:73
std::uint64_t dropped_events
Definition realtime_sample_recorder.hpp:77
std::uint64_t frames_recorded
Definition realtime_sample_recorder.hpp:74
std::uint64_t total_recorded_frames
Definition realtime_sample_recorder.hpp:75
std::uint64_t dropped_commands
Definition realtime_sample_recorder.hpp:76
Definition realtime_sample_recorder.hpp:46
RealtimeSampleRecorderTimingType type
Definition realtime_sample_recorder.hpp:47
std::uint32_t frame_offset
Definition realtime_sample_recorder.hpp:48
Definition rolling_audio_capture_buffer.hpp:27