Advanced Linux Sound Architecture

Library API

Jaroslav Kysela

            perex@suse.cz
         

Abramo Bagnara

            abramo@alsa-project.org
         

Frank van de Pol

            frank@vande-pol.demon.nl
         

Takashi Iwai

            iwai@ww.uni-erlangen.de
         


Table of Contents
Preface
API usage
I. General
1. Error codes
I. Functions
snd_strerror — converts an error code to a string
snd_card_load — purpose
snd_cards — purpose
snd_cards_mask — purpose
snd_card_name — purpose
snd_card_get_name — purpose
snd_card_get_longname — purpose
snd_defaults_card — purpose
snd_defaults_mixer_card — purpose
snd_defaults_mixer_device — purpose
snd_defaults_pcm_card — purpose
snd_defaults_pcm_device — purpose
snd_defaults_rawmidi_card — purpose
snd_defaults_rawmidi_device — purpose
II. Control interface
II. Control direct access
Control structures — references to all control structures
snd_ctl_open — open a control device
snd_ctl_close — close a control handle
snd_ctl_file_descriptor — obtain control file descriptor
snd_ctl_hw_info — purpose
snd_ctl_switch_list — purpose
snd_ctl_switch_read — purpose
snd_ctl_switch_write — purpose
snd_ctl_hwdep_info — purpose
snd_ctl_pcm_info — purpose
snd_ctl_pcm_channel_info — purpose
snd_ctl_pcm_channel_prefer_subdevice — purpose
snd_ctl_mixer_info — purpose
snd_ctl_rawmidi_info — purpose
snd_ctl_read — purpose
2. Examples
III. Mixer interface
III. Mixer direct access
Mixer structures — references to all mixer structures
snd_mixer_open — purpose
snd_mixer_close — purpose
snd_mixer_file_descriptor — purpose
snd_mixer_info — purpose
snd_mixer_elements — purpose
snd_mixer_routes — purpose
snd_mixer_groups — purpose
snd_mixer_group_read — purpose
snd_mixer_group_write — purpose
snd_mixer_element_info — purpose
snd_mixer_element_read — purpose
snd_mixer_element_write — purpose
snd_mixer_get_filter — purpose
snd_mixer_put_filter — purpose
snd_mixer_read — purpose
snd_mixer_set_bit — purpose
snd_mixer_get_bit — purpose
snd_mixer_channel_name — purpose
snd_mixer_element_has_info — purpose
snd_mixer_element_info_build — purpose
snd_mixer_element_info_free — purpose
snd_mixer_element_has_control — purpose
snd_mixer_element_build — purpose
snd_mixer_element_free — purpose
snd_mixer_sort_eid_name_index — purpose
snd_mixer_sort_eid_table — purpose
snd_mixer_sort_gid_name_index — purpose
snd_mixer_sort_gid_table — purpose
3. Examples
IV. PCM (digital audio) interface
IV. PCM direct access
PCM structures — references to all PCM structures
snd_pcm_open — open a PCM device
snd_pcm_open_subdevice — open a PCM subdevice
snd_pcm_close — close a PCM handle
snd_pcm_file_descriptor — obtain PCM file descriptor
snd_pcm_nonblock_mode — set or reset the block behaviour
snd_pcm_info — obtain general information about the PCM device
snd_pcm_channel_info — obtain information about the PCM direction
snd_pcm_channel_params — set PCM communication parameters
snd_pcm_channel_setup — obtain current PCM setup
snd_pcm_channel_status — obtain current PCM run-time status
snd_pcm_channel_prepare — prepare the selected direction
snd_pcm_channel_go — start selected direction
snd_pcm_sync_go — start the group of PCM channels
snd_pcm_playback_drain — drain playback queue
snd_pcm_channel_flush — flush buffers
snd_pcm_playback_pause — pause the playback direction
snd_pcm_transfer_size — determine size of transfer block
snd_pcm_write — transfer PCM stream to playback subdevice
snd_pcm_read — transfer PCM stream from capture subdevice
snd_pcm_writev — send PCM stream to playback (using I/O vector)
snd_pcm_readv — transfer PCM stream from capture (using I/O vector)
snd_pcm_mmap — mmap the hardware buffers to the user space
snd_pcm_munmap — unmap the hardware buffers to the user space
snd_pcm_format_signed — checking for signed format
snd_pcm_format_unsigned — checking for unsigned format
snd_pcm_format_linear — checking for linear format
snd_pcm_format_little_endian — checking for little endian format
snd_pcm_format_big_endian — checking for big endian format
snd_pcm_format_width — obtain sample width in bits
snd_pcm_build_linear_format — build linear format
snd_pcm_format_size — convert size in samples to bytes
snd_pcm_get_format_name — obtain a name of format
V. PCM plugin access
snd_pcm_plugin_info — obtain information about the PCM direction
snd_pcm_plugin_params — set PCM communication parameters
snd_pcm_plugin_setup — obtain current PCM setup
snd_pcm_plugin_status — obtain current PCM run-time status
snd_pcm_plugin_prepare — prepare the selected direction
snd_pcm_plugin_playback_drain — drain playback queue
snd_pcm_plugin_channel_flush — flush buffers
snd_pcm_plugin_write — transfer PCM stream to playback subdevice
snd_pcm_plugin_pointer — obtain a pointer to the transfer buffer
snd_pcm_plugin_read — transfer PCM stream from capture subdevice
snd_pcm_plugin_writev — send PCM stream to playback (using I/O vector)
snd_pcm_plugin_readv — transfer PCM stream from capture (using I/O vector)
V. RawMidi interface
VI. RawMidi direct access
RawMidi structures — references to all RawMidi structures
snd_rawmidi_open — open a RawMidi device
snd_rawmidi_close — close a RawMidi device
snd_rawmidi_file_descriptor — obtain RawMidi file descriptor
snd_rawmidi_block_mode — set or reset the block behaviour
snd_rawmidi_info — obtain general information about the RawMidi device
snd_rawmidi_channel_params — set the communication parameters
snd_rawmidi_channel_status — obtain the communication status
snd_rawmidi_drain_output — destroy the output queue
snd_rawmidi_channel_flush — flush the output or input queue
snd_rawmidi_write — transfer the MIDI stream to RawMidi device
snd_rawmidi_read — transfer the MIDI stream from RawMidi device
4. Examples
VI. Timer interface
VII. Timer direct access
Timer structures — references to all timer structures
snd_timer_open — purpose
snd_timer_close — purpose
snd_timer_file_descriptor — purpose
snd_timer_general_info — purpose
snd_timer_select — purpose
snd_timer_info — purpose
snd_timer_params — purpose
snd_timer_status — purpose
snd_timer_start — purpose
snd_timer_stop — purpose
snd_timer_continue — purpose
snd_timer_read — purpose
5. Examples
VII. Sequencer interface
6. Introduction
Currently available sequencer
New sequencer
Concept of clients
Architecture
Client applications
Client interfaces
Client communication
Sequencer ports
OSS Compatibility
Memory pool
Synchronization
Timing and Synchronization
7. Events
Structure of an event
Scheduling queue
Time stamp
Source and destination addresses
Data storage type
Scheduling priority
Event flags
8. Subscription of ports
Concept of subscription
More inside the subscription
Examples of subscription
Event processing
VIII. Sequencer client accesses
snd_seq_open — open a sequencer client
snd_seq_close — close a sequencer client
snd_seq_file_descriptor — obtain the file descriptor of sequencer client
snd_seq_block_mode — set or reset the block behavior
snd_seq_client_id — obtain the client id
snd_seq_system_info — obtain the sequencer system information
snd_seq_get_client_info — obtain the information of the current client
snd_seq_get_any_client_info — obtain the information of the given client
snd_seq_set_client_info — set the information of the current client
snd_seq_query_next_client — query the next matching client
snd_seq_set_client_name — set the name of the current client
snd_seq_set_client_group — set the group name of the current client
snd_seq_set_client_filter — set the filter flags of the current client
snd_seq_set_client_event_filter — add the event filter of the current client
IX. Sequencer port accesses
snd_seq_create_port — create a sequencer port on the current client
snd_seq_delete_port — delete a sequencer port on the current client
snd_seq_get_port_info — obatin the information of a port on the current client
snd_seq_get_any_port_info — obatin the information of a port on an arbitrary client
snd_seq_set_port_info — set the information of a port on the current client
snd_seq_query_next_port — query the next matching port
snd_seq_create_simple_port — create a sequencer port
snd_seq_delete_simple_port — delete a sequencer port with the id
X. Memory pool management
snd_seq_get_client_pool — obtain the pool information of the current client
snd_seq_set_client_pool — set the pool information
snd_seq_set_client_pool_output — set the output pool size
snd_seq_set_client_pool_output_room — set the output room size
snd_seq_set_client_pool_input — set the input pool size
snd_seq_reset_pool_output — reset all events on the output pool
snd_seq_reset_pool_input — reset all events on the input pool
XI. Sequencer queue acceses
snd_seq_alloc_named_queue — allocate a queue with the speicified name
snd_seq_alloc_queue — alloate a queue
snd_seq_free_queue — release the queue
snd_seq_get_queue_info — obtain queue attributes
snd_seq_set_queue_info — set queue attributes
snd_seq_get_named_queue — query the queue with the specified name
snd_seq_get_queue_status — obtain the running state of the queue
snd_seq_get_queue_tempo — obtain the current tempo of the queue
snd_seq_set_queue_tempo — set the tempo of the queue
snd_seq_get_queue_owner — obtain the owner information of the queue
snd_seq_set_queue_owner — set the owner information of the queue
snd_seq_get_queue_timer — obtain the queue timer information
snd_seq_set_queue_timer — set the queue timer information
snd_seq_get_queue_sync — get queue sync information
snd_seq_set_queue_sync — set queue sync information
snd_seq_get_queue_client — obtain queue access information
snd_seq_set_queue_client — set queue access information
snd_seq_use_queue — set or reset the queue access
snd_seq_control_queue — send a queue control event
snd_seq_start_queue — send a start event to the queue
snd_seq_stop_queue — send a stop event to the queue
snd_seq_continue_queue — send a continue event to the queue
snd_seq_change_queue_tempo — send a tempo change event to the queue
snd_seq_setpos_queue — send a set-time-position event to the queue
XII. Sequencer subscription accesses
snd_seq_subscribe_port — subscribe a port connection
snd_seq_unsubscribe_port — unsubscribe a connection between ports
snd_seq_get_port_subscription — obtain subscription information
snd_seq_query_port_subscribers — query port subscriber list
snd_seq_connect_from — connect from an arbitrary port to a port on the current client
snd_seq_connect_to — connect from a port on the current client to an arbitrary port
snd_seq_disconnect_from — disconnect between ports
snd_seq_disconnect_to — disconnect between ports
XIII. Sequencer event handlers
snd_seq_create_event — create an event record
snd_seq_free_event — free an event record
snd_seq_event_length — calculate the length of event-byte-stream
snd_seq_event_output — output the event to sequencer
snd_seq_flush_output — flush output event buffer
snd_seq_event_output_pending — return the size of unprocessed data on output buffer
snd_seq_extract_output — remove the event on output buffer
snd_seq_drain_output — remove all events on output buffer
snd_seq_drain_output_buffer — remove all events on user-space output buffer
snd_seq_event_input — return an input event from sequencer
snd_seq_event_input_selective — return an input event with the specified type
snd_seq_event_input_pending — return the number of remaining input events
snd_seq_drain_input — remove all events on input FIFO
snd_seq_drain_input_buffer — remove all events on user-space input FIFO
snd_seq_remove_events — remove events on input/output buffers
snd_seq_ev_clear — clear the event record
snd_seq_ev_set_dest — set the given destination address
snd_seq_ev_set_subs — set subscribers as destination
snd_seq_ev_set_broadcast — set broadcast as destination
snd_seq_ev_set_source — set the source port
snd_seq_ev_set_direct — set the direct dispatch mode
snd_seq_ev_schedule_tick — set the scheduling queue and tick time
snd_seq_ev_schedule_real — set the scheduling queue and time
snd_seq_ev_set_priority — set the event priority
snd_seq_ev_set_fixed — set event size as fixed length
snd_seq_ev_set_variable — associate the variable length data
XIV. Miscellaneous functions
snd_seq_set_bit — set a bit flag
snd_seq_change_bit — change a bit flag
snd_seq_get_bit — get a bit flag state
Glossary