Safe Haskell | Safe-Inferred |
---|
Utilities to deal with block and track titles.
This module is used by both Cmd and Derive since Cmd also wants to know track types for track specific cmds.
Note track titles are just tracklang expressions, so no extra code is needed. Control tracks titles are just a hardcoded list of special cases, though they are parsed as tracklang Vals.
Synopsis
- parse_block :: Text -> Either Text DeriveT.Expr
- data Type
- track_type :: Text -> Type
- parse_note_track :: Text -> Either Text (ScoreT.Instrument, Maybe TrackCall)
- p_note_track :: A.Parser (ScoreT.Instrument, Maybe TrackCall)
- parse_control_type :: Text -> Either Text ControlType
- parse_control_title :: Text -> Either Text (ControlType, [DeriveT.Call])
- data ControlType
- type Merge = Expr.Symbol
- type TrackCall = Expr.Symbol
- p_control_title :: A.Parser (ControlType, [DeriveT.Call])
- p_control_type :: A.Parser ControlType
- p_tempo :: A.Parser ControlType
- p_pitch :: A.Parser ControlType
- p_control :: A.Parser ControlType
- p_typed_control :: A.Parser (ScoreT.Typed ScoreT.Control)
- p_type_annotation :: A.Parser ScoreT.Type
- control_type_to_title :: ControlType -> Text
- control_to_title :: ScoreT.Typed ScoreT.Control -> Text
- p_merge :: A.Parser Merge
- p_track_call :: A.Parser Expr.Symbol
- p_scale_id :: A.Parser Pitch.ScaleId
- title_to_control :: Text -> Maybe ScoreT.Control
- is_control_track :: Text -> Bool
- is_signal_track :: Text -> Bool
- is_tempo_track :: Text -> Bool
- parse_note :: Text -> Either Text DeriveT.Expr
- unparse_note :: DeriveT.Expr -> Text
- title_to_instrument :: Text -> Maybe ScoreT.Instrument
- instrument_to_title :: ScoreT.Instrument -> Text
- is_note_track :: Text -> Bool
- strip_expr :: Text -> Text
- note_track :: Text
- title_to_scale :: Text -> Maybe Pitch.ScaleId
- scale_to_title :: Pitch.ScaleId -> Text
- is_pitch_track :: Text -> Bool
- pitch_track :: Text
blocks
parse_block :: Text -> Either Text DeriveT.Expr Source #
A block title is a normal expression, applied as a transform.
tracks
track_type :: Text -> Type Source #
note track
parse_note_track :: Text -> Either Text (ScoreT.Instrument, Maybe TrackCall) Source #
control track
parse_control_type :: Text -> Either Text ControlType Source #
Parse the first part of the control track title. This is special syntax, and is not the usual call plus list of argument values.
parse_control_title :: Text -> Either Text (ControlType, [DeriveT.Call]) Source #
data ControlType Source #
Tempo (Maybe Expr.Symbol) | Tempo track with an optional modifying symbol. |
Pitch Pitch.ScaleId (Either TrackCall ScoreT.PControl) | Pitch track that sets a ScaleId (unless it's |
Control (Either TrackCall (ScoreT.Typed ScoreT.Control)) (Maybe Merge) | Control track with an optional combining operator. |
Instances
Show ControlType Source # | |
Defined in Derive.ParseTitle showsPrec :: Int -> ControlType -> ShowS # show :: ControlType -> String # showList :: [ControlType] -> ShowS # | |
Eq ControlType Source # | |
Defined in Derive.ParseTitle (==) :: ControlType -> ControlType -> Bool # (/=) :: ControlType -> ControlType -> Bool # | |
ShowVal.ShowVal ControlType Source # | |
Defined in Derive.ParseTitle show_val :: ControlType -> Text Source # |
type Merge = Expr.Symbol Source #
type TrackCall = Expr.Symbol Source #
p_pitch :: A.Parser ControlType Source #
- twelve (#name | !track-call) merge
p_control :: A.Parser ControlType Source #
(!track-call | % | control:typ) merge
unparse
control_type_to_title :: ControlType -> Text Source #
Invert parse_control_title
.
control_to_title :: ScoreT.Typed ScoreT.Control -> Text Source #
This is different from ShowVal (Typed Control) because the control doesn't need a % in the control track title.
parse util
p_scale_id :: A.Parser Pitch.ScaleId Source #
This is special syntax that's only allowed in control track titles.
util
title_to_control :: Text -> Maybe ScoreT.Control Source #
Convert a track title to its control.
is_control_track :: Text -> Bool Source #
A pitch track is also considered a control track.
is_signal_track :: Text -> Bool Source #
This is like is_control_track
but doesn't include pitch tracks.
is_tempo_track :: Text -> Bool Source #
note
parse_note :: Text -> Either Text DeriveT.Expr Source #
Parse a note track like >inst
as note-track inst
. Other than
this, note track titles are normal expressions.
unparse_note :: DeriveT.Expr -> Text Source #
title_to_instrument :: Text -> Maybe ScoreT.Instrument Source #
Convert a track title into its instrument.
instrument_to_title :: ScoreT.Instrument -> Text Source #
Convert from an instrument to the title of its instrument track.
is_note_track :: Text -> Bool Source #
strip_expr :: Text -> Text Source #
note_track :: Text Source #
pitch
title_to_scale :: Text -> Maybe Pitch.ScaleId Source #
scale_to_title :: Pitch.ScaleId -> Text Source #
is_pitch_track :: Text -> Bool Source #
pitch_track :: Text Source #