alsa-0.2: Binding to the ALSA Library API.Source codeContentsIndex
Sound.Alsa.Sequencer
Stabilityprovisional
MaintainerIavor S. Diatchki
Contents
Sequencer
Manage user-space buffers
Manage kernel-space memory pools
Queue Interface
Client Interface
Port Interface
Connections
Events
Types
Error handling
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
data SndSeq
data OpenMode
open_output :: OpenMode
open_input :: OpenMode
open_duplex :: OpenMode
data BlockMode
= Block
| Nonblock
open :: String -> OpenMode -> BlockMode -> IO SndSeq
close :: SndSeq -> IO ()
default_seq_name :: String
get_seq_name :: SndSeq -> IO String
set_blocking :: SndSeq -> BlockMode -> IO ()
get_output_buffer_size :: SndSeq -> IO Word
set_output_buffer_size :: SndSeq -> Word -> IO ()
get_input_buffer_size :: SndSeq -> IO Word
set_input_buffer_size :: SndSeq -> Word -> IO ()
set_pool_output :: SndSeq -> Word -> IO ()
set_pool_output_room :: SndSeq -> Word -> IO ()
reset_pool_output :: SndSeq -> IO ()
set_pool_input :: SndSeq -> Word -> IO ()
reset_pool_input :: SndSeq -> IO ()
module Sound.Alsa.Sequencer.Queue
module Sound.Alsa.Sequencer.Client
module Sound.Alsa.Sequencer.Port
connect_from :: SndSeq -> Port -> Addr -> IO ()
connect_to :: SndSeq -> Port -> Addr -> IO ()
disconnect_from :: SndSeq -> Port -> Addr -> IO ()
disconnect_to :: SndSeq -> Port -> Addr -> IO ()
volume_same :: Int16
module Sound.Alsa.Sequencer.Event
data RealTime = RT {
rt_secs :: !Word32
rt_nano :: !Word32
}
data TimeStamp
= TickTime !Word32
| RealTime !RealTime
data InstrCluster
data Instr = Instr {
instr_cluster :: !InstrCluster
instr_std :: !Word32
instr_bank :: !Word16
instr_prg :: !Word16
}
data Event = Event {
ev_high_priority :: !Bool
ev_tag :: !Word8
ev_queue :: !Queue
ev_timestamp :: !TimeStamp
ev_source :: !Addr
ev_dest :: !Addr
ev_data :: !EventData
}
data EventData
= NoteEv NoteEv Note
| CtrlEv CtrlEv Ctrl
| AddrEv AddrEv Addr
| ConnEv ConnEv Connect
| EmptyEv EmptyEv
data NoteEv
= ANote
| NoteOn
| NoteOff
| KeyPress
data Note = Note {
note_channel :: !Word8
note_note :: !Word8
note_velocity :: !Word8
note_off_velocity :: !Word8
note_duration :: !Word32
}
simple_note :: Word8 -> Word8 -> Word8 -> Note
data CtrlEv
= Controller
| PgmChange
| ChanPress
| PitchBend
| Control14
| NonRegParam
| RegParam
| SongPos
| SongSel
| QFrame
| TimeSign
| KeySign
data Ctrl = Ctrl {
ctrl_channel :: !Word8
ctrl_param :: !Word32
ctrl_value :: !Int32
}
data AddrEv
= ClientStart
| ClientExit
| ClientChange
| PortStart
| PortExit
| PortChange
data Addr = Addr {
addr_client :: !Client
addr_port :: !Port
}
parse_address :: SndSeq -> String -> IO Addr
addr_subscribers :: Addr
data ConnEv
= PortSubscribed
| PortUnsubscribed
data Connect
data EmptyEv
= TuneRequest
| Reset
| Sensing
| None
| Unknown
data Sample = Sample {
sample_std :: !Word32
sample_bank :: !Word16
sample_prg :: !Word16
}
newtype Cluster = Cluster {
cluster_cluster :: InstrCluster
}
data Volume = Volume {
volume_volume :: !Int16
volume_lr :: !Int16
volume_fr :: !Int16
volume_du :: !Int16
}
data AlsaException
exception_code :: AlsaException -> Word
exception_description :: AlsaException -> String
alsa_catch :: IO a -> (AlsaException -> IO a) -> IO a
Sequencer
data SndSeq Source
The type of sequencer handles.
show/hide Instances
data OpenMode Source
Read/Write permissions for the sequencer device.
show/hide Instances
open_output :: OpenModeSource
open_input :: OpenModeSource
open_duplex :: OpenModeSource
data BlockMode Source
Blocking behavior of the sequencer device.
Constructors
BlockOperations may block.
NonblockThrow exceptions instead of blocking.
show/hide Instances
openSource
:: StringThe 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
:: SndSeqhandle 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
:: SndSeqsequencer handle
-> IO StringALSA identifier for the handel
Get identifier of a sequencer handle. It is the same identifier specified in the call to open.
set_blockingSource
:: SndSeqsequencer handle
-> BlockModeblocking 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
:: SndSeqSequencer handle.
-> IO WordSize of output buffer in bytes.
Return the byte size of the output buffer.
set_output_buffer_sizeSource
:: SndSeqSequencer handle.
-> WordNew buffer size in bytes.
-> IO ()
Resize of the output buffer. This function clears all output events (see drop_output).
get_input_buffer_sizeSource
:: SndSeqSequencer handle.
-> IO WordSize of input buffer in bytes.
Return the byte size of input buffer.
set_input_buffer_sizeSource
:: SndSeqSequencer handle.
-> WordNew 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
:: SndSeqSequencer handle.
-> WordNew size in bytes.
-> IO ()
Resize the output memory pool.
set_pool_output_roomSource
:: SndSeqSequencer handle.
-> WordNumber 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
:: SndSeqSequencer handle.
-> IO ()
Reset the output pool.
set_pool_inputSource
:: SndSeqSequencer handle.
-> WordNew size in bytes.
-> IO ()
Resize the input memory pool.
reset_pool_inputSource
:: SndSeqSequencer handle.
-> IO ()
Reset the input pool.
Queue Interface
module Sound.Alsa.Sequencer.Queue
Client Interface
module Sound.Alsa.Sequencer.Client
Port Interface
module Sound.Alsa.Sequencer.Port
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.
module Sound.Alsa.Sequencer.Event
Types
data RealTime Source
Constructors
RT
rt_secs :: !Word32
rt_nano :: !Word32
show/hide Instances
data TimeStamp Source
Constructors
TickTime !Word32
RealTime !RealTime
show/hide Instances
data InstrCluster Source
show/hide Instances
data Instr Source
Constructors
Instr
instr_cluster :: !InstrCluster
instr_std :: !Word32
instr_bank :: !Word16
instr_prg :: !Word16
show/hide Instances
data Event Source
Constructors
Event
ev_high_priority :: !Bool
ev_tag :: !Word8
ev_queue :: !Queue
ev_timestamp :: !TimeStamp
ev_source :: !Addr
ev_dest :: !Addr
ev_data :: !EventData
show/hide Instances
data EventData Source
Constructors
NoteEv NoteEv Note
CtrlEv CtrlEv Ctrl
AddrEv AddrEv Addr
ConnEv ConnEv Connect
EmptyEv EmptyEv
show/hide Instances
data NoteEv Source
Constructors
ANote
NoteOn
NoteOff
KeyPress
show/hide Instances
data Note Source
Constructors
Note
note_channel :: !Word8
note_note :: !Word8
note_velocity :: !Word8
note_off_velocity :: !Word8
note_duration :: !Word32
show/hide Instances
simple_noteSource
:: Word8Channel.
-> Word8Note.
-> Word8Velocity.
-> Note
Make a note whose unspecified fields contain 0.
data CtrlEv Source
Constructors
Controller
PgmChange
ChanPress
PitchBend
Control14
NonRegParam
RegParam
SongPos
SongSel
QFrame
TimeSign
KeySign
show/hide Instances
data Ctrl Source
Constructors
Ctrl
ctrl_channel :: !Word8
ctrl_param :: !Word32
ctrl_value :: !Int32
show/hide Instances
data AddrEv Source
Constructors
ClientStart
ClientExit
ClientChange
PortStart
PortExit
PortChange
show/hide Instances
data Addr Source
Constructors
Addr
addr_client :: !Client
addr_port :: !Port
show/hide Instances
parse_addressSource
:: SndSeqSequencer handle.
-> StringString to be parsed.
-> IO AddrThe 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 ConnEv Source
Constructors
PortSubscribed
PortUnsubscribed
show/hide Instances
data Connect Source
show/hide Instances
data EmptyEv Source
Constructors
TuneRequest
Reset
Sensing
None
Unknown
show/hide Instances
data Sample Source
Constructors
Sample
sample_std :: !Word32
sample_bank :: !Word16
sample_prg :: !Word16
show/hide Instances
newtype Cluster Source
Constructors
Cluster
cluster_cluster :: InstrCluster
show/hide Instances
data Volume Source
These are all 14 bit values.
Constructors
Volume
volume_volume :: !Int16
volume_lr :: !Int16
volume_fr :: !Int16
volume_du :: !Int16
show/hide Instances
Error handling
data AlsaException Source
show/hide Instances
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.
Produced by Haddock version 2.4.2