Safe Haskell | Safe-Inferred |
---|
This is the basic interface for slicing. This also includes inverting
,
which is a special case of slicing.
Synopsis
- under_invert :: (NoteArgs -> NoteDeriver -> NoteDeriver) -> NoteArgs -> NoteDeriver -> NoteDeriver
- inverting :: (PassedArgs d -> NoteDeriver) -> PassedArgs d -> NoteDeriver
- inverting_args :: PassedArgs d -> (PassedArgs d -> NoteDeriver) -> NoteDeriver
- sub_events :: PassedArgs d -> Deriver [[SubT.Event]]
- sub_events_negative :: PassedArgs d -> Deriver [[SubT.Event]]
- sub_tracks :: PassedArgs d -> Deriver [SubT.Track]
- assert_no_subs :: PassedArgs d -> Deriver ()
- modify_notes :: ([SubT.EventT Text] -> Either Text [SubT.EventT Text]) -> PassedArgs a -> Either Text (PassedArgs a)
- derive_subs :: PassedArgs d -> NoteDeriver
- derive :: [SubT.Event] -> NoteDeriver
- derive_tracks :: [[SubT.Event]] -> NoteDeriver
- derive_pitch :: SubT.Event -> Deriver (SubT.EventT (Maybe Pitch.Note))
- fit :: (ScoreTime, ScoreTime) -> (ScoreTime, ScoreTime) -> [SubT.Event] -> NoteDeriver
- type RestEvent = SubT.EventT (Maybe NoteDeriver)
- sub_rest_events :: Bool -> Bool -> PassedArgs d -> Deriver [[RestEvent]]
- fit_rests :: (ScoreTime, ScoreTime) -> (ScoreTime, ScoreTime) -> [RestEvent] -> NoteDeriver
- strip_rests :: [RestEvent] -> [SubT.Event]
- reapply :: Context Score.Event -> DeriveT.Expr -> [[SubT.Event]] -> NoteDeriver
- reapply_call :: Context Score.Event -> Expr.Symbol -> [DeriveT.Term] -> [[SubT.Event]] -> NoteDeriver
inversion
under_invert :: (NoteArgs -> NoteDeriver -> NoteDeriver) -> NoteArgs -> NoteDeriver -> NoteDeriver Source #
Cause this transformer to apply only after inversion.
under_invert
documents this, also see
NOTE [under-invert].
Normally when a call is inverted, the transformers run outside the inversion, while only the generator runs underneath. However, some transformers rely on per-note controls, such as pitch and dyn, and therefore need to go under the invert. So this saves the transformer, and applies it only after all the inversion has happened.
If there are no sub-tracks, then inversion won't happen, and the transform is run right here. However, if there are sub-tracks, but the generator doesn't want to run, then the transform will be lost.
TODO I could probably fix it by making Eval.eval_generator apply the transform, but it would have to clear it out too to avoid evaluating more than once. Not sure which way is right.
inverting :: (PassedArgs d -> NoteDeriver) -> PassedArgs d -> NoteDeriver Source #
Convert a call into an inverting call. This is designed to be convenient to insert after the signature arg in a call definition. The args passed to the call have been stripped of their sub tracks to avoid another inversion.
inverting_args :: PassedArgs d -> (PassedArgs d -> NoteDeriver) -> NoteDeriver Source #
inverting
with its arguments flipped. This is useful for calls that
want to do stuff with the args before inverting. Make sure to shadow the
old PassedArgs
with the ones passed to the call, for the reason
documented in inverting
.
events
sub_events :: PassedArgs d -> Deriver [[SubT.Event]] Source #
Get the Events of subtracks, if any, returning one list of events per sub note track. This is the top-level utility for note calls that take other note calls as arguments.
sub_events_negative :: PassedArgs d -> Deriver [[SubT.Event]] Source #
Like sub_events
, but exclude events at the start time, and include
events at the end time. Presumably suitable for Negative
calls.
sub_tracks :: PassedArgs d -> Deriver [SubT.Track] Source #
TODO maybe this should replace sub_events
assert_no_subs :: PassedArgs d -> Deriver () Source #
Throw an exception if there are sub-events.
modify_notes :: ([SubT.EventT Text] -> Either Text [SubT.EventT Text]) -> PassedArgs a -> Either Text (PassedArgs a) Source #
Modify the text of sub note tracks before deriving them. This can be used to implement an ad-hoc new language.
derive_subs :: PassedArgs d -> NoteDeriver Source #
derive :: [SubT.Event] -> NoteDeriver Source #
Derive and merge Events.
derive_tracks :: [[SubT.Event]] -> NoteDeriver Source #
derive_pitch :: SubT.Event -> Deriver (SubT.EventT (Maybe Pitch.Note)) Source #
Get the pitch of an Event. Useful for debugging.
:: (ScoreTime, ScoreTime) | fit this range |
-> (ScoreTime, ScoreTime) | into this range |
-> [SubT.Event] | |
-> NoteDeriver |
Re-fit the events from one range to another.
RestEvent
type RestEvent = SubT.EventT (Maybe NoteDeriver) Source #
A Nothing represents a rest.
:: Bool | end bias |
-> Bool | if True, include the trailing gap as a rest |
-> PassedArgs d | |
-> Deriver [[RestEvent]] |
This is like sub_events
, but gaps between the events are returned as
explicit rests.
fit_rests :: (ScoreTime, ScoreTime) -> (ScoreTime, ScoreTime) -> [RestEvent] -> NoteDeriver Source #
strip_rests :: [RestEvent] -> [SubT.Event] Source #
reapply
reapply :: Context Score.Event -> DeriveT.Expr -> [[SubT.Event]] -> NoteDeriver Source #
Call a note parent with sub-events. While you can easily call other
kinds of calls with Eval.reapply
, note parents are more tricky
because they expect a track structure in ctx_sub_tracks
. This
bypasses that and directly passes SubT.EventT
s to the note parent,
courtesy of ctx_sub_events
.
reapply_call :: Context Score.Event -> Expr.Symbol -> [DeriveT.Term] -> [[SubT.Event]] -> NoteDeriver Source #