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

Cmd.Info

Description

Functions to get higher level information about blocks and tracks.

This builds on Derive.ParseTitle but the Derive module only has functions needed by derivation, and doesn't run in the State monad.

Synopsis

track info

data Track Source #

Constructors

Track 

Instances

Instances details
Eq Track # 
Instance details

Defined in Cmd.Info

Methods

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

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

Show Track # 
Instance details

Defined in Cmd.Info

Methods

showsPrec :: Int -> Track -> ShowS #

show :: Track -> String #

showList :: [Track] -> ShowS #

data TrackType Source #

Constructors

Note [Ui.TrackInfo] [Ui.TrackInfo]

A note track has a list of control tracks, and a list of child note tracks. The controls start with the children and continues with its parents. However, it stops at another note track or as soon as a parent has more than one child, because that control track doesn't belong to just this note track.

Pitch (Maybe Ui.TrackInfo)

The note track for this pitch track.

Control [Ui.TrackInfo]

Tracks this control track has scope over. This means all its children, but because of inversion, also a parent note track, if there is one.

Instances

Instances details
Eq TrackType # 
Instance details

Defined in Cmd.Info

Show TrackType # 
Instance details

Defined in Cmd.Info

Pretty.Pretty TrackType # 
Instance details

Defined in Cmd.Info

block_tracks :: Ui.M m => BlockId -> m [Track] Source #

Get all the Tracks in a block, sorted by tracknum.

specialized lookups

pitch_of_note :: Ui.M m => BlockId -> TrackNum -> m (Maybe Ui.TrackInfo) Source #

Pitch track of a note track, if any.

note_of_pitch :: Ui.M m => BlockId -> TrackNum -> m (Maybe Ui.TrackInfo) Source #

Note track of a pitch track, if any.

has_note_children :: Ui.M m => BlockId -> TrackNum -> m Bool Source #

True if this has any note track children. It should be the same as get_track_type then match Track _ children | not (null children), but more efficient.

misc

get_instrument_of :: Cmd.M m => BlockId -> TrackNum -> m ScoreT.Instrument Source #

Get the instrument of a track, or fail if it's not a note track. This is different than Perf.lookup_instrument because it looks at the track title first. This is useful for new tracks which don't have a performance yet. But if the track title doesn't specify an instrument it falls back on Perf.lookup_instrument.

get_default_instrument :: Cmd.M m => BlockId -> TrackId -> ScoreT.Instrument -> m ScoreT.Instrument Source #

If the instrument is ScoreT.empty_instrument, look up what it really is in the performance.

inst info

show_addrs :: [Patch.Addr] -> Text Source #

Looks like: "wdev1 [1..3]; wdev2 [1,5]"

This adds 1 so MIDI channels are 1-based.

show_runs :: (Show a, Num a, Ord a) => [a] -> [Text] Source #

set_instrument_status

set_instrument_status :: Cmd.M m => BlockId -> TrackNum -> m () Source #

Stick some handy info about the current instrument into the status.

This should be run whenever the track focus changes, or tracks are expanded or collapsed.

get_track_status :: Cmd.M m => BlockId -> TrackNum -> m (Maybe Text) Source #

Looks like: title (tracknum): inst_name, allocation, [control tracks] fm8/inst1 at 1: fm8:0,1,2, [vel {collapse 2}, pedal {expand 3}]

find_note_track :: TrackTree.TrackTree -> TrackNum -> Maybe (Ui.TrackInfo, ScoreT.Instrument) Source #

Given a tracknum, find the note track associated with it. Since there may be multiple ones, pick the first one. First try children, then parents.

control_tracks_of :: TrackTree.TrackTree -> TrackNum -> [Ui.TrackInfo] Source #

Get the controls associated with the given track. This means all children until the next note track, and all parents with only one child until the next note track. Parents with multiple children are not associated with a single track, so they're omitted. Tempo tracks are always omitted.

show_track_status :: Ui.M m => BlockId -> [Ui.TrackInfo] -> m [String] Source #

Looks like: [vel {collapse 2}, pedal {expand 3}]

paths_of Source #

Arguments

:: TrackTree.TrackTree 
-> TrackNum 
-> Maybe (Ui.TrackInfo, [Ui.TrackInfo], [Ui.TrackInfo])

(track, parents, children)