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

Copyright(c) Henning Thielemann, 2010 (c) Iavor S. Diatchki, 2007
LicenseBSD3
MaintainerHenning Thielemann
Stabilityprovisional
Safe HaskellSafe
LanguageHaskell2010

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

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.

Minimal complete definition

expOpenMode

data BlockMode Source

Blocking behavior of the sequencer device.

Constructors

Block

Operations may block.

Nonblock

Throw exceptions instead of blocking.

open Source

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 defaultName here or simply use openDefault.

-> BlockMode

Blocking behavior

-> IO (T mode)

Handle to the sequencer.

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.

openDefault Source

Arguments

:: OpenMode mode 
=> BlockMode

Blocking behavior

-> IO (T mode)

Handle to the sequencer.

close Source

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?

with Source

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 defaultName here or simply use withDefault.

-> BlockMode

Blocking behavior

-> (T mode -> IO a)

Action on the sequencer, the result must be computed strictly.

-> IO a 

withDefault :: OpenMode mode => BlockMode -> (T mode -> IO a) -> IO a Source

defaultName :: String Source

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

getName Source

Arguments

:: T mode

sequencer handle

-> IO String

ALSA identifier for the handle

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

setBlocking Source

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

getOutputBufferSize Source

Arguments

:: T mode

Sequencer handle.

-> IO Word

Size of output buffer in bytes.

Return the byte size of the output buffer.

setOutputBufferSize Source

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

getInputBufferSize Source

Arguments

:: T mode

Sequencer handle.

-> IO Word

Size of input buffer in bytes.

Return the byte size of input buffer.

setInputBufferSize Source

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

setPoolOutput Source

Arguments

:: T mode

Sequencer handle.

-> Word

New size in bytes.

-> IO () 

Resize the output memory pool.

setPoolOutputRoom Source

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.

resetPoolOutput Source

Arguments

:: T mode

Sequencer handle.

-> IO () 

Reset the output pool.

setPoolInput Source

Arguments

:: T mode

Sequencer handle.

-> Word

New size in bytes.

-> IO () 

Resize the input memory pool.

resetPoolInput Source

Arguments

:: T mode

Sequencer handle.

-> IO () 

Reset the input pool.