Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
Safe HaskellNone

Derive.ParseTitle

Description

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

blocks

parse_block :: Text -> Either Text DeriveT.Expr Source #

A block title is a normal expression, applied as a transform.

tracks

data Type Source #

Instances

Instances details
Eq Type # 
Instance details

Defined in Derive.ParseTitle

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Show Type # 
Instance details

Defined in Derive.ParseTitle

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Pretty Type # 
Instance details

Defined in Derive.ParseTitle

note track

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.

data ControlType Source #

Constructors

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 Pitch.empty_scale), and sets the given pitch signal.

Control (Either TrackCall (ScoreT.Typed ScoreT.Control)) (Maybe Merge)

Control track with an optional combining operator.

Instances

Instances details
Eq ControlType # 
Instance details

Defined in Derive.ParseTitle

Show ControlType # 
Instance details

Defined in Derive.ParseTitle

ShowVal.ShowVal ControlType # 
Instance details

Defined in Derive.ParseTitle

p_pitch :: A.Parser ControlType Source #

  • twelve (#name | !track-call) merge

p_control :: A.Parser ControlType Source #

(!track-call | % | control:typ) merge

unparse

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.

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.

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.

pitch