Safe Haskell | Safe-Inferred |
---|
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
- data Track = Track {}
- data TrackType
- = Note [Ui.TrackInfo] [Ui.TrackInfo]
- | Pitch (Maybe Ui.TrackInfo)
- | Control [Ui.TrackInfo]
- get_track_type :: Ui.M m => BlockId -> TrackNum -> m Track
- lookup_track_type :: Ui.M m => BlockId -> TrackNum -> m (Maybe Track)
- block_tracks :: Ui.M m => BlockId -> m [Track]
- make_track :: (Tree.Tree Ui.TrackInfo, TrackTree.TrackTree) -> Track
- track_type_of :: (Tree.Tree Ui.TrackInfo, TrackTree.TrackTree) -> TrackType
- pitch_of_note :: Ui.M m => BlockId -> TrackNum -> m (Maybe Ui.TrackInfo)
- note_of_pitch :: Ui.M m => BlockId -> TrackNum -> m (Maybe Ui.TrackInfo)
- has_note_children :: Ui.M m => BlockId -> TrackNum -> m Bool
- get_instrument_of :: Cmd.M m => BlockId -> TrackNum -> m ScoreT.Instrument
- lookup_instrument_of :: Cmd.M m => BlockId -> TrackNum -> m (Maybe ScoreT.Instrument)
- get_default_instrument :: Cmd.M m => BlockId -> TrackId -> ScoreT.Instrument -> m ScoreT.Instrument
- show_addrs :: [Patch.Addr] -> Text
- semicolon_list :: [Text] -> Text
- show_runs :: (Show a, Num a, Ord a) => [a] -> [Text]
- set_instrument_status :: Cmd.M m => BlockId -> TrackNum -> m ()
- get_track_status :: Cmd.M m => BlockId -> TrackNum -> m (Maybe Text)
- find_note_track :: TrackTree.TrackTree -> TrackNum -> Maybe (Ui.TrackInfo, ScoreT.Instrument)
- control_tracks_of :: TrackTree.TrackTree -> TrackNum -> [Ui.TrackInfo]
- show_track_status :: Ui.M m => BlockId -> [Ui.TrackInfo] -> m [String]
- paths_of :: TrackTree.TrackTree -> TrackNum -> Maybe (Ui.TrackInfo, [Ui.TrackInfo], [Ui.TrackInfo])
track info
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. |
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
.
lookup_instrument_of :: Cmd.M m => BlockId -> TrackNum -> m (Maybe ScoreT.Instrument) Source #
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.
semicolon_list :: [Text] -> 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}]
:: TrackTree.TrackTree | |
-> TrackNum | |
-> Maybe (Ui.TrackInfo, [Ui.TrackInfo], [Ui.TrackInfo]) | (track, parents, children) |