130 std::uint64_t next_ = 1;
269 std::vector<MidiExpressionLane>
lanes);
280 std::span<const NoteEvent>
notes() const noexcept {
286 std::span<const NoteModifier>
modifiers() const noexcept {
287 return data_->modifiers;
292 return data_->modifier_seed;
302 std::span<const MidiExpressionLane>
lanes() const noexcept {
314 std::vector<NoteEvent>
notes;
317 std::vector<MidiExpressionLane>
lanes;
320 explicit MidiContent(std::shared_ptr<const Data> data) : data_(
std::move(data)) {}
322 std::shared_ptr<const Data> data_;
329class RegisteredContent {
336 const std::shared_ptr<const void>&
value() const noexcept {
341 return canonical_payload_json_;
345 return retained_bytes_;
351 return schema_registry_identity_;
358 template <
typename T>
const T*
value_as() const noexcept {
359 return static_cast<const T*
>(value_.get());
372 std::shared_ptr<const void> value_;
373 std::string canonical_payload_json_;
374 std::size_t retained_bytes_ = 0;
375 std::shared_ptr<const void> schema_registry_identity_;
416 : schema_(
std::move(schema)), raw_json_(
std::move(raw_json)), limits_(limits) {}
417 SchemaIdentity schema_;
418 std::string raw_json_;
419 OpaqueContentLimits limits_;
449 using Fs::operator()...;
526 explicit Clip(
std::shared_ptr<const Data> data) : data_(
std::move(data)) {}
527 std::shared_ptr<const Data> data_;
Result<T, E> — either holds a T or an E, never both.
Definition result.hpp:76
const ClipContent & content() const noexcept
Returns the immutable content value.
static runtime::Result< Clip, ModelError > create_absolute(ItemId id, timebase::SamplePosition start, std::uint64_t sample_count, timebase::RationalRate sample_rate, ClipContent content, ClipPlaybackProperties playback={}, TimeConform time_conform=TimeConform::None)
Creates an absolute clip in samples at sample_rate.
runtime::Result< Clip, ModelError > with_time_range(ClipTimeRange range) const
Returns a snapshot with validated replacement placement.
ClipTimeAnchor time_anchor() const noexcept
Returns the clip's authored time domain.
runtime::Result< Clip, ModelError > with_time_conform(TimeConform time_conform) const
Returns a snapshot with validated time-conform intent.
runtime::Result< Clip, ModelError > with_playback_properties(ClipPlaybackProperties playback) const
Returns a snapshot with validated replacement gain and fades.
runtime::Result< Clip, ModelError > with_content(ClipContent content) const
Returns a snapshot with validated replacement content.
timebase::SamplePosition absolute_start() const noexcept
Returns absolute start; precondition: time_anchor() is Absolute.
timebase::TickPosition end() const noexcept
Returns musical exclusive end; precondition: time_anchor() is Musical.
ItemId id() const noexcept
Returns the stable clip identity.
ClipPlaybackProperties playback_properties() const noexcept
Returns the authored gain and fade controls.
timebase::RationalRate absolute_sample_rate() const noexcept
Returns absolute placement rate; precondition: anchor is Absolute.
timebase::TickPosition start() const noexcept
Returns musical start; precondition: time_anchor() is Musical.
static runtime::Result< Clip, ModelError > create(ItemId id, timebase::TickPosition start, timebase::TickDuration duration, ClipContent content, ClipPlaybackProperties playback={}, TimeConform time_conform=TimeConform::None)
Creates a musical clip in canonical ticks.
timebase::TickDuration duration() const noexcept
Returns musical duration; precondition: time_anchor() is Musical.
TimeConform time_conform() const noexcept
Returns the authored intent. None preserves legacy behavior.
timebase::SamplePosition absolute_end() const noexcept
Returns absolute exclusive end; precondition: anchor is Absolute.
std::uint64_t absolute_duration_samples() const noexcept
Returns absolute duration in samples; precondition: anchor is Absolute.
const ClipTimeRange & time_range() const noexcept
Returns the complete authored placement range.
Durable SHA-256 identity for sealed media bytes.
Definition assets.hpp:24
constexpr ItemIdAllocator(std::uint64_t next=1) noexcept
Creates an allocator whose next successful result is next.
Definition clip.hpp:120
runtime::Result< ItemId, ModelError > allocate() noexcept
Returns the next identity and advances the allocator.
constexpr std::uint64_t next_value() const noexcept
Returns the numeric value that the next successful allocation uses.
Definition clip.hpp:125
Immutable MIDI clip content: start-then-identity-ordered notes with sparse deterministic modifiers,...
Definition clip.hpp:246
std::span< const MidiExpressionLane > lanes() const noexcept
Controller and expression streams in (address, id) order, each lane's points in (position,...
Definition clip.hpp:302
static runtime::Result< MidiContent, ModelError > create(std::vector< NoteEvent > notes)
Notes alone: no modifiers, no lanes, and a zero seed.
std::span< const NoteEvent > notes() const noexcept
Returns notes in canonical (start, id) order.
Definition clip.hpp:280
runtime::Result< MidiContent, ModelError > replace_note(NoteEvent note) const
Returns a new snapshot replacing the note with the same identity.
std::uint64_t modifier_seed() const noexcept
Returns the authored seed used to derive per-note probability draws.
Definition clip.hpp:291
static runtime::Result< MidiContent, ModelError > create(std::vector< NoteEvent > notes, std::vector< NoteModifier > modifiers, std::uint64_t modifier_seed)
Notes plus their sparse modifier companion array.
static runtime::Result< MidiContent, ModelError > create(std::vector< NoteEvent > notes, std::vector< NoteModifier > modifiers, std::uint64_t modifier_seed, std::vector< MidiExpressionLane > lanes)
Notes, modifiers, seed, and the clip's controller/expression lanes.
const MidiExpressionLane * lane_for(const MidiLaneAddress &address) const noexcept
The lane addressing address, or nullptr when the clip authors none.
const NoteModifier * modifier_for(ItemId note_id) const noexcept
The modifier for note_id, or nullptr when the note plays by default.
std::span< const NoteModifier > modifiers() const noexcept
Sorted by note id and containing only notes whose playback differs from the default,...
Definition clip.hpp:286
Exact validated JSON for an unavailable extension schema.
Definition clip.hpp:395
static runtime::Result< OpaqueContent, ModelError > create(SchemaIdentity schema, std::string raw_json, OpaqueContentLimits limits={})
Validates raw_json within limits and stores it without normalization.
const OpaqueContentLimits & validation_limits() const noexcept
Returns the bounds under which raw_json() was admitted.
Definition clip.hpp:410
const SchemaIdentity & schema() const noexcept
Returns the unavailable schema identity.
Definition clip.hpp:402
const std::string & raw_json() const noexcept
Returns the exact validated JSON bytes supplied at construction.
Definition clip.hpp:406
Extension-defined typed C++ content admitted by a SchemaRegistry.
Definition clip.hpp:329
friend class SchemaRegistry
Definition clip.hpp:363
const std::shared_ptr< const void > & value() const noexcept
Returns shared ownership of the type-erased immutable value.
Definition clip.hpp:336
const std::string & canonical_payload_json() const noexcept
Returns the validated canonical JSON representation.
Definition clip.hpp:340
std::size_t retained_bytes() const noexcept
Returns the retained-byte charge used for document limits.
Definition clip.hpp:344
const SchemaIdentity & schema() const noexcept
Returns the schema identity that controls serialization.
Definition clip.hpp:332
const std::shared_ptr< const void > & schema_registry_identity() const noexcept
Opaque identity of the immutable schema registry whose codec created this erased value.
Definition clip.hpp:350
const T * value_as() const noexcept
Views the registered value as T.
Definition clip.hpp:358
Immutable, shareable registry of Timeline schema contracts.
Definition schema_registry.hpp:189
std::variant< EmptyContent, MediaRef, MidiContent, RegisteredContent, OpaqueContent, SequenceRef > ClipContent
Exhaustive set of immutable payloads a Clip can own or reference.
Definition clip.hpp:423
AssetStoragePolicy
Preferred storage relationship between a project and an asset's bytes.
Definition assets.hpp:46
ClipTimeAnchor
Time domain in which a clip's placement remains anchored.
Definition clip.hpp:170
ClipContentCases(Fs...) -> ClipContentCases< Fs... >
TimeConform
Authored policy for adapting a musical media clip when its duration and source duration differ.
Definition clip.hpp:175
std::variant< MusicalTimeRange, AbsoluteTimeRange > ClipTimeRange
Exhaustive authored clip-placement domains.
Definition clip.hpp:224
constexpr std::size_t kClipContentAlternativeCount
Guard for code that can only be correct while ClipContent holds exactly the alternatives it does toda...
Definition clip.hpp:461
ModelErrorCode
Validation and identity failures returned by immutable Timeline model edits.
Definition clip.hpp:31
ClipFadeShape
Gain curve traversed across a clip's fade region, in both directions.
Definition clip.hpp:208
@ External
Resolve the bytes outside the project package.
Definition assets.hpp:48
@ Musical
Definition clip.hpp:170
@ Absolute
Definition clip.hpp:170
@ None
Definition clip.hpp:176
@ Stretch
Definition clip.hpp:178
@ Resample
Definition clip.hpp:177
@ InvalidNote
Definition clip.hpp:38
@ SequenceNestingTooDeep
Definition clip.hpp:83
@ InvalidAudioLoopInfo
Definition clip.hpp:64
@ InvalidTakeComp
Definition clip.hpp:61
@ DuplicateMidiLaneAddress
Definition clip.hpp:80
@ OpaqueContentLimitExceeded
Definition clip.hpp:53
@ InvalidChordScaleEvent
Definition clip.hpp:69
@ MissingModulationSource
Definition clip.hpp:90
@ InvalidModulator
Definition clip.hpp:87
@ InvalidMarker
Definition clip.hpp:66
@ UnorderedDynamicsLane
Dynamics events were supplied out of position order, or two share a position.
Definition clip.hpp:76
@ InvalidSchemaIdentity
Definition clip.hpp:48
@ ActiveCompTakeRemoval
Definition clip.hpp:63
@ InvalidMediaRange
Definition clip.hpp:36
@ InvalidAssetLocator
Definition clip.hpp:50
@ OpaqueContentCannotRemap
Definition clip.hpp:54
@ OverlappingClips
Definition clip.hpp:39
@ MissingRootSequence
Definition clip.hpp:41
@ MissingItem
Definition clip.hpp:45
@ InvalidDuration
Definition clip.hpp:35
@ DuplicateAssetRepresentation
Definition clip.hpp:51
@ InvalidNoteModifier
Definition clip.hpp:78
@ SequenceReferenceCycle
Definition clip.hpp:82
@ ItemIdExhausted
Definition clip.hpp:34
@ MissingAsset
Definition clip.hpp:40
@ InvalidSampleRate
Definition clip.hpp:37
@ InvalidItemId
Definition clip.hpp:32
@ InvalidTimeConform
Definition clip.hpp:85
@ NextItemIdNotMonotonic
Definition clip.hpp:42
@ MissingSequenceReference
Definition clip.hpp:81
@ ActiveTakeLaneRemoval
Definition clip.hpp:60
@ InvalidModulationRoute
Definition clip.hpp:89
@ InvalidIdentityTransition
Definition clip.hpp:47
@ InvalidSessionStart
Definition clip.hpp:68
@ InvalidAssetStoragePolicy
Definition clip.hpp:65
@ InvalidTrackMixer
Definition clip.hpp:84
@ MixedTimeAnchors
Definition clip.hpp:43
@ InvalidGrooveTemplate
Definition clip.hpp:77
@ IncompatibleSampleRate
Definition clip.hpp:44
@ InvalidRegion
Definition clip.hpp:67
@ DuplicateAutomationTarget
Definition clip.hpp:57
@ InvalidMidiLane
Definition clip.hpp:79
@ InvalidContentHash
Definition clip.hpp:49
@ InvalidTuningReference
Definition clip.hpp:86
@ MissingAutomationTarget
Definition clip.hpp:56
@ InvalidTake
Definition clip.hpp:58
@ UnorderedChordScaleLane
Definition clip.hpp:70
@ DuplicateItemId
Definition clip.hpp:33
@ OverlappingTakeComp
Definition clip.hpp:62
@ MissingModulationTarget
Definition clip.hpp:91
@ InvalidMacroControl
Definition clip.hpp:88
@ DuplicateTake
Definition clip.hpp:59
@ InvalidClipPlaybackProperties
Definition clip.hpp:55
@ InvalidDynamicsEvent
A dynamics event carries a negative position, or an intensity that is not finite and within [0,...
Definition clip.hpp:73
@ InvalidOpaqueContent
Definition clip.hpp:52
@ IdentityConflict
Definition clip.hpp:46
@ Linear
Definition clip.hpp:208
@ EqualPower
Definition clip.hpp:208
Definition audio_renderer.hpp:20
Definition generated_event_source.hpp:33
Definition beat_division.hpp:11
Definition program_compiler.hpp:18
Result<T, E> — success / failure union for fallible operations.
Definition rational_time.hpp:14
Definition rational_time.hpp:9
Absolute clip placement in samples at an explicit rational rate.
Definition clip.hpp:188
timebase::RationalRate sample_rate
Definition clip.hpp:191
std::uint64_t sample_count
Definition clip.hpp:190
timebase::SamplePosition start
Definition clip.hpp:189
Sequence duration in absolute samples at an explicit rational rate.
Definition clip.hpp:195
timebase::RationalRate sample_rate
Definition clip.hpp:197
std::uint64_t sample_count
Definition clip.hpp:196
Overload set for visiting a ClipContent with no generic fallback.
Definition clip.hpp:448
Clip-level audio controls.
Definition clip.hpp:215
constexpr auto operator<=>(const ClipPlaybackProperties &) const =default
std::uint64_t fade_out_duration
Definition clip.hpp:218
float gain_linear
Definition clip.hpp:216
ClipFadeShape fade_shape
Definition clip.hpp:219
std::uint64_t fade_in_duration
Definition clip.hpp:217
Clip content that intentionally carries no media, notes, or extension value.
Definition clip.hpp:134
Nonzero monotonic identity for a Timeline-owned object.
Definition item_id.hpp:19
One controller stream's authored points, ordered by (position, id).
Definition midi_lane.hpp:90
Address of one continuous controller stream within a MidiContent.
Definition midi_lane.hpp:41
Model failure with the offending and, when relevant, conflicting identity.
Definition clip.hpp:95
ItemId related_item
Definition clip.hpp:98
ModelErrorCode code
Definition clip.hpp:96
ItemId item
Definition clip.hpp:97
Musical clip placement in canonical ticks.
Definition clip.hpp:182
timebase::TickDuration duration
Definition clip.hpp:184
timebase::TickPosition start
Definition clip.hpp:183
One identity-bearing MIDI-style note in canonical musical ticks.
Definition clip.hpp:227
timebase::TickPosition start
Definition clip.hpp:229
std::uint16_t velocity
Definition clip.hpp:231
std::uint8_t pitch
Definition clip.hpp:232
timebase::TickDuration duration
Definition clip.hpp:230
std::uint8_t channel
Definition clip.hpp:233
ItemId id
Definition clip.hpp:228
Sparse playback modifier attached to one note identity.
Definition note_modifier.hpp:103
Parser bounds retained with an opaque extension envelope.
Definition clip.hpp:379
std::size_t max_total_values
Definition clip.hpp:382
std::size_t max_string_bytes
Definition clip.hpp:385
std::size_t max_object_members
Definition clip.hpp:384
std::size_t max_opaque_bytes
Definition clip.hpp:386
std::size_t max_input_bytes
Definition clip.hpp:380
std::size_t max_depth
Definition clip.hpp:381
std::size_t max_array_elements
Definition clip.hpp:383
constexpr auto operator<=>(const OpaqueContentLimits &) const =default
Versioned extension-schema identity.
Definition clip.hpp:102
std::uint32_t version
Definition clip.hpp:104
std::string type_name
Definition clip.hpp:103
bool valid() const noexcept
Returns whether the type name is non-empty and the version is non-zero.
Reference to a sibling sequence in the same Project pool.
Definition clip.hpp:162
timebase::TickPosition source_start
Definition clip.hpp:164
ItemId sequence_id
Definition clip.hpp:163
constexpr auto operator<=>(const SequenceRef &) const =default