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

Safe HaskellNone




Cmds to deal with Cmd.Performance, derivation, and performance.




controls :: Cmd.M m => Bool -> m ControlMap Source #

Controls in scope at the insert point.

control_vals :: Cmd.M m => Bool -> m Score.ControlValMap Source #

The control vals at the insertion point, taking the control functions into account.

raw_control_vals :: Cmd.M m => Bool -> m Score.TypedControlValMap Source #

Like control_vals, but without control functions.


inst_controls :: Cmd.M m => BlockId -> m (Map Score.Instrument ControlVals) Source #

Get the first and last values for each instrument. This can be used to show which controls the each instrument uses, which in turn can be used to set its config_controls, to make sure it is always initialized consistently.


rederive :: Cmd.CmdT IO () Source #

Clear out all caches and rederive from scratch.


block_events :: Cmd.M m => BlockId -> m [LEvent.LEvent Score.Event] Source #

Get this block's performance from the cache.

block_events_unnormalized :: Cmd.M m => BlockId -> m [LEvent.LEvent Score.Event] Source #

normalize_events is important for display, but I can't do it if I'm going to pass to convert, because convert should do the normalization itself.

normalize_events :: [LEvent.LEvent Score.Event] -> [LEvent.LEvent Score.Event] Source #

Apply Score.normalize to the events, so that they have their final control positions and pitches. Normally convert does this, but if you display it before convert it's nice to see the "cooked" versions.

block_midi_events :: Cmd.M m => BlockId -> m [LEvent.LEvent Types.Event] Source #

Get block_events from the cache and convert to MIDI performer events.

block_midi :: Cmd.M m => BlockId -> m Perform.MidiEvents Source #

Derive all the way to MIDI. This uses the cache.


sel_events :: Cmd.M m => m [Score.Event] Source #

Derive the current block from the cache and return events that fall within the current selection.

root_sel_events :: Cmd.M m => m [Score.Event] Source #

Like sel_events but take the root derivation.


extract_insts :: Cmd.M m => BlockId -> Text -> [Text] -> m [(Text, [Score.Event])] Source #

Get logged events with the given tag and instruments.

extract_debug Source #


:: Cmd.M m 
=> BlockId 
-> Text 
-> m [(Text, [Score.Event])]

logged events by the stack where they were logged

Extract events logged via the debug call.

e :: [Fmt] -> [Score.Event] -> Text Source #

Pretty-print events, presumably from sel_events. Extract the given fields, and format them in columns.

There are a set of e_* functions designed for this. E.g.

LPerf.sel_events $> LPerf.e [LPerf.e_sp, LPerf.e_attr]

play from


get_sel_events Source #


:: Cmd.M m 
=> Bool

from root

-> (BlockId -> m (Events Score.Event)) 
-> m [Score.Event] 

Like get_sel_events_logs, but filter out the LEvent.Logs.

get_sel_events_logs Source #


:: Cmd.M m 
=> Bool

from root

-> (BlockId -> m (Events Score.Event))

derive events in the given block, e.g. via block_events or block_events_unnormalized

-> m (Events Score.Event) 

Get events derived in the selected range.

get_sel Source #


:: Cmd.M m 
=> (d -> RealTime) 
-> (d -> Stack.Stack) 
-> Bool

from root

-> (BlockId -> m (Events d)) 
-> m (Events d) 

in_tracks :: (d -> Stack.Stack) -> [TrackId] -> Events d -> Events d Source #

in_score_range :: (a -> Stack.Stack) -> [BlockId] -> [TrackId] -> ScoreTime -> ScoreTime -> [LEvent.LEvent a] -> [LEvent.LEvent a] Source #

Like in_range, but use the stack to check for ScoreTime range.


midi_event_inst :: Types.Event -> Text Source #

Filter on events with a certain instrument.


sel_midi :: Cmd.M m => m Perform.MidiEvents Source #

This is the local block's performance, and the events are filtered to the selection range, and the filtering is done post-derivation, so they reflect what would actually be played. I can't filter by selected track because MIDI events don't retain the stack.

logs_like :: Cmd.M m => BlockId -> String -> m [Log.Msg] Source #

Get all logs whose Log.msg_text matches a regex.

logs_matching :: Cmd.M m => BlockId -> BlockId -> [TrackId] -> TrackTime -> TrackTime -> m [Log.Msg] Source #

Get logs that include a stack frame that matches the given block, tracks, and range.


simple_midi :: [Midi.WriteMessage] -> [(RealTime, Midi.Message)] Source #

Reduce MIDI to an easier to read form.

cache contents


chord :: Cmd.M m => m Text Source #

Show chord ratios at current selection.

chord_at :: Cmd.M m => BlockId -> Maybe TrackId -> ScoreTime -> m [(Pitch.NoteNumber, Pitch.Note, Ratio)] Source #

Show the ratios of the frequencies of the notes at the time of the current selection. They are sorted by their track-order, and the track with the selection is considered unity.

sort_by_track :: Ui.M m => BlockId -> [Score.Event] -> m [Score.Event] Source #

Sort events by the tracknum of the tracks they fall on. Filter out events that don't directly originate from a track on the given block.

TODO I should look for the block anywhere in the stack, and sort it by the corresponding track.