Safe Haskell | Safe-Inferred |
---|
Utilities for calls to cooperate with the lilypond backend.
Synopsis
- when_lilypond :: Deriver a -> Deriver a -> Deriver a
- when_lilypond_config :: (Types.Config -> Deriver a) -> Deriver a -> Deriver a
- only_lilypond :: NoteDeriver -> NoteDeriver
- note_code :: Code -> PassedArgs d -> NoteDeriver -> NoteDeriver
- add_all :: Code -> NoteDeriver -> NoteDeriver
- add_first :: Code -> NoteDeriver -> NoteDeriver
- prepend :: Position Constants.CodePosition
- append :: Constants.Distribution -> Position Constants.CodePosition
- note_append :: Constants.Distribution -> Position Constants.CodePosition
- notes_code :: Code -> PassedArgs d -> NoteDeriver -> NoteDeriver
- first_note_code :: Code -> PassedArgs d -> NoteDeriver -> NoteDeriver
- notes_around :: Code -> Code -> PassedArgs d -> NoteDeriver -> NoteDeriver
- notes_around_ly :: Code -> Code -> PassedArgs d -> NoteDeriver
- code_around :: FreeCode -> FreeCode -> PassedArgs d -> NoteDeriver
- notes_with :: (NoteDeriver -> NoteDeriver) -> PassedArgs d -> NoteDeriver -> NoteDeriver
- first_last :: (Score.Event -> Score.Event) -> (Score.Event -> Score.Event) -> Stream.Stream Score.Event -> Stream.Stream Score.Event
- type Code = (Position Constants.CodePosition, Ly)
- type FreeCode = (Position Constants.FreeCodePosition, Ly)
- data Position pos
- = Position !pos
- | SetEnviron !EnvKey.Key
- code_position_names :: Map Text (Position Constants.CodePosition)
- type Ly = Text
- type Note = Ly
- code0 :: ScoreTime -> FreeCode -> NoteDeriver
- code0_event :: RealTime -> FreeCode -> Score.Event -> Score.Event
- global :: Deriver a -> Deriver a
- is_code0 :: Score.Event -> Bool
- is_code :: Score.Event -> Bool
- add_note_code :: Code -> Score.Event -> Score.Event
- note_duration :: Types.Config -> RealTime -> Types.NoteDuration
- is_note_duration :: Types.Config -> RealTime -> Maybe Types.NoteDuration
- is_duration :: Types.Config -> RealTime -> Maybe Types.Duration
- note_pitch :: NoteDeriver -> Deriver Note
- pitch_to_lily :: DeriveT.Environ -> DeriveT.Transposed -> Deriver Note
- to_time :: Types.Config -> RealTime -> Types.Time
utils for ly calls
:: (Types.Config -> Deriver a) | Run if this is a lilypond derive. |
-> Deriver a | Run if this is a normal derive. |
-> Deriver a |
only_lilypond :: NoteDeriver -> NoteDeriver Source #
Only emit the deriver if I'm in lilypond mode.
note_code :: Code -> PassedArgs d -> NoteDeriver -> NoteDeriver Source #
When in lilypond mode, generate a note with the given Code.
transformer
add_all :: Code -> NoteDeriver -> NoteDeriver Source #
Add the Code to all the events.
add_first :: Code -> NoteDeriver -> NoteDeriver Source #
Add Code to the first event.
note parent
notes_code :: Code -> PassedArgs d -> NoteDeriver -> NoteDeriver Source #
Replace a note parent with one that derives its sub-events as-is and adds lilypond code to them.
first_note_code :: Code -> PassedArgs d -> NoteDeriver -> NoteDeriver Source #
Like notes_code
, but only apply the code to the first event, not all of
them.
notes_around :: Code -> Code -> PassedArgs d -> NoteDeriver -> NoteDeriver Source #
This is like notes_code
, but the first event in each track gets the
start code, and the last event in each track gets the end code.
notes_around_ly :: Code -> Code -> PassedArgs d -> NoteDeriver Source #
Like notes_around
, but for use when you already know you're in lilypond
mode.
code_around :: FreeCode -> FreeCode -> PassedArgs d -> NoteDeriver Source #
Like notes_around
, but when I'm not in lilypond mode just derive the
sub events unchanged.
notes_with :: (NoteDeriver -> NoteDeriver) -> PassedArgs d -> NoteDeriver -> NoteDeriver Source #
Transform and evaluate the sub events.
first_last :: (Score.Event -> Score.Event) -> (Score.Event -> Score.Event) -> Stream.Stream Score.Event -> Stream.Stream Score.Event Source #
Apply a function to the first and last Events, which are not is_code0
.
code
type Code = (Position Constants.CodePosition, Ly) Source #
Either prepend or append some code to a lilypond note.
Position !pos | |
SetEnviron !EnvKey.Key | Create a note with the given env value set to the Ly code. This is
for directives to the lilypond performer, not to lilypond itself.
E.g. |
Instances
Show pos => Show (Position pos) Source # | |
Eq pos => Eq (Position pos) Source # | |
ShowVal.ShowVal (Position Constants.CodePosition) Source # | |
Defined in Derive.Call.Ly | |
Typecheck.ToVal (Position Constants.CodePosition) Source # | |
Defined in Derive.Call.Ly | |
Typecheck.Typecheck (Position Constants.CodePosition) Source # | |
Defined in Derive.Call.Ly | |
Pretty pos => Pretty (Position pos) Source # | |
code0 :: ScoreTime -> FreeCode -> NoteDeriver Source #
Like code
, but for 0 duration code fragments, and can either put them
before or after notes that occur at the same time.
code0_event :: RealTime -> FreeCode -> Score.Event -> Score.Event Source #
Make a code0 event directly. Inherit instrument and environ from an existing note. Otherwise, the lilypond backend doesn't know how to group the code event.
TODO aka free_code, maybe rename it?
is_code0 :: Score.Event -> Bool Source #
Test if an event is a 0 duration lilypond code event.
is_code :: Score.Event -> Bool Source #
low level
add_note_code :: Code -> Score.Event -> Score.Event Source #
Add lilypond code to a note. Skip is_code
events, since those aren't
actual notes.
convert
note_duration :: Types.Config -> RealTime -> Types.NoteDuration Source #
Round the RealTime to the nearest NoteDuration.
is_note_duration :: Types.Config -> RealTime -> Maybe Types.NoteDuration Source #
Like note_duration
, but only succeeds if the RealTime is exactly
a NoteDuration.
is_duration :: Types.Config -> RealTime -> Maybe Types.Duration Source #
note_pitch :: NoteDeriver -> Deriver Note Source #
to_time :: Types.Config -> RealTime -> Types.Time Source #