RtMidi-0.1.1.0

Safe HaskellSafe
LanguageHaskell2010

Sound.RtMidi

Description

Interface to RtMidi

Synopsis

Documentation

data Error Source #

Constructors

Error ErrorType String 

data Api Source #

Instances
Enum Api Source # 
Instance details

Defined in Sound.RtMidi

Methods

succ :: Api -> Api #

pred :: Api -> Api #

toEnum :: Int -> Api #

fromEnum :: Api -> Int #

enumFrom :: Api -> [Api] #

enumFromThen :: Api -> Api -> [Api] #

enumFromTo :: Api -> Api -> [Api] #

enumFromThenTo :: Api -> Api -> Api -> [Api] #

Eq Api Source # 
Instance details

Defined in Sound.RtMidi

Methods

(==) :: Api -> Api -> Bool #

(/=) :: Api -> Api -> Bool #

Show Api Source # 
Instance details

Defined in Sound.RtMidi

Methods

showsPrec :: Int -> Api -> ShowS #

show :: Api -> String #

showList :: [Api] -> ShowS #

ready :: Device -> IO Bool Source #

Check if a device is ok

compiledApis :: IO [Api] Source #

A static function to determine MIDI Apis built in.

openPort Source #

Arguments

:: Device 
-> Int

port number

-> String

name for the application port that is used

-> IO () 

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).

closePort :: Device -> IO () Source #

Close an open MIDI connection (if one exists).

portCount :: Device -> IO Int Source #

Return the number of MIDI ports available to the Device.

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.

defaultInput :: IO Device Source #

Default constructor for a Device to use for input.

createInput Source #

Arguments

:: Api

API to use

-> String

client name

-> Int

size of the MIDI input queue

-> IO Device 

Create a new Device to use for input.

setCallback Source #

Arguments

:: 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.

ignoreTypes Source #

Arguments

:: Device 
-> Bool

SysEx messages

-> Bool

Time messages

-> Bool

Sense messages

-> IO () 

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.

defaultOutput :: IO Device Source #

Default constructor for a Device to use for output.

createOutput Source #

Arguments

:: Api

API to use

-> String

client name

-> IO Device 

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

currentApi :: Device -> IO Api Source #

Returns the specifier for the MIDI Api in use