Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Interface to RtMidi
Synopsis
- data Device
- data Error = Error ErrorType String
- data ErrorType
- data Api
- ready :: Device -> IO Bool
- reportError :: Device -> ErrorType -> String -> IO ()
- compiledApis :: IO [Api]
- openPort :: Device -> Int -> String -> IO ()
- openVirtualPort :: Device -> String -> IO ()
- closePort :: Device -> IO ()
- portCount :: Device -> IO Int
- portName :: Device -> Int -> IO String
- defaultInput :: IO Device
- createInput :: Api -> String -> Int -> IO Device
- setCallback :: Device -> (CDouble -> [CUChar] -> IO ()) -> IO ()
- setCallbackWithUserData :: Device -> (CDouble -> [CUChar] -> Ptr () -> IO ()) -> Ptr () -> IO ()
- cancelCallback :: Device -> IO ()
- ignoreTypes :: Device -> Bool -> Bool -> Bool -> IO ()
- getMessage :: Device -> IO ([CUChar], Double)
- defaultOutput :: IO Device
- createOutput :: Api -> String -> IO Device
- sendMessage :: Device -> [CUChar] -> IO ()
- closeInput :: Device -> IO ()
- closeOutput :: Device -> IO ()
- currentApi :: Device -> IO Api
Documentation
Warning | |
DebugWarning | |
UnspecifiedError | |
NoDevicesFound | |
InvalidDevice | |
MemoryError | |
InvalidParameter | |
InvalidUse | |
DriverError | |
SystemError | |
ThreadError |
Instances
Enum ErrorType Source # | |
Defined in Sound.RtMidi succ :: ErrorType -> ErrorType # pred :: ErrorType -> ErrorType # fromEnum :: ErrorType -> Int # enumFrom :: ErrorType -> [ErrorType] # enumFromThen :: ErrorType -> ErrorType -> [ErrorType] # enumFromTo :: ErrorType -> ErrorType -> [ErrorType] # enumFromThenTo :: ErrorType -> ErrorType -> ErrorType -> [ErrorType] # | |
Eq ErrorType Source # | |
Show ErrorType Source # | |
Open a MIDI connection
openVirtualPort :: Device -> String -> IO () Source #
This function creates a virtual MIDI output port to which other software applications can connect.
This type of functionality is currently only supported by the Macintosh OS X, Linux ALSA and JACK APIs (the function does nothing with the other APIs).
portName :: Device -> Int -> IO String Source #
Return a string identifier for the specified MIDI port number.
An empty string is returned if an invalid port specifier is provided.
Create a new Device
to use for input.
:: Device | |
-> (CDouble -> [CUChar] -> IO ()) | Function that takes a timestamp and a MIDI message as arguments |
-> IO () |
Set a callback function to be invoked for incoming MIDI messages.
The callback function will be called whenever an incoming MIDI message is received. While not absolutely necessary, it is best to set the callback function before opening a MIDI port to avoid leaving some messages in the queue.
setCallbackWithUserData :: Device -> (CDouble -> [CUChar] -> Ptr () -> IO ()) -> Ptr () -> IO () Source #
See setCallback
.
Additionally a 'Ptr ()' is passed to the callback function whenever it is called.
cancelCallback :: Device -> IO () Source #
Cancel use of the current callback function (if one exists).
Subsequent incoming MIDI messages will be written to the queue and can be retrieved with the getMessage
function.
Specify whether certain MIDI message types should be queued or ignored during input.
By default, MIDI timing and active sensing messages are ignored during message input because of their
relative high data rates. MIDI sysex messages are ignored by default as well.
Variable values of true
imply that the respective message type will be ignored.
getMessage :: Device -> IO ([CUChar], Double) Source #
Return data bytes for the next available MIDI message in the input queue and the event delta-time in seconds.
This function returns immediately whether a new message is available or not. A valid message is indicated by whether the list contains any elements.
Create a new Device
to use for output.
sendMessage :: Device -> [CUChar] -> IO () Source #
Immediately send a single message out an open MIDI output port.
closeInput :: Device -> IO () Source #
If a MIDI connection is still open, it will be closed
closeOutput :: Device -> IO () Source #
Close any open MIDI connections