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

Cmd.NoteEntry

Description

This module implements kbd entry by intercepting kbd and MIDI events and re-emitting them as InputNotes. These then go to the track-specific edit cmds to enter notes and to Cmd.MidiThru which re-emits them as MIDI.

Synopsis

# with_note

cmds_with_input :: Cmd.M m => Bool -> Maybe.Maybe Patch.Config -> [Msg.Msg -> m Cmd.Status] -> Msg.Msg -> m Cmd.Status Source #

Take a Key (if kbd_entry is True) or a ReadMessage to a Msg.InputNote and pass it to each of cmds. As a minor optimization, cmd is not called if no InputNote was produced.

For the ASCII keyboard, the two rows of keys each map one octave of C to C. If the instrument responds to breath control, the key will also emit a breath control CC.

It's a little less graceful than calling it many times applied to a single cmd, but only has to convert the input once and doesn't need tricks to make sure a converted key winds up with Done.

Another way to do this would be place this as a transformer at the front of the responder, to transform keystrokes and MIDI keys into InputNotes. That way, other Cmds don't have to worry about state_kbd_entry. However, it would either require a privileged position for the transformer, or an additional Cmd feature to re-emits a new Msg. In addition, it would preclude the ability to shadow it and catch MIDI msgs for other purposes.

run_cmds_with_input :: Cmd.M m => [Msg.Msg -> m Cmd.Status] -> Msg.Msg -> m Cmd.Status Source #

Like cmds_with_input, but figure out kbd_entry and patch on my own.

Convert a Msg to Msg.InputNotes, if applicable. Returns Nothing if the Msg is not convertible to InputNotes (and therefore other cmds should get it), and Just [] if it is but didn't emit any InputNotes (and therefore this other cmds shouldn't get it).

## kbd

Arguments

 :: Bool Whether this is a Pressure instrument or not. Pressure instruments respond to breath, and a kbd entry note on will emit an extra breath control. This is convenient in practice because kbd entry is for quick and easy input and breath control gets in the way of that. -> Pitch.Octave -> Msg.Msg -> Maybe.Maybe [Msg.Msg]

Convert a keyboard key-down to a Msg.InputNote.

Nothing means there's no input, Just [] means there was input, but nothing to do.

## midi

midi_input :: Cmd.M m => Msg.Msg -> m (Maybe.Maybe [Msg.Msg]) Source #

Convert a Msg.Midi msg into a Msg.InputNote.