22using timeline::LaunchQuantize;
35 const std::int64_t grid = quantize.grid.value;
38 const std::int64_t phase = quantize.phase.value;
39 const std::int64_t rel = (from.position - quantize.phase).value;
41 std::int64_t k = rel / grid;
42 if (rel % grid != 0 && rel > 0)
62inline std::optional<std::uint32_t>
65 const std::int64_t target_pos = target.position.value;
66 for (std::uint8_t index = 0; index < snapshot.range_count; ++index) {
67 const auto& range = snapshot.ranges[index];
68 const std::int64_t start = range.monotonic_start.position.value;
69 const std::int64_t end = range.monotonic_end.position.value;
70 if (target_pos < start)
71 return range.sample_offset;
72 if (target_pos < end) {
76 const std::int64_t offset_in_range =
77 target_sample.
value - range.timeline_sample_start.value;
78 const std::int64_t block_offset =
79 static_cast<std::int64_t
>(range.sample_offset) + offset_in_range;
84 if (block_offset >=
static_cast<std::int64_t
>(snapshot.frame_count))
86 return static_cast<std::uint32_t
>(block_offset);
131 quantize_ = quantize;
140 quantize_ = quantize;
150 has_last_start_ =
false;
158 if (snapshot.range_count == 0)
174 last_start_ = target_;
175 has_last_start_ =
true;
184 return has_last_start_;
193 timebase::MonotonicBeat last_start_{};
195 bool has_target_ =
false;
196 bool has_last_start_ =
false;
224 if (!set.enabled()) {
229 remaining_ = set.repetitions;
230 target_ = advance(launch_beat);
239 constexpr bool armed() const noexcept {
255 if (!armed_ || snapshot.range_count == 0)
263 if (remaining_ == 0) {
266 return {
true, *offset};
268 target_ = advance(target_);
279 timebase::TickDuration grid_{0};
280 timebase::MonotonicBeat target_{};
281 std::uint32_t remaining_ = 0;
282 std::uint64_t fire_count_ = 0;
Definition clip_launch.hpp:215
static constexpr audio::RtSafetyClass process_rt_safety_class
Definition clip_launch.hpp:217
FollowActionEvent process(const TransportSnapshot &snapshot, const timebase::CompiledTempoMap &tempo_map) noexcept
Definition clip_launch.hpp:253
constexpr std::uint64_t fire_count() const noexcept
Definition clip_launch.hpp:247
constexpr void disarm() noexcept
Definition clip_launch.hpp:234
constexpr bool armed() const noexcept
Definition clip_launch.hpp:239
constexpr timebase::MonotonicBeat target() const noexcept
Definition clip_launch.hpp:242
constexpr void arm(timebase::MonotonicBeat launch_beat, const timeline::FollowActionSet &set) noexcept
Definition clip_launch.hpp:222
Definition clip_launch.hpp:112
LaunchEvent process(const TransportSnapshot &snapshot, const timebase::CompiledTempoMap &tempo_map) noexcept
Definition clip_launch.hpp:154
constexpr timebase::MonotonicBeat last_start() const noexcept
Definition clip_launch.hpp:186
constexpr void arm(LaunchQuantize quantize) noexcept
Definition clip_launch.hpp:130
constexpr LaunchState state() const noexcept
Definition clip_launch.hpp:117
constexpr timebase::MonotonicBeat target() const noexcept
Definition clip_launch.hpp:123
static constexpr audio::RtSafetyClass process_rt_safety_class
Definition clip_launch.hpp:114
constexpr void stop(LaunchQuantize quantize) noexcept
Definition clip_launch.hpp:138
constexpr void reset() noexcept
Definition clip_launch.hpp:147
constexpr bool has_target() const noexcept
Definition clip_launch.hpp:120
constexpr bool has_last_start() const noexcept
Definition clip_launch.hpp:183
Definition compiled_tempo_map.hpp:91
RtSafetyClass
Definition rt_safety_contract.hpp:11
@ AudioCallbackSafeAfterPrepare
Definition rt_safety_contract.hpp:13
Definition audio_renderer.hpp:20
@ Stop
Definition capture_engine.hpp:69
@ Start
Definition capture_engine.hpp:68
@ Stopped
Definition capture_engine.hpp:84
constexpr timebase::MonotonicBeat next_launch_boundary(timebase::MonotonicBeat from, LaunchQuantize quantize) noexcept
Definition clip_launch.hpp:33
@ None
Definition automation_recording.hpp:29
LaunchEventKind
Definition clip_launch.hpp:99
@ Stop
Definition clip_launch.hpp:99
@ None
Definition clip_launch.hpp:99
@ Start
Definition clip_launch.hpp:99
LaunchState
Definition clip_launch.hpp:92
@ Stopping
Definition clip_launch.hpp:96
@ Stopped
Definition clip_launch.hpp:93
@ Playing
Definition clip_launch.hpp:95
@ Armed
Definition clip_launch.hpp:94
std::optional< std::uint32_t > resolve_launch_sample(const TransportSnapshot &snapshot, const timebase::CompiledTempoMap &tempo_map, timebase::MonotonicBeat target) noexcept
Definition clip_launch.hpp:63
constexpr std::int64_t saturating_multiply(std::int64_t lhs, std::int64_t rhs) noexcept
Definition tick.hpp:27
constexpr std::int64_t saturating_add(std::int64_t lhs, std::int64_t rhs) noexcept
Definition tick.hpp:11
Definition clip_launch.hpp:210
bool fired
Definition clip_launch.hpp:211
std::uint32_t sample_offset
Definition clip_launch.hpp:212
Definition clip_launch.hpp:103
LaunchEventKind kind
Definition clip_launch.hpp:104
std::uint32_t sample_offset
Definition clip_launch.hpp:105
Definition transport.hpp:71
Definition rational_time.hpp:9
std::int64_t value
Definition rational_time.hpp:10
Bounded weighted follow behavior attached to a slot.
Definition clip_launch.hpp:105
Musical-boundary quantization for one launch.
Definition clip_launch.hpp:40
Immutable authored scene, slot, quantization, and follow-action model.