alsa-seq-0.5.1.1: Binding to the ALSA Library API (MIDI sequencer).

Stabilityprovisional
MaintainerHenning Thielemann
Safe HaskellNone

Sound.ALSA.Sequencer

Contents

Description

Overview: http://www.alsa-project.org/alsa-doc/alsa-lib/seq.html

WARNING: This whole library does not seem to be particlarly thread aware. Perhaps place the sequencer handle in an MVar?

Synopsis

Sequencer

data T mode Source

The type of sequencer handles.

Instances

Eq (T mode) 

class OpenMode mode Source

Read/Write permissions for the sequencer device. This way we prevent the ALSA exception 22 Invalid argument when calling event_output on an input-only sequencer.

data BlockMode Source

Blocking behavior of the sequencer device.

Constructors

Block

Operations may block.

Nonblock

Throw exceptions instead of blocking.

openSource

Arguments

:: OpenMode mode 
=> String

The sequencer's "name". This is not a name that you make up for your own purposes; it has special significance to the ALSA library. Usually you need to pass default_name here.

-> BlockMode 
-> IO (T mode) 

Creates a new handle and opens a connection to the kernel sequencer interface. After a client is created successfully, a ClientStart event is broadcast to the announce port. May throw an exception. See also: open_lconf, close, get_seq_type, get_seq_name, set_blocking, get_client_id.

closeSource

Arguments

:: T mode

handle to the sequencer

-> IO () 

Close the sequencer. Closes the sequencer client and releases its resources. After a client is closed, an event with ClientExit is broadcast to announce port. The connection between other clients are disconnected. Call this just before exiting your program. NOTE: we could put this in a finalizer for the handle?

withSource

Arguments

:: OpenMode mode 
=> String

The sequencer's "name". This is not a name that you make up for your own purposes; it has special significance to the ALSA library. Usually you need to pass default_name here.

-> BlockMode 
-> (T mode -> IO a) 
-> IO a 

defaultName :: StringSource

This is the name that should be passed to open in most cases.

getNameSource

Arguments

:: T mode

sequencer handle

-> IO String

ALSA identifier for the handel

Get identifier of a sequencer handle. It is the same identifier specified in the call to open.

setBlockingSource

Arguments

:: T mode

sequencer handle

-> BlockMode

blocking mode

-> IO () 

Change the blocking mode of the given client. In block mode, the client falls into sleep when it fills the output pool with events, or when it demands events from an empty input pool. memory pool with full events. Clients that are sleeping due to loack of space in the output pool are woken when a certain amount of free space becomes available (see set_output_room).

Manage user-space buffers

getOutputBufferSizeSource

Arguments

:: T mode

Sequencer handle.

-> IO Word

Size of output buffer in bytes.

Return the byte size of the output buffer.

setOutputBufferSizeSource

Arguments

:: T mode

Sequencer handle.

-> Word

New buffer size in bytes.

-> IO () 

Resize of the output buffer. This function clears all output events (see drop_output).

getInputBufferSizeSource

Arguments

:: T mode

Sequencer handle.

-> IO Word

Size of input buffer in bytes.

Return the byte size of input buffer.

setInputBufferSizeSource

Arguments

:: T mode

Sequencer handle.

-> Word

New byffer size in bytes.

-> IO () 

Resize the input buffer. This function clears all input events (see drop_input).

Manage kernel-space memory pools

setPoolOutputSource

Arguments

:: T mode

Sequencer handle.

-> Word

New size in bytes.

-> IO () 

Resize the output memory pool.

setPoolOutputRoomSource

Arguments

:: T mode

Sequencer handle.

-> Word

Number of bytes need to wake up.

-> IO () 

Specify how much space should become free before waking clients that are blocked due to a lack of space in the output pool.

resetPoolOutputSource

Arguments

:: T mode

Sequencer handle.

-> IO () 

Reset the output pool.

setPoolInputSource

Arguments

:: T mode

Sequencer handle.

-> Word

New size in bytes.

-> IO () 

Resize the input memory pool.

resetPoolInputSource

Arguments

:: T mode

Sequencer handle.

-> IO () 

Reset the input pool.

Connections

connectFrom :: AllowInput mode => T mode -> T -> T -> IO ()Source

Simple subscription (w/o exclusive & time conversion).

connectTo :: AllowOutput mode => T mode -> T -> T -> IO ()Source

Simple subscription (w/o exclusive & time conversion).

disconnectFrom :: AllowInput mode => T mode -> T -> T -> IO ()Source

Simple disconnection.

disconnectTo :: AllowOutput mode => T mode -> T -> T -> IO ()Source

Simple disconnection.