Safe Haskell | Safe-Inferred |
---|
Utilities to modify events in tracks.
Synopsis
- type Tracks m = BlockId -> [(TrackId, [Event.Event])] -> m [(TrackId, [Event.Event])]
- type Track m = BlockId -> TrackId -> [Event.Event] -> m (Maybe [Event.Event])
- track :: Monad m => Track m -> Tracks m
- events :: Monad m => ([Event.Event] -> m [Event.Event]) -> Track m
- event :: Monad m => (Event.Event -> Event.Event) -> Track m
- text :: Monad m => (Text -> Text) -> Track m
- pipeline :: ([[Text]] -> [[Text]]) -> Text -> Text
- failable_text :: Cmd.M m => (Text -> Either.Either Text Text) -> Track m
- selection_tracks :: Cmd.M m => Tracks m -> m ()
- selection :: Cmd.M m => Track m -> m ()
- selection_visible :: Cmd.M m => Track m -> m ()
- ctx_selection_visible :: Ui.M m => Track m -> Selection.Context -> m ()
- selected_track :: Cmd.M m => Track m -> m ()
- data Collapsed
- modify_selected :: Cmd.M m => Collapsed -> Tracks m -> Selection.SelectedEvents -> m ()
- modify_selected_block :: Ui.M m => Collapsed -> Tracks m -> BlockId -> Selection.SelectedEvents -> m ()
- advance_if_point :: Cmd.M m => m ()
- overlapping :: Cmd.M m => Track m -> m ()
- tracks_named :: Cmd.M m => (Text -> Bool) -> Track m -> Track m
- selected_note :: Cmd.M m => Track m -> m ()
- selected_control :: Cmd.M m => Track m -> m ()
- selected_pitch :: Cmd.M m => Track m -> m ()
- block :: Cmd.M m => BlockId -> Track m -> m ()
- all_blocks :: Cmd.M m => Track m -> m ()
- all_tracks_named :: Cmd.M m => (Text -> Bool) -> Track m -> m ()
- note_tracks :: Cmd.M m => Track m -> m ()
- control_tracks :: Cmd.M m => Track m -> m ()
- pitch_tracks :: Cmd.M m => Track m -> m ()
- move_track_events :: Ui.M m => ScoreTime -> ScoreTime -> ScoreTime -> TrackId -> m ()
- move_events :: ScoreTime -> ScoreTime -> ScoreTime -> Events.Events -> Events.Events
- data Replacement
- substitute :: Parser -> [Replacement] -> Text -> Either.Either Text Text
- newtype Parser = Parser ([Token] -> [([Match], [Token])])
- type Token = Text
- type Match = [Token]
- parse_tokens :: Parser -> Text -> Maybe [Text]
- parse :: Parser -> [Token] -> [[Match]]
- literal :: Text -> Parser
- w :: Parser
- ws :: Parser
- ws1 :: Parser
- splits :: [a] -> [([a], [a])]
Documentation
type Tracks m = BlockId -> [(TrackId, [Event.Event])] -> m [(TrackId, [Event.Event])] Source #
Map a function over multiple tracks. It has access to all selected events. Omit a TrackId from the output to leave it unchanged.
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.
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_tracks :: Cmd.M m => Tracks m -> m () Source #
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.
ctx_selection_visible :: Ui.M m => Track m -> Selection.Context -> m () Source #
selected_track :: Cmd.M m => Track m -> m () Source #
Like selection
, but only operate on the point_track
.
Instances
modify_selected :: Cmd.M m => Collapsed -> Tracks m -> Selection.SelectedEvents -> m () Source #
modify_selected_block :: Ui.M m => Collapsed -> Tracks m -> BlockId -> Selection.SelectedEvents -> m () Source #
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 #
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
.
:: 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
data Replacement Source #
Instances
String.IsString Replacement Source # | |
Defined in Cmd.ModifyEvents fromString :: String.String -> Replacement # | |
Show Replacement Source # | |
Defined in Cmd.ModifyEvents showsPrec :: Int -> Replacement -> ShowS # show :: Replacement -> String.String # showList :: [Replacement] -> ShowS # | |
Eq Replacement Source # | |
Defined in Cmd.ModifyEvents (==) :: Replacement -> Replacement -> Bool # (/=) :: Replacement -> Replacement -> Bool # |
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
Yet another "list of successes" style parser.
Instances
String.IsString Parser Source # | |
Defined in Cmd.ModifyEvents fromString :: String.String -> Parser # | |
Monoid Parser Source # | |
Semigroup Parser Source # | |