Safe Haskell | Safe-Inferred |
---|
Slicing is chopping the block horizontally, so that the horizontal chunks can act like their own little blocks.
For the sake of convenient notation, this is done in several places.
- A note with subtracks will slice out the subevents within its range.
This allows a note to take another note (or notes) as arguments, e.g.
a tuplet. This is what
slice_notes
is for. - A note with controls as subtracks can invert itself so it has control over the evaluation of the controls. Documented further in Derive.Call.Note.
- #1 above is a convenient way to apply a transformation to multiple
notes: group the tracks under another, and put the transformations in the
parent. However, notes that have no transformation (aka orphans) must be
extracted from underneath the empty parent, otherwise they will not be
evaluated at all. This is done by
derive_note_track
.
This is a nasty tricky bit of work, but is depended on by all the high level notation, e.g. calls that can manipulate the results of other calls, aka parent calls. I'd still love to figure out a better way to do it though!
Synopsis
- data InsertEvent = InsertEvent {
- event_duration :: !ScoreTime
- event_orientation :: !Types.Orientation
- event_around :: !([Event.Event], [Event.Event])
- event_track_id :: !(Maybe TrackId)
- data Track = Track {}
- slice :: Bool -> ScoreTime -> ScoreTime -> Maybe InsertEvent -> TrackTree.EventsNode -> TrackTree.EventsNode
- checked_slice_notes :: Bool -> ScoreTime -> ScoreTime -> TrackTree.EventsTree -> Either Text [Track]
- slice_orphans :: Bool -> ScoreTime -> ScoreTime -> [TrackTree.EventsNode] -> Either Text [TrackTree.EventsNode]
Documentation
data InsertEvent Source #
Ask slice
to synthesize a note track and insert it at the leaves of
the sliced tree.
InsertEvent | |
|
Instances
Show InsertEvent Source # | |
Defined in Derive.Slice showsPrec :: Int -> InsertEvent -> ShowS # show :: InsertEvent -> String # showList :: [InsertEvent] -> ShowS # |
:: Bool | Omit events than begin at the start.
|
-> ScoreTime | |
-> ScoreTime | |
-> Maybe InsertEvent | If given, insert an event at the bottom with the given text and dur. The created track will have the given track_range, so it can create a Stack.Region entry. |
-> TrackTree.EventsNode | |
-> TrackTree.EventsNode |
Slice a track between start and end, and optionally put a note track with a single event of given string at the bottom. Sliced control tracks usually get events beyond the slice boundaries for context.
:: Bool | TODO change this to Event.Orientation? |
-> ScoreTime | |
-> ScoreTime | |
-> TrackTree.EventsTree | |
-> Either Text [Track] |
This is slice_notes
, but throw an error if find_overlapping
complains.
TODO I think I don't want to allow sub-events larger than their slice, but currently I do. Actually I think overlap checking needs an overhaul in general.
slice_orphans :: Bool -> ScoreTime -> ScoreTime -> [TrackTree.EventsNode] -> Either Text [TrackTree.EventsNode] Source #
This is a variant of slice
used by note track evaluation to derive
orphan events.