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

Safe HaskellNone

Cmd.ModifyEvents

Contents

Description

Utilities to modify events in tracks.

Synopsis

Documentation

type Track m = BlockId -> TrackId -> [Event.Event] -> m (Maybe [Event.Event]) Source #

Map a function over events on a certain track. Returning Nothing will leave the track unchanged.

events :: Monad m => ([Event.Event] -> m [Event.Event]) -> Track m Source #

Map a function over a set of events.

event :: Monad m => (Event.Event -> Event.Event) -> Track m Source #

Map a function over a single event.

text :: Monad m => (Text -> Text) -> Track m Source #

pipeline :: ([[Text]] -> [[Text]]) -> Text -> Text Source #

Split up a pipeline and lex the calls.

failable_text :: Cmd.M m => (Text -> Either.Either Text Text) -> Track m Source #

Take a text transformation that can fail to a Track transformation that transforms all the events and throws if any of the text transformations failed.

modify selections

selection :: Cmd.M m => Track m -> m () Source #

Map a function over the selected events, as per Selection.events.

selection_visible :: Cmd.M m => Track m -> m () Source #

Like selection, but don't apply to collapsed tracks. This is appropriate for operations that often apply to note tracks. If you select multiple note tracks, then the intervening collapsed pitch tracks will also be selected and if you accidentally modify those you won't see the modifications.

selected_track :: Cmd.M m => Track m -> m () Source #

Like selection, but only operate on the point_track.

modify_selected Source #

Arguments

:: Cmd.M m 
=> Bool

If False, omit collapsed tracks.

-> Track m 
-> Selection.SelectedEvents 
-> m () 

advance_if_point :: Cmd.M m => m () Source #

Advance the selection if it was a point. This is convenient for applying a transformation repeatedly.

overlapping :: Cmd.M m => Track m -> m () Source #

Map a function over the events that overlap the selection point.

tracks_named :: Cmd.M m => (Text -> Bool) -> Track m -> Track m Source #

Map over tracks whose name matches the predicate.

selected_note :: Cmd.M m => Track m -> m () Source #

selected_control :: Cmd.M m => Track m -> m () Source #

selected_pitch :: Cmd.M m => Track m -> m () Source #

block tracks

block :: Cmd.M m => BlockId -> Track m -> m () Source #

Like selection, but maps over an entire block.

all_blocks :: Cmd.M m => Track m -> m () Source #

all_tracks_named :: Cmd.M m => (Text -> Bool) -> Track m -> m () Source #

note_tracks :: Cmd.M m => Track m -> m () Source #

control_tracks :: Cmd.M m => Track m -> m () Source #

pitch_tracks :: Cmd.M m => Track m -> m () Source #

misc

move_track_events :: Ui.M m => ScoreTime -> ScoreTime -> ScoreTime -> TrackId -> m () Source #

Move everything at or after start by shift.

move_events Source #

Arguments

:: ScoreTime

events past the block end are shortened or removed

-> ScoreTime 
-> ScoreTime 
-> Events.Events 
-> Events.Events 

All events starting at and after a point to the end are shifted by the given amount.

replace tokens

substitute :: Parser -> [Replacement] -> Text -> Either.Either Text Text Source #

Regex-like substitution on tracklang tokens.

Short names and IsString instances attempt to make it concise enough for inline use. If the pattern doesn't match, the input is returned unchanged.

parser

newtype Parser Source #

Yet another "list of successes" style parser.

Constructors

Parser ([Token] -> [([Match], [Token])]) 

type Match = [Token] Source #

parse :: Parser -> [Token] -> [[Match]] Source #

literal :: Text -> Parser Source #

Match a literal token.

w :: Parser Source #

Match one token.

ws :: Parser Source #

Match 0 or more tokens.

ws1 :: Parser Source #

Match 1 or more tokens.

splits :: [a] -> [([a], [a])] Source #