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

Safe HaskellNone




Cmds to add notes to a note track.

This module is sister to Derive.Note since it edits events that Derive.Note parses.

Note events are usually given a duration of the current time step. If a "trigger only" instrument (e.g. percussion) is in scope, they are created with zero duration. Also, starting a raw edit with space will create a zero duration event.


val edit

data ControlTrack Source #

A control track belonging to the note track. This can be a pitch track, or a dyn track.

cmd_val_edit :: Cmd.M m => Msg.Msg -> m Cmd.Status Source #

The val edit for note tracks edits its pitch track (possibly creating one if necessary), and creates a blank event on the note track. It may also edit multiple pitch tracks for chords, or record velocity in addition to pitch.

If I'm in chord mode, try to find the next track and put notes there. If there is no appropriate next track, the cmd will throw an error.

next_control_track Source #


:: Cmd.M m 
=> Id.BlockId 
-> TrackNum 
-> (Text -> Bool) 
-> m (ControlTrack, Bool, Maybe TrackNum)

(selected_track_pair, should_create, next_control_track)

Find the next available control track. Available means it is the given track or is to its right, has either the same instrument or has the default instrument, and doesn't already have a note_id associated with it.

If none is found, return the tracknum at which one should be created.

this_control_track :: Cmd.M m => Id.BlockId -> TrackNum -> (Text -> Bool) -> m (ControlTrack, Bool) Source #

The given track should be a note track. Figure out if it has a control track, or if one should be created.

should_create_control :: Cmd.M m => Id.BlockId -> Info.Track -> (Text -> Bool) -> m (ControlTrack, Bool) Source #

Find the ControlTrack of the given note Track. If there is none, return the tracknum where you should create one.

find_pitch_track :: Cmd.M m => InputNote.NoteId -> m (Maybe (TrackNum, Id.TrackId)) Source #

Find the pitch track associated with the given NoteId, if one exists.

method edit

cmd_method_edit :: Cmd.M m => Msg.Msg -> m Cmd.Status Source #

Method edit is redirected to the pitch track, creating one if necessary.


block_calls :: Ui.M m => Maybe Id.BlockId -> Text -> m [Id.BlockId] Source #

Try to to figure out any blocks that are referenced in the expression.

This doesn't use the full Derive.Parse machinery, but is simple and doesn't require the text to be fully parseable.

to_block_id :: Map Id.BlockId a -> Id.Namespace -> Maybe Id.BlockId -> Text -> Maybe Id.BlockId Source #

If the first word names a block, then it's probably a block call with args, so return just that. Otherwise, return any argument that names a block.


create_pitch_track :: Cmd.M m => Id.BlockId -> ControlTrack -> m () Source #

Create a pitch track.

ensure_note_event :: Cmd.M m => EditUtil.Pos -> m () Source #

Ensure that a note event exists at the given spot. An existing event is left alone, but if there is no existing event a new one will be created.

triggered_inst :: Cmd.M m => Maybe Instrument -> m Bool Source #

Instruments with the triggered flag set don't pay attention to note off, so I can make the duration 0.

get_state :: Cmd.M m => (Cmd.EditState -> a) -> m a Source #