Safe Haskell | Safe-Inferred |
---|
Common interface for the MIDI drivers.
Synopsis
- type Initialize a = String -> WantMessage -> (Either Error (RawInterface Midi.WriteMessage) -> IO a) -> IO a
- type WantMessage = ByteString.ByteString -> Bool
- type ReadChan = TChan.TChan Midi.ReadMessage
- data RawInterface write_message = Interface {
- name :: String
- read_channel :: ReadChan
- read_devices :: IO [(Midi.ReadDevice, [Midi.ReadDevice])]
- write_devices :: IO [(Midi.WriteDevice, [Midi.WriteDevice])]
- connect_read_device :: Midi.ReadDevice -> IO Bool
- disconnect_read_device :: Midi.ReadDevice -> IO Bool
- connect_write_device :: Midi.WriteDevice -> IO Bool
- write_message :: write_message -> IO (Maybe Error)
- abort :: IO ()
- now :: IO RealTime
- type Interface = RawInterface Message
- data Message
- track_interface :: RawInterface Midi.WriteMessage -> IO Interface
- reset_pitch :: RealTime -> Message
- reset_controls :: RealTime -> Message
- note_tracker :: Bool -> (Midi.WriteMessage -> IO (Maybe err)) -> IO (Message -> IO (Maybe err))
Documentation
type Initialize a Source #
= String | register this name with CoreMIDI |
-> WantMessage | |
-> (Either Error (RawInterface Midi.WriteMessage) -> IO a) | |
-> IO a |
type WantMessage = ByteString.ByteString -> Bool Source #
Read msgs that return false are filtered. This uses a raw ByteString to avoid the decode overhead for messages that will be rejected, probably in a high-priority callback. TODO I could probably make this a bitmask or something and put it down in the driver.
type ReadChan = TChan.TChan Midi.ReadMessage Source #
data RawInterface write_message Source #
Produced by an initialize
function.
Interface | |
|
Instances
Show (RawInterface a) Source # | |
Defined in Midi.Interface showsPrec :: Int -> RawInterface a -> ShowS # show :: RawInterface a -> String # showList :: [RawInterface a] -> ShowS # |
type Interface = RawInterface Message Source #
Annotate a WriteMessage with additional control messages.
Midi !Midi.WriteMessage | |
AllNotesOff !RealTime | Turn off sounding notes on all devices and channels. |
AllDevices !RealTime ![Midi.Message] | Emit the messages for all devices that have been used. This doesn't care if they have sounding notes because control state persists after NoteOff. |
reset_pitch :: RealTime -> Message Source #
reset_controls :: RealTime -> Message Source #
note_tracker :: Bool -> (Midi.WriteMessage -> IO (Maybe err)) -> IO (Message -> IO (Maybe err)) Source #
Wrap a write_message
and keep track of which notes are on. It can
then handle reset messages which need to know current state to reset it.
This is necessary because some synthesizers do not support AllNotesOff, but also relieves callers of having to track which devices and channels have active notes.