macosx-core-0.0.0: Partial bindings to Core* libraries in Mac OS XContentsIndex
System.MacOSX.CoreMIDI
Description
Low-level (partial) binding to the CoreMIDI services present in Mac OS X. Error "handling" is via fail-s in the IO monad.
Synopsis
enumerateDevices :: IO [MIDIDeviceRef]
enumerateSources :: IO [Source]
enumerateDestinations :: IO [Destination]
class MIDIObject a => MIDIHasName a where
getName :: a -> IO String
getModel :: a -> IO String
getManufacturer :: a -> IO String
getName :: MIDIHasName a => a -> IO String
getModel :: MIDIHasName a => a -> IO String
getManufacturer :: MIDIHasName a => a -> IO String
newSource :: MIDIClientRef -> String -> IO Source
newDestination :: MIDIClientRef -> String -> IO Destination
disposeEndpoint :: Endpoint a => a -> IO ()
newClient :: String -> IO MIDIClientRef
disposeClient :: MIDIClientRef -> IO ()
newInputPort :: MIDIClientRef -> String -> FunPtr (MIDIReadProc r s) -> Ptr r -> IO MIDIPortRef
newOutputPort :: MIDIClientRef -> String -> IO MIDIPortRef
disposePort :: MIDIPortRef -> IO ()
connectToSource :: MIDIPortRef -> Source -> Ptr a -> IO ()
disconnectFromSource :: MIDIPortRef -> Source -> IO ()
midiSend :: MIDIPortRef -> Destination -> ShortMessage -> IO ()
midiSendStamped :: MIDIPortRef -> Destination -> MIDITimeStamp -> ShortMessage -> IO ()
midiSendList :: MIDIPortRef -> Destination -> [ShortMessage] -> IO ()
midiSendListStamped :: MIDIPortRef -> Destination -> MIDITimeStamp -> [ShortMessage] -> IO ()
midiSendSysEx :: Endpoint a => a -> [Word8] -> IO ()
data OpaqueMIDIClient
data OpaqueMIDIObject
data OpaqueMIDIDevice
data OpaqueMIDIEntity
data OpaqueMIDIEndpoint
data OpaqueMIDIPort
type MIDIClientRef = Ptr OpaqueMIDIClient
type MIDIObjectRef = Ptr OpaqueMIDIObject
type MIDIDeviceRef = Ptr OpaqueMIDIDevice
type MIDIEntityRef = Ptr OpaqueMIDIEntity
type MIDIEndpointRef = Ptr OpaqueMIDIEndpoint
type MIDIPortRef = Ptr OpaqueMIDIPort
type MIDITimeStamp = UInt64
type MIDIReadProc r s = Ptr MIDIPacket -> Ptr r -> Ptr s -> IO ()
mkMIDIReadProc :: MIDIReadProc () () -> IO (FunPtr (MIDIReadProc () ()))
data MIDIPacket
newtype Source = Source MIDIEndpointRef
newtype Destination = Destination MIDIEndpointRef
data ShortMessage = ShortMessage {
sm_channel :: Word8
sm_msg :: Word8
sm_byte1 :: Word8
sm_byte2 :: Word8
}
depackMIDIPacketList :: Ptr MIDIPacket -> IO [(MIDITimeStamp, [Word8])]
depackSingleMIDIPacket :: Ptr MIDIPacket -> IO (Int, MIDITimeStamp, [[Word8]])
decodeShortMessage :: [Word8] -> ShortMessage
isShortMessage :: [Word8] -> Bool
Documentation
enumerateDevices :: IO [MIDIDeviceRef]

Note: If a client iterates through the devices and entities in the system, it will not ever visit any virtual sources and destinations created by other clients. Also, a device iteration will return devices which are offline (were present in the past but are not currently present), while iterations through the system's sources and destinations will not include the endpoints of offline devices.

Thus clients should usually use enumerateSources and enumerateDestinations, rather iterating through devices and entities to locate endpoints.

