Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
model.hpp
Go to the documentation of this file.
1#pragma once
2
19
20#include <compare>
21#include <cstddef>
22#include <cstdint>
23#include <iterator>
24#include <memory>
25#include <optional>
26#include <span>
27#include <string>
28#include <type_traits>
29#include <utility>
30#include <variant>
31#include <vector>
32
33namespace pulp::timeline {
34
38
39namespace detail {
40class ProjectStateAccess;
41class LauncherStore;
42struct SequenceEditAccess;
43} // namespace detail
45struct ClipIndexNode;
46
49 std::uint64_t live_nodes = 0;
50 std::uint64_t nodes_created = 0;
51};
52
55 std::uint64_t live_nodes = 0;
56 std::uint64_t nodes_created = 0;
57};
58
60struct TrackInput {
62 std::string name;
63 std::vector<Clip> clips;
64 std::vector<DevicePlacement> device_chain;
65 std::vector<AutomationLane> automation_lanes;
66 std::vector<Modulator> modulators;
67 std::vector<MacroControl> macros;
68 std::vector<ModulationRoute> modulation_routes;
69 std::vector<TakeLane> take_lanes;
70 bool record_armed = false;
71 // Zero selects the arrangement rather than a take playlist/comp lane.
73 std::optional<TrackFreeze> freeze;
75 // Absence means the track plays in whatever tuning the project states.
76 std::optional<TuningReference> tuning;
77};
78
83class Track {
84 public:
86 class ClipView {
87 public:
89 class Iterator {
90 public:
92 using difference_type = std::ptrdiff_t;
93 using iterator_category = std::forward_iterator_tag;
94
96 const Clip& operator*() const noexcept;
98 const Clip* operator->() const noexcept;
100 Iterator& operator++() noexcept;
102 bool operator==(const Iterator&) const noexcept = default;
103
104 private:
105 friend class ClipView;
106 Iterator(std::shared_ptr<const ClipIndexNode> root, std::size_t index) noexcept
107 : root_(std::move(root)), index_(index) {}
108 std::shared_ptr<const ClipIndexNode> root_;
109 std::size_t index_ = 0;
110 };
111
113 std::size_t size() const noexcept {
114 return size_;
115 }
116
117 bool empty() const noexcept {
118 return size_ == 0;
119 }
120
121 const Clip& operator[](std::size_t index) const noexcept;
123 Iterator begin() const noexcept {
124 return Iterator(root_, 0);
125 }
126
127 Iterator end() const noexcept {
128 return Iterator(root_, size_);
129 }
130
131 private:
132 friend class Track;
133 ClipView(std::shared_ptr<const ClipIndexNode> root, std::size_t size) noexcept
134 : root_(std::move(root)), size_(size) {}
135 std::shared_ptr<const ClipIndexNode> root_;
136 std::size_t size_ = 0;
137 };
138
141 std::vector<Clip> clips);
180 std::optional<ItemId> before_device_id = std::nullopt) const;
185 move_device(ItemId id, std::optional<ItemId> before_device_id) const;
198 std::vector<TakeCompSegment> comp) const;
202 Track with_record_armed(bool armed) const;
206 runtime::Result<Track, ModelError> with_freeze(std::optional<TrackFreeze> freeze) const;
215 runtime::Result<Track, ModelError> with_tuning(std::optional<TuningReference> tuning) const;
220 Track with_name(std::string name) const;
221
223 ItemId id() const noexcept;
225 const std::string& name() const noexcept;
227 ClipView clips() const noexcept;
231 const Clip* find_clip(ItemId id) const noexcept;
233 std::span<const DevicePlacement> device_chain() const noexcept;
237 std::span<const AutomationLane> automation_lanes() const noexcept;
239 const AutomationLane* find_automation_lane(ItemId id) const noexcept;
241 std::span<const Modulator> modulators() const noexcept;
243 const Modulator* find_modulator(ItemId id) const noexcept;
245 std::span<const MacroControl> macros() const noexcept;
247 const MacroControl* find_macro(ItemId id) const noexcept;
249 std::span<const ModulationRoute> modulation_routes() const noexcept;
256 std::vector<ModulationRoute> routes_from_source(ItemId source_id) const;
258 std::span<const TakeLane> take_lanes() const noexcept;
260 const TakeLane* find_take_lane(ItemId id) const noexcept;
262 bool record_armed() const noexcept;
264 ItemId active_take_lane_id() const noexcept;
266 const std::optional<TrackFreeze>& freeze() const noexcept;
268 const TrackMixer& mixer() const noexcept;
270 const std::optional<TuningReference>& tuning() const noexcept;
272 std::size_t shared_index_nodes_with(const Track& other) const;
276 bool shares_clip_membership_with(const Track& other) const noexcept;
278 bool shares_storage_with(const Track& other) const noexcept;
280 static TrackIndexStats index_stats() noexcept;
281
282 private:
283 friend class Sequence;
284 struct Data;
285 bool shares_compile_structure_with(const Track& other) const noexcept;
286 runtime::Result<Track, ModelError>
287 with_device_chain(std::vector<DevicePlacement> device_chain) const;
288 runtime::Result<Track, ModelError> with_modulators(std::vector<Modulator> modulators) const;
289 runtime::Result<Track, ModelError> with_macros(std::vector<MacroControl> macros) const;
290 runtime::Result<Track, ModelError>
291 with_modulation_routes(std::vector<ModulationRoute> routes) const;
292 explicit Track(std::shared_ptr<const Data> data) : data_(std::move(data)) {}
293 std::shared_ptr<const Data> data_;
294};
295
299enum class ChordQuality : std::uint8_t {
300 Major = 0,
301 Minor = 1,
310};
311
313enum class ScaleMode : std::uint8_t {
314 Major = 0,
324};
325
340
342inline constexpr std::uint16_t kChordExtensionMask =
346
359
366 std::uint8_t chord_root = 0;
368 std::uint8_t scale_root = 0;
369 // The pitch class that sounds lowest, when it is not the chord root. This
370 // is the general form of an inversion: naming the bass covers both a chord
371 // tone in the bass and a bass note outside the chord, and a separate
372 // inversion number beside it could only ever contradict it.
373 std::optional<std::uint8_t> chord_bass;
374 // Bitmask over ChordExtension. Zero states the plain quality.
375 std::uint16_t chord_extensions = 0;
376 std::optional<ChordVoicing> voicing;
377
378 constexpr auto operator<=>(const ChordScaleEvent&) const = default;
379};
380
386class ChordScaleLane {
387 public:
389 static runtime::Result<ChordScaleLane, ModelError> create(std::vector<ChordScaleEvent> events);
390
392 std::span<const ChordScaleEvent> events() const noexcept {
393 return *events_;
394 }
395
396 bool empty() const noexcept {
397 return events_->empty();
398 }
399
402 const ChordScaleEvent* at(timebase::TickPosition position) const noexcept;
404 bool shares_storage_with(const ChordScaleLane& other) const noexcept {
405 return events_.get() == other.events_.get();
406 }
407
408 bool operator==(const ChordScaleLane& other) const noexcept;
409
410 private:
411 explicit ChordScaleLane(std::shared_ptr<const std::vector<ChordScaleEvent>> events) noexcept
412 : events_(std::move(events)) {}
413
414 std::shared_ptr<const std::vector<ChordScaleEvent>> events_;
415};
416
439
452class DynamicsLane {
453 public:
455 static runtime::Result<DynamicsLane, ModelError> create(std::vector<DynamicsEvent> events);
456
458 std::span<const DynamicsEvent> events() const noexcept {
459 return *events_;
460 }
461
462 bool empty() const noexcept {
463 return events_->empty();
464 }
465
469 const DynamicsEvent* at(timebase::TickPosition position) const noexcept;
476 std::optional<float> value_at(timebase::TickPosition position) const noexcept;
478 bool shares_storage_with(const DynamicsLane& other) const noexcept {
479 return events_.get() == other.events_.get();
480 }
481
482 bool operator==(const DynamicsLane& other) const noexcept;
483
484 private:
485 explicit DynamicsLane(std::shared_ptr<const std::vector<DynamicsEvent>> events) noexcept
486 : events_(std::move(events)) {}
487
488 std::shared_ptr<const std::vector<DynamicsEvent>> events_;
489};
490
497 std::string name;
499 std::optional<std::uint32_t> color;
500};
501
520
541
543inline constexpr std::int32_t kGrooveUnitScale = 1000;
545inline constexpr std::int32_t kMaxGrooveVelocityScale = 4000;
547inline constexpr std::size_t kMaxGrooveSteps = 1024;
548
553
554 constexpr auto operator<=>(const GrooveStep&) const = default;
555};
556
559 std::string name;
560 // Zero means the groove states no swing. A swing grid is a subdivision:
561 // the pair it warps spans twice this.
564 // The width of one entry in `steps`. Zero exactly when there is no table.
566 std::vector<GrooveStep> steps;
569};
570
571// A named feel a sequence plays with: a swing setting and a repeating table of
572// per-step timing and accent, each scaled by its own strength.
573//
574// Groove carries velocity as well as timing deliberately. A feel is as much
575// accent as it is placement — the same timing with flat velocities does not
576// sound like the groove it was sampled from. Timing and accent share one
577// canonical owned array. The two are separately
578// attenuated so a project can borrow a groove's placement without its accents,
579// which is the common editing request.
580//
581// Swing and the table are two independent displacements of the same authored
582// position: the table is indexed by where a note was written, not by where
583// swing moved it, so changing the swing setting never re-assigns notes to
584// different steps.
585//
586// The swing half is order-preserving (see timebase::swing_position). The table
587// half is not: adjacent steps may lean in opposite directions, and material at
588// the end of one step can be pushed past material at the start of the next.
589// That is what a groove template is, so offsets are bounded to less than a
590// step rather than constrained into monotonicity.
591//
592// The template is sequence-owned context, not clip content: it is read by other
593// items' compile hooks. Reading it across entities is what the compile-context
594// subscription contract governs (see compile_context.hpp).
596class GrooveTemplate {
597 public:
600
602 const std::string& name() const noexcept {
603 return data_->name;
604 }
605
607 return data_->swing_grid;
608 }
609
610 timebase::SwingRatio swing() const noexcept {
611 return data_->swing;
612 }
613
614 timebase::TickDuration step() const noexcept {
615 return data_->step;
616 }
617
618 std::span<const GrooveStep> steps() const noexcept {
619 return data_->steps;
620 }
621
622 std::int32_t timing_strength() const noexcept {
623 return data_->timing_strength;
624 }
625
626 std::int32_t velocity_strength() const noexcept {
627 return data_->velocity_strength;
628 }
629
630 bool states_no_feel() const noexcept;
632 bool is_canonical_default() const noexcept;
633
635 timebase::TickPosition apply_timing(timebase::TickPosition position) const noexcept;
637 std::int32_t velocity_scale_at(timebase::TickPosition position) const noexcept;
638
640 bool shares_storage_with(const GrooveTemplate& other) const noexcept {
641 return data_.get() == other.data_.get();
642 }
643
644 bool operator==(const GrooveTemplate& other) const noexcept;
645
646 private:
647 // The table entry `position` falls in, or null when the groove has no table.
648 const GrooveStep* step_at(timebase::TickPosition position) const noexcept;
649
650 struct Data {
651 std::string name;
655 std::vector<GrooveStep> steps;
656 std::int32_t timing_strength;
657 std::int32_t velocity_strength;
658
659 bool operator==(const Data&) const = default;
660 };
661 explicit GrooveTemplate(std::shared_ptr<const Data> data) noexcept : data_(std::move(data)) {}
662
663 std::shared_ptr<const Data> data_;
664};
665
671 std::string name;
672 std::optional<timebase::TickDuration> musical_duration;
673 std::optional<AbsoluteTimelineDuration> absolute_duration;
674 std::vector<Track> tracks;
675 std::vector<SequenceMarker> markers;
676 std::vector<SequenceRegion> regions;
677 std::optional<ChordScaleLane> chord_scale_lane;
680 std::optional<DynamicsLane> dynamics_lane;
681 std::optional<GrooveTemplate> groove;
682 // Authored launch order. A scene owns its slots; every non-empty slot
683 // references a clip in this sequence.
684 std::vector<Scene> scenes;
685 // Authored top-to-bottom track order, naming every track in `tracks`
686 // exactly once. An empty vector records no authored order, and the
687 // sequence adopts the identity order of `tracks` instead.
688 std::vector<ItemId> track_order;
689};
690
692class Sequence {
693 public:
695 class SceneView {
696 public:
698 class Iterator {
699 public:
701 using difference_type = std::ptrdiff_t;
702 using pointer = const Scene*;
703 using reference = const Scene&;
704 using iterator_category = std::forward_iterator_tag;
705
707 const Scene& operator*() const noexcept;
709 const Scene* operator->() const noexcept;
711 Iterator& operator++() noexcept;
713 Iterator operator++(int) noexcept {
714 auto copy = *this;
715 ++*this;
716 return copy;
717 }
718
719 bool operator==(const Iterator&) const noexcept = default;
720
721 private:
722 friend class SceneView;
723 Iterator(std::shared_ptr<const detail::LauncherStore> store, ItemId current) noexcept
724 : store_(std::move(store)), current_(current) {}
725 std::shared_ptr<const detail::LauncherStore> store_;
726 ItemId current_;
727 };
728
730 std::size_t size() const noexcept;
732 bool empty() const noexcept {
733 return size() == 0;
734 }
735
736 const Scene& operator[](std::size_t index) const noexcept;
738 Iterator begin() const noexcept;
740 Iterator end() const noexcept;
741
742 private:
743 friend class Sequence;
744 explicit SceneView(std::shared_ptr<const detail::LauncherStore> store) noexcept
745 : store_(std::move(store)) {}
746 std::shared_ptr<const detail::LauncherStore> store_;
747 };
748
751 create(ItemId id, std::string name, std::optional<timebase::TickDuration> duration,
752 std::vector<Track> tracks);
755 create(ItemId id, std::string name, std::optional<timebase::TickDuration> musical_duration,
756 std::optional<AbsoluteTimelineDuration> absolute_duration, std::vector<Track> tracks);
759 create(ItemId id, std::string name, std::optional<timebase::TickDuration> musical_duration,
760 std::optional<AbsoluteTimelineDuration> absolute_duration, std::vector<Track> tracks,
761 std::vector<SequenceMarker> markers, std::vector<SequenceRegion> regions);
766 create(ItemId id, std::string name, std::optional<timebase::TickDuration> musical_duration,
767 std::optional<AbsoluteTimelineDuration> absolute_duration, std::vector<Track> tracks,
768 std::vector<SequenceMarker> markers, std::vector<SequenceRegion> regions,
770
772 ItemId id() const noexcept;
774 const std::string& name() const noexcept;
776 std::optional<timebase::TickDuration> duration() const noexcept;
778 std::optional<AbsoluteTimelineDuration> absolute_duration() const noexcept;
780 std::span<const Track> tracks() const noexcept;
788 std::span<const ItemId> track_order() const noexcept;
792 std::span<const ItemId> outgoing_sequence_refs() const noexcept;
794 const Track* find_track(ItemId id) const noexcept;
796 const ChordScaleLane& chord_scale_lane() const noexcept;
802 const DynamicsLane& dynamics_lane() const noexcept;
804 const GrooveTemplate& groove() const noexcept;
806 std::span<const SequenceMarker> markers() const noexcept;
808 std::span<const SequenceRegion> regions() const noexcept;
810 SceneView scenes() const noexcept;
812 const SequenceMarker* find_marker(ItemId id) const noexcept;
814 const SequenceRegion* find_region(ItemId id) const noexcept;
816 const Scene* find_scene(ItemId id) const noexcept;
818 const Slot* find_slot(ItemId id) const noexcept;
820 runtime::Result<Sequence, ModelError> replace_track(Track track) const;
826 runtime::Result<Sequence, ModelError>
827 insert_track(Track track, std::optional<ItemId> before_track_id = std::nullopt) const;
838 runtime::Result<Sequence, ModelError>
839 move_track(ItemId track_id, std::optional<ItemId> before_track_id = std::nullopt) const;
841 runtime::Result<Sequence, ModelError> erase_track(ItemId id) const;
843 runtime::Result<Sequence, ModelError> insert_marker(SequenceMarker marker) const;
845 runtime::Result<Sequence, ModelError> erase_marker(ItemId id) const;
847 runtime::Result<Sequence, ModelError> insert_region(SequenceRegion region) const;
849 runtime::Result<Sequence, ModelError> erase_region(ItemId id) const;
855 runtime::Result<Sequence, ModelError> replace_region(SequenceRegion replacement) const;
857 runtime::Result<Sequence, ModelError>
858 insert_scene(Scene scene, std::optional<ItemId> before_scene_id = std::nullopt) const;
860 runtime::Result<Sequence, ModelError> erase_scene(ItemId id) const;
862 runtime::Result<Sequence, ModelError>
863 insert_slot(ItemId scene_id, Slot slot,
864 std::optional<ItemId> before_slot_id = std::nullopt) const;
866 runtime::Result<Sequence, ModelError> erase_slot(ItemId scene_id, ItemId slot_id) const;
870 Sequence with_dynamics_lane(DynamicsLane lane) const;
874 std::size_t shared_launcher_nodes_with(const Sequence& other) const;
876 bool shares_launcher_storage_with(const Sequence& other) const noexcept;
878 bool shares_storage_with(const Sequence& other) const noexcept;
881
882 private:
883 friend class Project;
885 struct Data;
886 bool shares_compile_structure_with(const Sequence& other) const noexcept;
887 // Annotation edits validate only the annotation lists and share the existing
888 // track storage and identity index; they never re-walk the arrangement.
889 runtime::Result<Sequence, ModelError>
890 with_annotations(std::vector<SequenceMarker> markers,
891 std::vector<SequenceRegion> regions) const;
892 explicit Sequence(std::shared_ptr<const Data> data) : data_(std::move(data)) {}
893 std::shared_ptr<const Data> data_;
894};
895
897inline constexpr std::size_t kMaxSequenceNestingDepth = 8;
898
899// Where this session's zero sits on the source/house clock — the document form
900// of "this session starts at 01:00:00:00". Stored as an absolute sample offset
901// paired with its own rational rate, never as a formatted timecode string:
902// frame-rate formatting is a presentation concern and a string would make the
903// same instant compare unequal across display rates.
905std::optional<ModelError>
906validate_sequence_graph(std::span<const Sequence> sequences);
908std::optional<ModelError>
909validate_sequence_edge(std::span<const Sequence> sequences,
910 ItemId parent_id, ItemId child_id);
911
919
921 constexpr bool operator==(const SessionStart& other) const noexcept {
922 return start == other.start && sample_rate == other.sample_rate;
923 }
924};
925
929 std::string name;
930 std::uint64_t next_item_id = 1;
932 std::vector<MediaAsset> assets;
933 std::vector<Sequence> sequences;
936 std::optional<SessionStart> session_start;
937 // Absence states no tuning at all, which is not the same claim as stating
938 // equal temperament: a document that never chose still follows whatever the
939 // host or instrument defaults to.
940 std::optional<TuningReference> tuning;
941};
942
966
972constexpr ItemId immediate_parent_id(ItemKind kind, ItemId project_id, ItemId sequence_id,
973 ItemId track_id, ItemId clip_id,
974 ItemId lane_id = {}) noexcept {
975 switch (kind) {
977 return {};
978 case ItemKind::Asset:
980 return project_id;
981 case ItemKind::Track:
982 case ItemKind::Marker:
983 case ItemKind::Region:
984 case ItemKind::Scene:
985 return sequence_id;
986 case ItemKind::Slot:
987 return lane_id;
988 case ItemKind::Clip:
993 // A route is owned by the track, not by the source it reads. Parenting it
994 // to its source would make the source's removal an ownership question the
995 // document answers twice, and would leave a route whose source is a macro
996 // and a route whose source is a modulator with different owners.
999 return track_id;
1000 case ItemKind::Note:
1001 case ItemKind::MidiLane:
1002 return clip_id;
1004 case ItemKind::Take:
1006 return lane_id;
1007 }
1008 return {};
1009}
1010
1014 // Immediate ownership is canonical; the remaining IDs cache ancestor navigation.
1019 bool active = false;
1020
1021 constexpr ItemLocation() noexcept = default;
1023 constexpr ItemLocation(ItemKind item_kind, ItemId parent, ItemId sequence, ItemId track,
1024 ItemId clip, bool is_active) noexcept
1025 : kind(item_kind), parent_id(parent), sequence_id(sequence), track_id(track), clip_id(clip),
1026 active(is_active) {}
1027
1029 constexpr bool has_same_owner(const ItemLocation& other) const noexcept {
1030 return kind == other.kind && parent_id == other.parent_id;
1031 }
1032 constexpr auto operator<=>(const ItemLocation&) const = default;
1033};
1034
1036enum class IdentityMutationKind : std::uint8_t { Insert, Deactivate, Reactivate };
1037
1044
1047 std::uint64_t live_nodes = 0;
1048 std::uint64_t nodes_created = 0;
1049};
1050
1054 public:
1055 SequenceCompileStructureToken() noexcept = default;
1056
1066 bool valid() const noexcept {
1067 return value_ != 0;
1068 }
1069
1070 constexpr bool operator==(const SequenceCompileStructureToken&) const noexcept = default;
1071
1072 private:
1073 friend class Project;
1074 explicit SequenceCompileStructureToken(std::uint64_t value) noexcept : value_(value) {}
1075 std::uint64_t value_ = 0;
1076};
1077
1079class Project {
1080 public:
1083
1085 ItemId id() const noexcept;
1087 const std::string& name() const noexcept;
1089 std::uint64_t next_item_id() const noexcept;
1091 ItemId root_sequence_id() const noexcept;
1093 std::span<const MediaAsset> assets() const noexcept;
1095 std::span<const Sequence> sequences() const noexcept;
1097 const timebase::TempoMap& tempo_map() const noexcept;
1099 const timebase::MeterMap& meter_map() const noexcept;
1101 const std::optional<SessionStart>& session_start() const noexcept;
1103 const std::optional<TuningReference>& tuning() const noexcept;
1105 const MediaAsset* find_asset(ItemId id) const noexcept;
1107 const Sequence* find_sequence(ItemId id) const noexcept;
1109 std::optional<ItemLocation> locate(ItemId id) const noexcept;
1111 std::size_t shared_identity_nodes_with(const Project& other) const;
1113 bool shares_storage_with(const Project& other) const noexcept;
1123 return ItemIdAllocator(next_item_id());
1124 }
1125
1126 private:
1127 friend struct ProjectEditAccess;
1129 struct Data;
1131 replace_sequence(Sequence sequence, std::span<const IdentityMutation> identities = {},
1132 std::optional<std::uint64_t> next_item_id = std::nullopt) const;
1134 append_sequence(Sequence sequence, std::span<const IdentityMutation> identities = {},
1135 std::optional<std::uint64_t> next_item_id = std::nullopt) const;
1137 remove_sequence(ItemId sequence_id, std::span<const IdentityMutation> identities = {}) const;
1138 // Appends a sealed media asset as a pinned project input. The asset carries
1139 // its own ContentHash identity; identity mutations register (or reactivate)
1140 // the ItemKind::Asset entry the same way clip inserts do.
1141 runtime::Result<Project, ModelError>
1142 append_asset(MediaAsset asset, std::span<const IdentityMutation> identities = {},
1143 std::optional<std::uint64_t> next_item_id = std::nullopt) const;
1144 runtime::Result<Project, ModelError>
1145 remove_asset(ItemId asset_id, std::span<const IdentityMutation> identities = {}) const;
1146 Project replace_tempo_map(timebase::TempoMap tempo_map) const;
1147 Project replace_meter_map(timebase::MeterMap meter_map) const;
1148 // Unlike the tempo and meter maps this returns a Result: a tuning has a
1149 // validity rule (valid_tuning_reference) that Project::create already
1150 // applies, and a replacement path that skipped it could seat a tuning a
1151 // fresh construction would refuse.
1152 runtime::Result<Project, ModelError>
1153 replace_tuning(std::optional<TuningReference> tuning) const;
1154 explicit Project(std::shared_ptr<const Data> data) : data_(std::move(data)) {}
1155 std::shared_ptr<const Data> data_;
1156};
1157
1160 public:
1162 std::span<const std::pair<ItemId, ItemId>> entries() const noexcept {
1163 return entries_;
1164 }
1165
1166 std::optional<ItemId> find(ItemId old_id) const noexcept;
1167
1168 private:
1169 friend struct IdRemapBuilder;
1170 std::vector<std::pair<ItemId, ItemId>> entries_;
1171};
1172
1178 void* context = nullptr;
1179 runtime::Result<ItemId, ModelError> (*map)(void*, ItemId) noexcept = nullptr;
1180
1183};
1184
1190
1196
1201
1206
1209 ExternalIdFixup external = {});
1212 RemapIdFixups fixups);
1215 ExternalIdFixup external = {});
1218 RemapIdFixups fixups);
1221remap_ids(const Sequence& sequence, ItemIdAllocator& allocator, ExternalIdFixup external = {});
1227remap_ids(const Sequence& sequence, std::span<const std::pair<ItemId, ItemId>> carried_ids,
1228 RemapIdFixups fixups = {});
1229
1235
1241 std::uint64_t first_id);
1242
1244
1245} // namespace pulp::timeline
Result<T, E> — either holds a T or an E, never both.
Definition result.hpp:76
Definition compiled_meter_map.hpp:46
Definition compiled_tempo_map.hpp:44
Immutable ownership of one authored automation curve and its logical target.
Definition automation_lane.hpp:72
Immutable chord/scale context lane owned by a sequence.
Definition model.hpp:386
bool operator==(const ChordScaleLane &other) const noexcept
Compares authored event values.
bool empty() const noexcept
Returns whether no harmonic context is authored.
Definition model.hpp:396
static runtime::Result< ChordScaleLane, ModelError > create(std::vector< ChordScaleEvent > events)
Validates, orders, and stores harmonic events.
bool shares_storage_with(const ChordScaleLane &other) const noexcept
Returns whether both lanes share the same immutable event storage.
Definition model.hpp:404
std::span< const ChordScaleEvent > events() const noexcept
Returns events in strictly increasing position order.
Definition model.hpp:392
const ChordScaleEvent * at(timebase::TickPosition position) const noexcept
Returns the last event starting at or before position.
Immutable identity-bearing placement of one ClipContent value.
Definition clip.hpp:466
Immutable intensity context lane owned by a sequence.
Definition model.hpp:452
const DynamicsEvent * at(timebase::TickPosition position) const noexcept
Returns the last event starting at or before position.
static runtime::Result< DynamicsLane, ModelError > create(std::vector< DynamicsEvent > events)
Validates, orders, and stores intensity events.
bool shares_storage_with(const DynamicsLane &other) const noexcept
Returns whether both lanes share the same immutable event storage.
Definition model.hpp:478
std::span< const DynamicsEvent > events() const noexcept
Returns events in strictly increasing position order.
Definition model.hpp:458
bool operator==(const DynamicsLane &other) const noexcept
Compares authored event values.
bool empty() const noexcept
Returns whether no intensity context is authored.
Definition model.hpp:462
std::optional< float > value_at(timebase::TickPosition position) const noexcept
Returns the interpolated intensity at position.
Immutable sequence-owned swing, timing-offset, and accent context.
Definition model.hpp:596
std::int32_t velocity_scale_at(timebase::TickPosition position) const noexcept
Returns the accent multiplier at position, in per-mille.
timebase::TickDuration step() const noexcept
Returns the repeating table-step width in canonical ticks; zero means no table.
Definition model.hpp:614
const std::string & name() const noexcept
Returns the authored display name.
Definition model.hpp:602
std::int32_t velocity_strength() const noexcept
Returns velocity-accent strength in per-mille.
Definition model.hpp:626
timebase::TickPosition apply_timing(timebase::TickPosition position) const noexcept
Returns the deterministic sounding tick for authored position.
std::span< const GrooveStep > steps() const noexcept
Returns authored groove steps in repeating order.
Definition model.hpp:618
bool operator==(const GrooveTemplate &other) const noexcept
Compares complete authored groove values.
static runtime::Result< GrooveTemplate, ModelError > create(GrooveTemplateInput input)
Validates and stores one immutable groove template.
bool states_no_feel() const noexcept
Returns whether timing and velocity application are both identity operations.
timebase::TickDuration swing_grid() const noexcept
Returns the swung subdivision width in canonical ticks; zero disables swing.
Definition model.hpp:606
bool is_canonical_default() const noexcept
Returns whether this is the exact default value carried by a new sequence.
bool shares_storage_with(const GrooveTemplate &other) const noexcept
Returns whether both templates share the same immutable backing data.
Definition model.hpp:640
std::int32_t timing_strength() const noexcept
Returns timing-offset strength in per-mille.
Definition model.hpp:622
timebase::SwingRatio swing() const noexcept
Returns the rational swing ratio.
Definition model.hpp:610
Canonically ordered mapping from source identities to remapped identities.
Definition model.hpp:1159
std::span< const std::pair< ItemId, ItemId > > entries() const noexcept
Returns mappings ordered by source identity.
Definition model.hpp:1162
friend struct IdRemapBuilder
Definition model.hpp:1169
std::optional< ItemId > find(ItemId old_id) const noexcept
Returns the remapped identity for old_id, or std::nullopt.
Monotonic allocator for non-zero document ItemIds.
Definition clip.hpp:115
Immutable root of a Timeline document and its monotonic identity domain.
Definition model.hpp:1079
friend class detail::ProjectStateAccess
Definition model.hpp:1128
const MediaAsset * find_asset(ItemId id) const noexcept
Finds a media asset by identity, or returns nullptr.
const std::optional< TuningReference > & tuning() const noexcept
Returns the tuning every track plays in unless it states its own.
const timebase::TempoMap & tempo_map() const noexcept
Returns the project's immutable tempo map.
ItemId root_sequence_id() const noexcept
Returns the identity of the arrangement's root sequence.
ItemIdAllocator item_id_allocator() const noexcept
Returns an allocator initialized to this snapshot's identity frontier.
Definition model.hpp:1122
std::uint64_t next_item_id() const noexcept
Returns the next unallocated numeric ItemId.
bool shares_storage_with(const Project &other) const noexcept
Returns whether both values share complete immutable project storage.
std::span< const Sequence > sequences() const noexcept
Returns project-owned sequences in canonical identity order.
const Sequence * find_sequence(ItemId id) const noexcept
Finds a sequence by identity, or returns nullptr.
friend struct ProjectEditAccess
Definition model.hpp:1127
std::size_t shared_identity_nodes_with(const Project &other) const
Counts persistent identity-index nodes shared with other.
const std::string & name() const noexcept
Returns the authored project name.
ItemId id() const noexcept
Returns the stable project identity.
static runtime::Result< Project, ModelError > create(ProjectInput input)
Validates referential integrity, ownership, durations, and identity monotonicity.
const std::optional< SessionStart > & session_start() const noexcept
Returns the optional absolute source-clock origin.
std::optional< ItemLocation > locate(ItemId id) const noexcept
Returns canonical location data for active or inactive id, if known.
std::span< const MediaAsset > assets() const noexcept
Returns project-owned media assets in canonical identity order.
static ProjectIdentityStats identity_stats() noexcept
Returns process-wide persistent identity-index diagnostic counters.
SequenceCompileStructureToken sequence_compile_structure_token() const noexcept
Process-local identity of the sequence-reference and registered-content placement shape used by incre...
const timebase::MeterMap & meter_map() const noexcept
Returns the project's immutable meter map.
Opaque, process-local identity for the part of a Project snapshot that determines nested-sequence and...
Definition model.hpp:1053
friend class Project
Definition model.hpp:1073
constexpr bool operator==(const SequenceCompileStructureToken &) const noexcept=default
bool valid() const noexcept
Whether this token names a real structure snapshot.
Definition model.hpp:1066
Forward iterator that keeps the persistent launcher store alive.
Definition model.hpp:698
bool operator==(const Iterator &) const noexcept=default
Compares iterator position and retained launcher-store identity.
const Scene & operator*() const noexcept
Borrows the current scene; retained launcher storage keeps it alive.
std::ptrdiff_t difference_type
Definition model.hpp:701
const Scene & reference
Definition model.hpp:703
std::forward_iterator_tag iterator_category
Definition model.hpp:704
const Scene * pointer
Definition model.hpp:702
Scene value_type
Definition model.hpp:700
friend class SceneView
Definition model.hpp:722
Snapshot-owned random-access view preserving authored scene order.
Definition model.hpp:695
friend class Sequence
Definition model.hpp:743
Iterator end() const noexcept
Returns the sentinel iterator after the final scene.
const Scene & operator[](std::size_t index) const noexcept
Returns the scene at index; precondition: index < size().
std::size_t size() const noexcept
Returns the number of scenes.
bool empty() const noexcept
Returns whether the view contains no scenes.
Definition model.hpp:732
Iterator begin() const noexcept
Returns an iterator to the first scene.
Immutable identity-bearing arrangement with tracks, annotations, context, and launch scenes.
Definition model.hpp:692
runtime::Result< Sequence, ModelError > erase_region(ItemId id) const
Removes a region by identity and returns a new snapshot.
runtime::Result< Sequence, ModelError > insert_slot(ItemId scene_id, Slot slot, std::optional< ItemId > before_slot_id=std::nullopt) const
Inserts slot in scene_id, before an existing slot or at the end.
std::span< const ItemId > track_order() const noexcept
Returns track identities in authored top-to-bottom order.
friend struct detail::SequenceEditAccess
Definition model.hpp:884
static runtime::Result< Sequence, ModelError > create(ItemId id, std::string name, std::optional< timebase::TickDuration > musical_duration, std::optional< AbsoluteTimelineDuration > absolute_duration, std::vector< Track > tracks, std::vector< SequenceMarker > markers, std::vector< SequenceRegion > regions)
Creates a sequence with annotations and canonical default context.
runtime::Result< Sequence, ModelError > insert_marker(SequenceMarker marker) const
Inserts a validated marker and returns a new snapshot.
const SequenceRegion * find_region(ItemId id) const noexcept
Finds a region by identity, or returns nullptr.
runtime::Result< Sequence, ModelError > insert_track(Track track, std::optional< ItemId > before_track_id=std::nullopt) const
Inserts track before an existing track in authored order, or appends.
runtime::Result< Sequence, ModelError > erase_marker(ItemId id) const
Removes a marker by identity and returns a new snapshot.
std::span< const ItemId > outgoing_sequence_refs() const noexcept
Returns sorted unique referenced sequence identities derived from clips.
runtime::Result< Sequence, ModelError > replace_track(Track track) const
Returns a snapshot replacing an existing track by identity.
runtime::Result< Sequence, ModelError > insert_scene(Scene scene, std::optional< ItemId > before_scene_id=std::nullopt) const
Inserts scene before an existing scene, or appends when no position is supplied.
bool shares_launcher_storage_with(const Sequence &other) const noexcept
Returns whether both sequences share launcher collection storage.
static runtime::Result< Sequence, ModelError > create(ItemId id, std::string name, std::optional< timebase::TickDuration > duration, std::vector< Track > tracks)
Creates a musical sequence with tracks and no annotations or launch scenes.
runtime::Result< Sequence, ModelError > erase_track(ItemId id) const
Removes a track and its owned clips by identity.
const SequenceMarker * find_marker(ItemId id) const noexcept
Finds a marker by identity, or returns nullptr.
static LauncherIndexStats launcher_index_stats() noexcept
Returns process-wide persistent launcher-index diagnostic counters.
std::span< const SequenceMarker > markers() const noexcept
Returns markers ordered by position then identity.
const Scene * find_scene(ItemId id) const noexcept
Finds a scene by identity, or returns nullptr.
const Track * find_track(ItemId id) const noexcept
Finds a track by identity, or returns nullptr.
std::optional< timebase::TickDuration > duration() const noexcept
Returns the optional musical duration in canonical ticks.
friend class Project
Definition model.hpp:883
runtime::Result< Sequence, ModelError > erase_scene(ItemId id) const
Removes a scene and its owned slots by identity.
bool shares_storage_with(const Sequence &other) const noexcept
Returns whether both values share complete immutable sequence storage.
runtime::Result< Sequence, ModelError > insert_region(SequenceRegion region) const
Inserts a validated region and returns a new snapshot.
std::span< const SequenceRegion > regions() const noexcept
Returns regions ordered by position, duration, then identity.
Sequence with_chord_scale_lane(ChordScaleLane lane) const
Returns a snapshot with replacement harmonic context.
std::span< const Track > tracks() const noexcept
Returns tracks in canonical identity order.
std::optional< AbsoluteTimelineDuration > absolute_duration() const noexcept
Returns the optional absolute duration and its rational rate.
const Slot * find_slot(ItemId id) const noexcept
Finds a slot across all scenes by identity, or returns nullptr.
const GrooveTemplate & groove() const noexcept
Returns the always-present groove context.
SceneView scenes() const noexcept
Returns authored scenes and slots in persistent snapshot-owned storage.
static runtime::Result< Sequence, ModelError > create(ItemId id, std::string name, std::optional< timebase::TickDuration > musical_duration, std::optional< AbsoluteTimelineDuration > absolute_duration, std::vector< Track > tracks, std::vector< SequenceMarker > markers, std::vector< SequenceRegion > regions, ChordScaleLane chord_scale_lane)
Creates a sequence with an explicit chord/scale context lane.
ItemId id() const noexcept
Returns the stable sequence identity.
Sequence with_groove(GrooveTemplate groove) const
Returns a snapshot with replacement groove context.
runtime::Result< Sequence, ModelError > move_track(ItemId track_id, std::optional< ItemId > before_track_id=std::nullopt) const
Moves a track before an existing track in authored order, or to the end.
const ChordScaleLane & chord_scale_lane() const noexcept
Returns the always-present chord/scale context lane.
const std::string & name() const noexcept
Returns the authored sequence name.
runtime::Result< Sequence, ModelError > erase_slot(ItemId scene_id, ItemId slot_id) const
Removes slot_id from scene_id.
Sequence with_dynamics_lane(DynamicsLane lane) const
Returns a snapshot with replacement intensity context.
runtime::Result< Sequence, ModelError > replace_region(SequenceRegion replacement) const
Replaces a region in place, keeping its identity, and returns a new snapshot.
static runtime::Result< Sequence, ModelError > create(SequenceInput input)
Validates and creates a sequence from all authored collections.
std::size_t shared_launcher_nodes_with(const Sequence &other) const
Counts persistent launcher nodes shared with other.
const DynamicsLane & dynamics_lane() const noexcept
Returns the always-present intensity context lane.
static runtime::Result< Sequence, ModelError > create(ItemId id, std::string name, std::optional< timebase::TickDuration > musical_duration, std::optional< AbsoluteTimelineDuration > absolute_duration, std::vector< Track > tracks)
Creates a mixed-domain sequence with tracks and explicit optional durations.
Immutable alternate recording lane owned by a Track.
Definition recording.hpp:103
Immutable sample-anchored recording take referencing a project media asset.
Definition recording.hpp:29
Forward iterator that keeps the underlying persistent index alive.
Definition model.hpp:89
friend class ClipView
Definition model.hpp:105
Clip value_type
Definition model.hpp:91
const Clip & operator*() const noexcept
Borrows the current clip; retained index storage keeps it alive.
std::forward_iterator_tag iterator_category
Definition model.hpp:93
std::ptrdiff_t difference_type
Definition model.hpp:92
Snapshot-owned random-access view of clips in timeline order.
Definition model.hpp:86
bool empty() const noexcept
Returns whether the view contains no clips.
Definition model.hpp:117
Iterator end() const noexcept
Returns the sentinel iterator after the final clip.
Definition model.hpp:127
Iterator begin() const noexcept
Returns an iterator to the first clip.
Definition model.hpp:123
std::size_t size() const noexcept
Returns the number of clips in the view.
Definition model.hpp:113
const Clip & operator[](std::size_t index) const noexcept
Returns the clip at index; precondition: index < size().
friend class Track
Definition model.hpp:132
Immutable identity-bearing arrangement track.
Definition model.hpp:83
bool shares_storage_with(const Track &other) const noexcept
Returns whether both values reference the same complete track storage.
const std::optional< TrackFreeze > & freeze() const noexcept
Returns the published optional freeze artifact.
const MacroControl * find_macro(ItemId id) const noexcept
Finds a macro control by identity, or returns nullptr.
const std::string & name() const noexcept
Returns the authored track name.
std::span< const DevicePlacement > device_chain() const noexcept
Returns device placements in authored processing order.
runtime::Result< Track, ModelError > insert_take_lane(TakeLane lane) const
Returns a snapshot with a validated take lane inserted.
runtime::Result< Track, ModelError > erase_modulation_route(ItemId id) const
Returns a snapshot without the identified modulation route.
friend class Sequence
Definition model.hpp:283
runtime::Result< Track, ModelError > erase_macro(ItemId id) const
Removes a macro control; a route still reading it refuses.
runtime::Result< Track, ModelError > replace_modulator(Modulator replacement) const
Replaces one modulation source without changing its identity.
runtime::Result< Track, ModelError > with_mixer(TrackMixer mixer) const
Returns a snapshot with finite, in-range gain and pan.
runtime::Result< Track, ModelError > insert_modulation_route(ModulationRoute route) const
Returns a snapshot with a validated modulation route inserted.
runtime::Result< Track, ModelError > replace_clip(Clip replacement) const
Replaces one clip by identity with O(log n) path-copy updates.
std::span< const AutomationLane > automation_lanes() const noexcept
Returns automation lanes in canonical identity order.
const std::optional< TuningReference > & tuning() const noexcept
Returns the tuning this track overrides the project's with, if any.
const Modulator * find_modulator(ItemId id) const noexcept
Finds a modulator by identity, or returns nullptr.
runtime::Result< Track, ModelError > replace_macro(MacroControl replacement) const
Replaces one macro control without changing its identity.
runtime::Result< Track, ModelError > with_take_comp(ItemId lane_id, std::vector< TakeCompSegment > comp) const
Replaces one lane's comp with validated, canonical segments.
runtime::Result< Track, ModelError > erase_modulator(ItemId id) const
Removes a modulation source; a route still reading it refuses.
std::span< const TakeLane > take_lanes() const noexcept
Returns take lanes in canonical identity order.
bool shares_clip_membership_with(const Track &other) const noexcept
Returns whether both snapshots contain the same clip identities.
runtime::Result< Track, ModelError > erase_take(ItemId lane_id, ItemId take_id) const
Removes a take unless the lane comp still references it.
runtime::Result< Track, ModelError > replace_modulation_route(ModulationRoute replacement) const
Replaces one modulation route without changing its identity.
std::size_t shared_index_nodes_with(const Track &other) const
Counts persistent clip-index nodes shared with other.
static runtime::Result< Track, ModelError > create(ItemId id, std::string name, std::vector< Clip > clips)
Creates a track containing only its identity, name, and clips.
runtime::Result< Track, ModelError > with_tuning(std::optional< TuningReference > tuning) const
Returns a snapshot carrying a replacement tuning override.
ItemId id() const noexcept
Returns the stable track identity.
runtime::Result< Track, ModelError > erase_device(ItemId id) const
Removes a device declaration; attached automation/modulation refuses.
runtime::Result< Track, ModelError > insert_device(DevicePlacement placement, std::optional< ItemId > before_device_id=std::nullopt) const
Inserts a typed device declaration at an authored position; empty appends.
std::span< const MacroControl > macros() const noexcept
Returns macro controls in canonical identity order.
runtime::Result< Track, ModelError > erase_take_lane(ItemId id) const
Removes a take lane unless it is currently selected.
std::span< const ModulationRoute > modulation_routes() const noexcept
Returns modulation routes in canonical identity order.
runtime::Result< Track, ModelError > erase_clip(ItemId id) const
Returns a snapshot without the identified clip, or MissingItem.
runtime::Result< Track, ModelError > insert_modulator(Modulator modulator) const
Returns a snapshot with a validated modulation source inserted.
runtime::Result< Track, ModelError > replace_device(DevicePlacement replacement) const
Replaces one declaration without changing its placement identity.
ItemId active_take_lane_id() const noexcept
Returns zero for arrangement playback or the selected take-lane identity.
runtime::Result< Track, ModelError > move_device(ItemId id, std::optional< ItemId > before_device_id) const
Moves a device in authored order; empty selects the final position.
const TrackMixer & mixer() const noexcept
Returns the authored track mixer.
const TakeLane * find_take_lane(ItemId id) const noexcept
Finds a take lane by identity, or returns nullptr.
runtime::Result< Track, ModelError > with_freeze(std::optional< TrackFreeze > freeze) const
Publishes or clears a validated freeze artifact.
const DevicePlacement * find_device_placement(ItemId id) const noexcept
Finds a device placement by identity, or returns nullptr.
const AutomationLane * find_automation_lane(ItemId id) const noexcept
Finds an automation lane by identity, or returns nullptr.
static TrackIndexStats index_stats() noexcept
Returns process-wide persistent clip-index diagnostic counters.
Track with_name(std::string name) const
Returns a snapshot carrying a replacement authored name.
bool record_armed() const noexcept
Returns document intent for capture into a take lane.
std::vector< ModulationRoute > routes_from_source(ItemId source_id) const
Returns the routes drawing from source_id, in canonical identity order.
static runtime::Result< Track, ModelError > create(TrackInput input)
Validates and creates a track from all authored collections.
runtime::Result< Track, ModelError > insert_take(ItemId lane_id, Take take) const
Inserts a take into lane_id and returns the new track snapshot.
runtime::Result< Track, ModelError > insert_clip(Clip clip) const
Returns a snapshot with a validated, non-overlapping clip inserted.
runtime::Result< Track, ModelError > insert_macro(MacroControl macro) const
Returns a snapshot with a validated macro control inserted.
runtime::Result< Track, ModelError > erase_automation_lane(ItemId id) const
Returns a snapshot without the identified automation lane.
runtime::Result< Track, ModelError > with_active_take_lane(ItemId lane_id) const
Selects arrangement when zero, or an existing take lane otherwise.
ClipView clips() const noexcept
Returns clips ordered by anchor, start, then identity.
const ModulationRoute * find_modulation_route(ItemId id) const noexcept
Finds a modulation route by identity, or returns nullptr.
std::span< const Modulator > modulators() const noexcept
Returns modulators in canonical identity order.
runtime::Result< Track, ModelError > insert_automation_lane(AutomationLane lane) const
Returns a snapshot with a validated automation lane inserted.
Track with_record_armed(bool armed) const
Returns a snapshot with record-arm intent set to armed.
const Clip * find_clip(ItemId id) const noexcept
Finds a clip by identity, or returns nullptr.
@ Asset
Project-owned media assets.
Definition document_session.hpp:76
@ Note
Note content within a clip.
Definition document_session.hpp:46
constexpr std::int32_t kGrooveUnitScale
Per-mille identity scale for deterministic groove strengths and velocity.
Definition model.hpp:543
ScaleMode
Scale mode associated with a harmonic context event.
Definition model.hpp:313
constexpr std::size_t kMaxSequenceNestingDepth
Maximum admitted depth of an acyclic SequenceRef graph.
Definition model.hpp:897
ChordQuality
Harmonic quality of a chord statement.
Definition model.hpp:299
constexpr std::uint16_t kChordExtensionMask
Every extension bit the vocabulary defines; anything outside is rejected.
Definition model.hpp:342
constexpr std::int32_t kMaxGrooveVelocityScale
Largest admitted per-step groove velocity multiplier, in per-mille.
Definition model.hpp:545
ChordExtension
Added scale degree a chord statement carries above its quality.
Definition model.hpp:331
runtime::Result< RemappedClip, ModelError > remap_ids(const Clip &clip, ItemIdAllocator &allocator, ExternalIdFixup external={})
Remaps a clip's owned identities, optionally translating asset references.
SectionRole
Structural part a region names, independent of what the region is called.
Definition model.hpp:507
AutomationInterpolation
Interpolation applied from an automation point to its successor.
Definition automation_curve.hpp:20
ItemKind
Kind of an identity-bearing item in a Project.
Definition model.hpp:944
IdentityMutationKind
Allowed transition applied to one identity-index entry.
Definition model.hpp:1036
ChordVoicing
Non-binding hint for how a generator should spread a chord's tones.
Definition model.hpp:351
constexpr std::size_t kMaxGrooveSteps
Largest admitted number of entries in a repeating groove table.
Definition model.hpp:547
std::optional< ModelError > validate_sequence_edge(std::span< const Sequence > sequences, ItemId parent_id, ItemId child_id)
Validates one prospective parent-to-child edge against a sequence pool.
constexpr ItemId immediate_parent_id(ItemKind kind, ItemId project_id, ItemId sequence_id, ItemId track_id, ItemId clip_id, ItemId lane_id={}) noexcept
Derives the canonical immediate owner from an item's kind and coordinates.
Definition model.hpp:972
std::optional< ModelError > validate_sequence_graph(std::span< const Sequence > sequences)
Validates all SequenceRef targets, cycles, and maximum graph depth.
@ NaturalMinor
Definition model.hpp:315
@ Major
Definition model.hpp:314
@ Chromatic
Definition model.hpp:323
@ Phrygian
Definition model.hpp:319
@ Locrian
Definition model.hpp:322
@ Lydian
Definition model.hpp:320
@ Dorian
Definition model.hpp:318
@ Mixolydian
Definition model.hpp:321
@ HarmonicMinor
Definition model.hpp:316
@ MelodicMinor
Definition model.hpp:317
@ HalfDiminished7
Definition model.hpp:307
@ Suspended4
Definition model.hpp:309
@ Major
Definition model.hpp:300
@ Major7
Definition model.hpp:305
@ Suspended2
Definition model.hpp:308
@ Diminished
Definition model.hpp:302
@ Minor
Definition model.hpp:301
@ Dominant7
Definition model.hpp:304
@ Augmented
Definition model.hpp:303
@ Minor7
Definition model.hpp:306
@ kChordExtensionEleventh
Definition model.hpp:335
@ kChordExtensionFlatNinth
Definition model.hpp:333
@ kChordExtensionSharpNinth
Definition model.hpp:334
@ kChordExtensionSharpEleventh
Definition model.hpp:336
@ kChordExtensionFlatThirteenth
Definition model.hpp:338
@ kChordExtensionNinth
Definition model.hpp:332
@ kChordExtensionThirteenth
Definition model.hpp:337
@ Breakdown
Definition model.hpp:514
@ Intro
Definition model.hpp:509
@ Outro
Definition model.hpp:518
@ Solo
Definition model.hpp:516
@ Interlude
Definition model.hpp:517
@ Drop
Definition model.hpp:515
@ Unspecified
Definition model.hpp:508
@ PreChorus
Definition model.hpp:511
@ Verse
Definition model.hpp:510
@ Chorus
Definition model.hpp:512
@ Bridge
Definition model.hpp:513
@ Continuous
Definition automation_curve.hpp:22
@ DevicePlacement
Definition model.hpp:953
@ ModulationRoute
Definition model.hpp:958
@ Marker
Definition model.hpp:961
@ Asset
Definition model.hpp:946
@ Modulator
Definition model.hpp:956
@ Note
Definition model.hpp:950
@ Sequence
Definition model.hpp:947
@ MidiLanePoint
Definition model.hpp:952
@ Clip
Definition model.hpp:949
@ Slot
Definition model.hpp:964
@ Track
Definition model.hpp:948
@ AutomationLane
Definition model.hpp:954
@ Project
Definition model.hpp:945
@ Scene
Definition model.hpp:963
@ AutomationPoint
Definition model.hpp:955
@ Take
Definition model.hpp:960
@ MidiLane
Definition model.hpp:951
@ TakeLane
Definition model.hpp:959
@ MacroControl
Definition model.hpp:957
@ Region
Definition model.hpp:962
@ Deactivate
Definition model.hpp:1036
@ Reactivate
Definition model.hpp:1036
@ Insert
Definition model.hpp:1036
@ Drop3
Definition model.hpp:355
@ Rootless
Definition model.hpp:356
@ Open
Definition model.hpp:353
@ Drop2
Definition model.hpp:354
@ Close
Definition model.hpp:352
@ Shell
Definition model.hpp:357
Definition generated_event_source.hpp:33
Definition renderer3d.hpp:9
Definition host_transport_projector.hpp:8
Definition beat_division.hpp:11
constexpr SwingRatio kStraightSwing
Definition quantize.hpp:61
Definition clip_launch.hpp:30
Definition program_compiler.hpp:18
@ move
Definition web_event_translate.hpp:110
STL namespace.
Result<T, E> — success / failure union for fallible operations.
Definition rational_time.hpp:14
Definition rational_time.hpp:9
Definition quantize.hpp:53
Definition tick.hpp:56
Definition tick.hpp:61
Sequence duration in absolute samples at an explicit rational rate.
Definition clip.hpp:195
One identity-bearing automation value at a canonical musical tick.
Definition automation_curve.hpp:29
Harmonic statement in force from position until the next event.
Definition model.hpp:363
ChordQuality chord_quality
Definition model.hpp:365
std::uint8_t chord_root
Definition model.hpp:366
std::optional< ChordVoicing > voicing
Definition model.hpp:376
constexpr auto operator<=>(const ChordScaleEvent &) const =default
timebase::TickPosition position
Definition model.hpp:364
std::uint8_t scale_root
Definition model.hpp:368
ScaleMode scale_mode
Definition model.hpp:367
std::optional< std::uint8_t > chord_bass
Definition model.hpp:373
std::uint16_t chord_extensions
Definition model.hpp:375
Durable declaration for one logical placement in a Track device chain.
Definition device_placement.hpp:117
Intensity statement in force from position until the next event.
Definition model.hpp:427
timebase::TickPosition position
Canonical tick at which this intensity statement takes effect.
Definition model.hpp:429
AutomationInterpolation interpolation
How the segment leaving this event reaches the next one.
Definition model.hpp:435
float intensity
Normalized intensity in [0, 1].
Definition model.hpp:432
constexpr bool operator==(const DynamicsEvent &) const =default
Optional non-throwing translation for an externally referenced identity.
Definition model.hpp:1177
runtime::Result< ItemId, ModelError >(* map)(void *, ItemId) noexcept
Definition model.hpp:1179
void * context
Definition model.hpp:1178
runtime::Result< ItemId, ModelError > apply(ItemId id) const noexcept
Applies the callback or returns id unchanged when none is installed.
One timing offset and per-mille accent in a repeating groove table.
Definition model.hpp:550
constexpr auto operator<=>(const GrooveStep &) const =default
timebase::TickDuration timing_offset
Definition model.hpp:551
std::int32_t velocity_scale
Definition model.hpp:552
Complete validated construction input for a GrooveTemplate.
Definition model.hpp:558
std::vector< GrooveStep > steps
Definition model.hpp:566
timebase::TickDuration swing_grid
Definition model.hpp:562
std::string name
Definition model.hpp:559
timebase::TickDuration step
Definition model.hpp:565
std::int32_t timing_strength
Definition model.hpp:567
std::int32_t velocity_strength
Definition model.hpp:568
timebase::SwingRatio swing
Definition model.hpp:563
Planned identity-index transition accompanying an immutable model edit.
Definition model.hpp:1039
ItemLocation location
Definition model.hpp:1042
ItemId item
Definition model.hpp:1041
IdentityMutationKind mutation
Definition model.hpp:1040
Nonzero monotonic identity for a Timeline-owned object.
Definition item_id.hpp:19
Canonical ownership and ancestor coordinates for one project identity.
Definition model.hpp:1012
ItemId parent_id
Definition model.hpp:1015
constexpr bool has_same_owner(const ItemLocation &other) const noexcept
Returns whether two locations have the same kind and immediate owner.
Definition model.hpp:1029
ItemId clip_id
Definition model.hpp:1018
ItemId track_id
Definition model.hpp:1017
ItemKind kind
Definition model.hpp:1013
constexpr ItemLocation() noexcept=default
constexpr auto operator<=>(const ItemLocation &) const =default
bool active
Definition model.hpp:1019
ItemId sequence_id
Definition model.hpp:1016
Diagnostic counters for persistent launcher-index allocation.
Definition model.hpp:54
std::uint64_t nodes_created
Definition model.hpp:56
std::uint64_t live_nodes
Definition model.hpp:55
A track-owned named control that a performer sets and that drives parameters through ordinary modulat...
Definition modulation.hpp:129
Project-owned sealed media metadata.
Definition clip.hpp:140
One authored value on a controller lane, positioned in canonical ticks.
Definition midi_lane.hpp:68
Model failure with the offending and, when relevant, conflicting identity.
Definition clip.hpp:95
One authored source-to-parameter connection.
Definition modulation.hpp:209
A track-owned generator of modulation signal.
Definition modulation.hpp:109
Diagnostic counters for persistent project identity-index allocation.
Definition model.hpp:1046
std::uint64_t live_nodes
Definition model.hpp:1047
std::uint64_t nodes_created
Definition model.hpp:1048
Complete input for constructing a Project and its identity domain.
Definition model.hpp:927
std::uint64_t next_item_id
Definition model.hpp:930
timebase::MeterMap meter_map
Definition model.hpp:935
std::optional< TuningReference > tuning
Definition model.hpp:940
std::vector< MediaAsset > assets
Definition model.hpp:932
ItemId root_sequence_id
Definition model.hpp:931
timebase::TempoMap tempo_map
Definition model.hpp:934
ItemId id
Definition model.hpp:928
std::optional< SessionStart > session_start
Definition model.hpp:936
std::string name
Definition model.hpp:929
std::vector< Sequence > sequences
Definition model.hpp:933
Independent external-reference fixups for media assets and sequences.
Definition model.hpp:1186
ExternalIdFixup sequence
Definition model.hpp:1188
ExternalIdFixup asset
Definition model.hpp:1187
Remapped clip snapshot and its complete owned-identity table.
Definition model.hpp:1192
Clip clip
Definition model.hpp:1193
IdRemapTable ids
Definition model.hpp:1194
Remapped project snapshot and complete source-to-destination identity table.
Definition model.hpp:1231
IdRemapTable ids
Definition model.hpp:1233
Project project
Definition model.hpp:1232
Remapped sequence snapshot and its complete owned-identity table.
Definition model.hpp:1202
Sequence sequence
Definition model.hpp:1203
IdRemapTable ids
Definition model.hpp:1204
Remapped track snapshot and its complete owned-identity table.
Definition model.hpp:1197
Track track
Definition model.hpp:1198
IdRemapTable ids
Definition model.hpp:1199
Authored grouping of slots presented as one launchable column.
Definition clip_launch.hpp:247
Complete construction input for a Sequence and its owned collections.
Definition model.hpp:669
std::vector< ItemId > track_order
Definition model.hpp:688
std::optional< GrooveTemplate > groove
Definition model.hpp:681
std::optional< AbsoluteTimelineDuration > absolute_duration
Definition model.hpp:673
std::vector< SequenceMarker > markers
Definition model.hpp:675
ItemId id
Definition model.hpp:670
std::optional< DynamicsLane > dynamics_lane
Intensity context lane.
Definition model.hpp:680
std::vector< Track > tracks
Definition model.hpp:674
std::optional< timebase::TickDuration > musical_duration
Definition model.hpp:672
std::optional< ChordScaleLane > chord_scale_lane
Definition model.hpp:677
std::vector< SequenceRegion > regions
Definition model.hpp:676
std::vector< Scene > scenes
Definition model.hpp:684
std::string name
Definition model.hpp:671
Named point on a sequence's musical timeline.
Definition model.hpp:495
timebase::TickPosition position
Definition model.hpp:498
std::string name
Definition model.hpp:497
ItemId id
Definition model.hpp:496
std::optional< std::uint32_t > color
Definition model.hpp:499
Named positive-duration span on a sequence's musical timeline.
Definition model.hpp:525
std::string name
Definition model.hpp:527
timebase::TickPosition position
Definition model.hpp:528
auto operator<=>(const SequenceRegion &) const =default
Compares every authored member, role included.
ItemId id
Definition model.hpp:526
SectionRole role
Definition model.hpp:531
timebase::TickDuration duration
Definition model.hpp:529
std::optional< std::uint32_t > color
Definition model.hpp:530
Absolute source/house-clock position corresponding to project time zero.
Definition model.hpp:916
constexpr bool operator==(const SessionStart &other) const noexcept
Compares the exact sample position and rational rate.
Definition model.hpp:921
timebase::SamplePosition start
Definition model.hpp:917
timebase::RationalRate sample_rate
Definition model.hpp:918
One authored launch slot.
Definition clip_launch.hpp:145
Sealed offline-rendered track artifact and its source-plan identity.
Definition recording.hpp:84
Diagnostic counters for persistent track clip-index allocation.
Definition model.hpp:48
std::uint64_t live_nodes
Definition model.hpp:49
std::uint64_t nodes_created
Definition model.hpp:50
Complete input for constructing a Track and its owned collections.
Definition model.hpp:60
ItemId active_take_lane_id
Definition model.hpp:72
std::string name
Definition model.hpp:62
std::optional< TuningReference > tuning
Definition model.hpp:76
std::vector< Modulator > modulators
Definition model.hpp:66
std::vector< AutomationLane > automation_lanes
Definition model.hpp:65
std::vector< ModulationRoute > modulation_routes
Definition model.hpp:68
TrackMixer mixer
Definition model.hpp:74
std::vector< Clip > clips
Definition model.hpp:63
std::vector< TakeLane > take_lanes
Definition model.hpp:69
bool record_armed
Definition model.hpp:70
ItemId id
Definition model.hpp:61
std::optional< TrackFreeze > freeze
Definition model.hpp:73
std::vector< DevicePlacement > device_chain
Definition model.hpp:64
std::vector< MacroControl > macros
Definition model.hpp:67
Track-owned linear gain and stereo balance.
Definition recording.hpp:139
Durable statement of the tuning a project or one instrument plays in.
Definition tuning.hpp:46
Immutable authored scene, slot, quantization, and follow-action model.