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

Safe HaskellNone




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.


track info

data Track Source #


Eq Track # 
Instance details

Defined in Cmd.Info


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

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

Show Track # 
Instance details

Defined in Cmd.Info


showsPrec :: Int -> Track -> ShowS #

show :: Track -> String #

showList :: [Track] -> ShowS #

data TrackType Source #


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.

Eq TrackType # 
Instance details

Defined in Cmd.Info

Show 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.


get_instrument_of :: Cmd.M m => BlockId -> TrackNum -> m Score.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 -> Score.Instrument -> m Score.Instrument Source #

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

inst info

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

Looks like: "wdev1 [0..2]; wdev2 [0,4]"

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


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, Score.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 #


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

(track, parents, children)