enumerateSources :: IO [Source]
Enumaretes the MIDI sources present.
enumerateDestinations :: IO [Destination]
Enumaretes the MIDI destinations present.
class MIDIObject a => MIDIHasName a where
MIDI objects which can have a name, model name and manufacturer
Methods
getName :: a -> IO String
getModel :: a -> IO String
getManufacturer :: a -> IO String
show/hide Instances
getName :: MIDIHasName a => a -> IO String
getModel :: MIDIHasName a => a -> IO String
getManufacturer :: MIDIHasName a => a -> IO String
newSource :: MIDIClientRef -> String -> IO Source
Creates a new MIDI source with the given name.
newDestination :: MIDIClientRef -> String -> IO Destination
Creates a new MIDI destination with the given name.
disposeEndpoint :: Endpoint a => a -> IO ()
Disposes an existing MIDI endpoint.
newClient :: String -> IO MIDIClientRef
Creates a new MIDI client with the given name.
disposeClient :: MIDIClientRef -> IO ()
Disposes an existing MIDI client.
newInputPort :: MIDIClientRef -> String -> FunPtr (MIDIReadProc r s) -> Ptr r -> IO MIDIPortRef
Creates a new input port.
newOutputPort :: MIDIClientRef -> String -> IO MIDIPortRef
Creates a new output port.
disposePort :: MIDIPortRef -> IO ()
Disposes an existing port.
connectToSource :: MIDIPortRef -> Source -> Ptr a -> IO ()
Connects an input port to a source.
disconnectFromSource :: MIDIPortRef -> Source -> IO ()
Disconnects an input port from a source.
midiSend :: MIDIPortRef -> Destination -> ShortMessage -> IO ()
Sends a short message with timestamp now.
midiSendStamped :: MIDIPortRef -> Destination -> MIDITimeStamp -> ShortMessage -> IO ()
Sends a short message with the given timestamp.
midiSendList :: MIDIPortRef -> Destination -> [ShortMessage] -> IO ()
Sends a list of short messages with timestamp now.
midiSendListStamped :: MIDIPortRef -> Destination -> MIDITimeStamp -> [ShortMessage] -> IO ()
Sends a list of short messages with the given timestamp.
midiSendSysEx :: Endpoint a => a -> [Word8] -> IO ()
Sends a system exclusive message. You shouldn't include the starting/trailing bytes 0xF0 and 0xF7.
data OpaqueMIDIClient
data OpaqueMIDIObject
data OpaqueMIDIDevice
data OpaqueMIDIEntity
data OpaqueMIDIEndpoint
data OpaqueMIDIPort
type MIDIClientRef = Ptr OpaqueMIDIClient
type MIDIObjectRef = Ptr OpaqueMIDIObject
type MIDIDeviceRef = Ptr OpaqueMIDIDevice
type MIDIEntityRef = Ptr OpaqueMIDIEntity
type MIDIEndpointRef = Ptr OpaqueMIDIEndpoint
type MIDIPortRef = Ptr OpaqueMIDIPort
type MIDITimeStamp = UInt64
type MIDIReadProc r s = Ptr MIDIPacket -> Ptr r -> Ptr s -> IO ()
r is readProcRefCon (The refCon you passed to MIDIInputPortCreate or MIDIDestinationCreate); s is srcConnRefCon (A refCon you passed to MIDIPortConnectSource, which identifies the source of the data).
mkMIDIReadProc :: MIDIReadProc () () -> IO (FunPtr (MIDIReadProc () ()))
data MIDIPacket
newtype Source
Constructors
Source MIDIEndpointRef
show/hide Instances
newtype Destination
Constructors
Destination MIDIEndpointRef
show/hide Instances
data ShortMessage
Short message in low level format.
Constructors
ShortMessage
sm_channel :: Word8
sm_msg :: Word8
sm_byte1 :: Word8
sm_byte2 :: Word8
show/hide Instances
depackMIDIPacketList :: Ptr MIDIPacket -> IO [(MIDITimeStamp, [Word8])]
depackSingleMIDIPacket :: Ptr MIDIPacket -> IO (Int, MIDITimeStamp, [[Word8]])
decodeShortMessage :: [Word8] -> ShortMessage
isShortMessage :: [Word8] -> Bool
Produced by Haddock version 2.4.1