Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

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 # 

Methods

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

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

Show Type # 

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Pretty Type # 

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 PControl) (Maybe Merge)

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

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

Control track with an optional combining operator.

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 :: Typed 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 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 Instrument Source #

Convert a track title into its instrument.

instrument_to_title :: Instrument -> Text Source #

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

pitch