alsa-0.4: Binding to the ALSA Library API.

Stabilityprovisional
MaintainerIavor S. Diatchki

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

The type of sequencer handles.

Instances

data OpenMode Source

Read/Write permissions for the sequencer device.

data BlockMode Source

Blocking behavior of the sequencer device.

Constructors

Block

Operations may block.

Nonblock

Throw exceptions instead of blocking.

openSource

Arguments

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

-> OpenMode 
-> BlockMode 
-> IO SndSeq 

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

:: SndSeq

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?

default_seq_name :: StringSource

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

get_seq_nameSource

Arguments

:: SndSeq

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.

set_blockingSource

Arguments

:: SndSeq

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

get_output_buffer_sizeSource

Arguments

:: SndSeq

Sequencer handle.

-> IO Word

Size of output buffer in bytes.

Return the byte size of the output buffer.

set_output_buffer_sizeSource

Arguments

:: SndSeq

Sequencer handle.

-> Word

New buffer size in bytes.

-> IO () 

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

get_input_buffer_sizeSource

Arguments

:: SndSeq

Sequencer handle.

-> IO Word

Size of input buffer in bytes.

Return the byte size of input buffer.

set_input_buffer_sizeSource

Arguments

:: SndSeq

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

set_pool_outputSource

Arguments

:: SndSeq

Sequencer handle.

-> Word

New size in bytes.

-> IO () 

Resize the output memory pool.

set_pool_output_roomSource

Arguments

:: SndSeq

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.

reset_pool_outputSource

Arguments

:: SndSeq

Sequencer handle.

-> IO () 

Reset the output pool.

set_pool_inputSource

Arguments

:: SndSeq

Sequencer handle.

-> Word

New size in bytes.

-> IO () 

Resize the input memory pool.

reset_pool_inputSource

Arguments

:: SndSeq

Sequencer handle.

-> IO () 

Reset the input pool.

Queue Interface

Client Interface

Port Interface

Connections

connect_from :: SndSeq -> Port -> Addr -> IO ()Source

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

connect_to :: SndSeq -> Port -> Addr -> IO ()Source

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

disconnect_from :: SndSeq -> Port -> Addr -> IO ()Source

Simple disconnection.

disconnect_to :: SndSeq -> Port -> Addr -> IO ()Source

Simple disconnection.

Events

volume_same :: Int16Source

Used for volume control: means do not change the valume.

Types

data RealTime Source

Constructors

RT 

Fields

rt_secs :: !Word32
 
rt_nano :: !Word32
 

data Instr Source

Instances

data NoteEv Source

Constructors

ANote 
NoteOn 
NoteOff 
KeyPress 

Instances

simple_noteSource

Arguments

:: Word8

Channel.

-> Word8

Note.

-> Word8

Velocity.

-> Note 

Make a note whose unspecified fields contain 0.

data Ctrl Source

Constructors

Ctrl 

Instances

data Addr Source

Constructors

Addr 

Fields

addr_client :: !Client
 
addr_port :: !Port
 

parse_addressSource

Arguments

:: SndSeq

Sequencer handle.

-> String

String to be parsed.

-> IO Addr

The parsed address.

Parse the given string into sequencer address. The client and port are separated by either colon or period, e.g. 128:1. The function also accepts client names.

addr_subscribers :: AddrSource

The address of all subscribed ports.

data EmptyEv Source

Instances

data Sample Source

Constructors

Sample 

Instances

data Volume Source

These are all 14 bit values.

Constructors

Volume 

Instances

Error handling

exception_code :: AlsaException -> WordSource

the (positive) error code

exception_description :: AlsaException -> StringSource

a text description of the problem

alsa_catch :: IO a -> (AlsaException -> IO a) -> IO aSource

Catch an exception generated by the binding.