-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Binding to the OS level Midi services (fork of system-midi).
--
-- Cross-platform binding to Midi libraries. Supports OS X and Windows
-- (limited testing). The API use the same represeentation as Codec.Midi
-- so system and file I/O have the same interface. This package was based
-- on the system-midi package.
@package hamid
@version 0.10
-- | A lowest common denominator interface to the Win32 and MacOSX Midi
-- bindings. Error handling is via fail-s in the IO monad.
module System.Midi
type MidiTime = Word32
type MidiMessage = Message
type MidiEvent = (MidiTime, Message)
class MidiHasName a
name :: MidiHasName a => a -> IO String
-- | The opaque data type representing a Midi source.
data Source
-- | Enumerates the Midi sources present in the system.
sources :: IO [Source]
-- | The opaque data type representing a Midi destination.
data Destination
-- | Enumerates the Midi destinations present in the system.
destinations :: IO [Destination]
-- | Opens a Midi Source. There are two possibilites to receive Midi
-- messages. The user can either support a callback function, or get the
-- messages from an asynchronous buffer. However, mixing the two
-- approaches is not allowed.
openSource :: Source -> Maybe (MidiTime -> Message -> IO ()) -> IO Stream
-- | Opens a Midi Destination.
openDestination :: Destination -> IO Stream
-- | The opaque data type representing a Midi connection.
data Stream
-- | Closes a Midi Stream.
close :: Stream -> IO ()
-- | Starts a connection. This is required for receiving Midi messages, and
-- also for starting the clock.
start :: Stream -> IO ()
-- | Stops a connection.
stop :: Stream -> IO ()
-- | Sends a short message. The connection must be a Destination.
send :: Stream -> Message -> IO ()
-- | Gets the next event from a buffered connection (see also
-- openSource)
getNextEvent :: Stream -> IO (Maybe MidiEvent)
-- | Gets all the events from the buffer (see also openSource)
getEvents :: Stream -> IO [MidiEvent]
-- | Returns the time elapsed since the last start call, in
-- milisecs.
currentTime :: Stream -> IO MidiTime
instance Eq Source
instance Eq Destination
instance Show Destination
instance Show Source
instance MidiHasName Destination
instance MidiHasName Source