Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Derive.ParseTitle

Contents

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 BaseTypes.Expr Source #

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

tracks

data Type Source #

Instances
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 Score.PControl)

Pitch track that sets a ScaleId (unless it's Pitch.empty_scale), and sets the given pitch signal.

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

Control track with an optional combining operator.

Instances
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 :: Score.Typed Score.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 Score.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 BaseTypes.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 Score.Instrument Source #

Convert a track title into its instrument.

instrument_to_title :: Score.Instrument -> Text Source #

Convert from an instrument to the title of its instrument track.

pitch