Safe Haskell | Safe-Inferred |
---|
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
- cmds_with_input :: Cmd.M m => Bool -> Maybe.Maybe Patch.Config -> [Msg.Msg -> m Cmd.Status] -> Msg.Msg -> m Cmd.Status
- run_cmds_with_input :: Cmd.M m => [Msg.Msg -> m Cmd.Status] -> Msg.Msg -> m Cmd.Status
- msg_to_inputs :: Cmd.M m => Bool -> Maybe.Maybe Patch.Config -> Msg.Msg -> m (Maybe.Maybe [InputNote.Input])
- are_modifiers_down :: Cmd.M m => m Bool
- kbd_input :: Bool -> Pitch.Octave -> Msg.Msg -> Maybe.Maybe [InputNote.Input]
- key_to_input :: Bool -> Pitch.Octave -> Bool -> Key.Key -> Maybe.Maybe [InputNote.Input]
- midi_input :: Cmd.M m => Msg.Msg -> m (Maybe.Maybe [InputNote.Input])
- floating_input_insert :: Cmd.M m => Msg.Msg -> m Cmd.Status
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-emit 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.
msg_to_inputs :: Cmd.M m => Bool -> Maybe.Maybe Patch.Config -> Msg.Msg -> m (Maybe.Maybe [InputNote.Input]) Source #
Convert a Msg to Msg.InputNote
s, 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).
are_modifiers_down :: Cmd.M m => m Bool Source #
kbd
:: 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 [InputNote.Input] |
Convert a keyboard key-down to a Msg.InputNote
.
Nothing
means there's no input, Just []
means there was input, but
nothing to do.
key_to_input :: Bool -> Pitch.Octave -> Bool -> Key.Key -> Maybe.Maybe [InputNote.Input] Source #
midi
midi_input :: Cmd.M m => Msg.Msg -> m (Maybe.Maybe [InputNote.Input]) Source #
Convert a Msg.Midi
msg.
floating_input_insert
floating_input_insert :: Cmd.M m => Msg.Msg -> m Cmd.Status Source #