- createClient :: OpenMode -> String -> IO Client
- deleteClient :: Client -> IO ()
- createInputPort :: Client -> String -> IO Port
- createOutputPort :: Client -> String -> IO Port
- withEvents :: String -> String -> ([Event] -> IO a) -> IO a
- receiveEvent :: Client -> IO (Maybe Event)
- sendPlainEvent :: Client -> Event -> IO ()
- drainOutput :: Client -> IO ()
- initQueueTempo :: Client -> Queue -> Int -> Int -> IO ()
- withNamedQueue :: Client -> String -> (Queue -> IO a) -> IO a
- portAddress :: Client -> Port -> Address
- numAddress :: Integer -> Integer -> Address
- numAddressEither :: Integer -> Integer -> Either String Address
- data Client
- newtype Port = Port CUInt
- eventToChannelMsg :: Event -> Maybe T
- eventFromChannelMsg :: T -> (EventType, EventDataUnion)
- eventFromMetaEvent :: Queue -> T -> (EventType, EventDataUnion)
Documentation
deleteClient :: Client -> IO ()Source
withEvents :: String -> String -> ([Event] -> IO a) -> IO aSource
Process MIDI events from ALSA in a lazy manner. The processing function must be strict, in order to let the cleanup take place after abandoning the process.
drainOutput :: Client -> IO ()Source
Strangly ALSA returns error code 2 (No such file or directory) if the destination port does not exist.
portAddress :: Client -> Port -> AddressSource
numAddress :: Integer -> Integer -> AddressSource
eventToChannelMsg :: Event -> Maybe TSource
This function checks whether the ALSA sequencer message is a MIDI channel message and converts to the corresponding data structure.
Note that ALSA sequencer events contain MIDI realtime messages,
MIDI file events and additional events.
We do not want to define yet another data structure
additionally to Event
and the message types from the midi package.
Instead, because we believe,
that most of the time you cope with certain types of events in bundles,
we provide functions that allow easy access to these types.
Currently we provide only access to MIDI channel messages
but that can be easily extended.
Multiple handlers of certain event types can be composed using Control.Monad.mplus
.
NoteOn events with zero velocity are not automatically converted to NoteOff events,
this can be done with the Sound.MIDI.Message.Channel.Voice.explicitNoteOff
function.
eventFromMetaEvent :: Queue -> T -> (EventType, EventDataUnion)Source