ALSA project - the C library reference
|
RawMidi Interface. More...
Functions | |
int | snd_rawmidi_open (snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, const char *name, int mode) |
Opens a new connection to the RawMidi interface. | |
int | snd_rawmidi_open_lconf (snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, const char *name, int mode, snd_config_t *lconf) |
Opens a new connection to the RawMidi interface using local configuration. | |
int | snd_rawmidi_close (snd_rawmidi_t *rawmidi) |
close RawMidi handle | |
const char * | snd_rawmidi_name (snd_rawmidi_t *rawmidi) |
get identifier of RawMidi handle | |
snd_rawmidi_type_t | snd_rawmidi_type (snd_rawmidi_t *rawmidi) |
get type of RawMidi handle | |
snd_rawmidi_stream_t | snd_rawmidi_stream (snd_rawmidi_t *rawmidi) |
get stream (direction) of RawMidi handle | |
int | snd_rawmidi_poll_descriptors_count (snd_rawmidi_t *rawmidi) |
get count of poll descriptors for RawMidi handle | |
int | snd_rawmidi_poll_descriptors (snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int space) |
get poll descriptors | |
int | snd_rawmidi_poll_descriptors_revents (snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revents) |
get returned events from poll descriptors | |
int | snd_rawmidi_nonblock (snd_rawmidi_t *rawmidi, int nonblock) |
set nonblock mode | |
size_t | snd_rawmidi_info_sizeof () |
get size of the snd_rawmidi_info_t structure in bytes | |
int | snd_rawmidi_info_malloc (snd_rawmidi_info_t **info) |
allocate a new snd_rawmidi_info_t structure | |
void | snd_rawmidi_info_free (snd_rawmidi_info_t *info) |
frees the snd_rawmidi_info_t structure | |
void | snd_rawmidi_info_copy (snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src) |
copy one snd_rawmidi_info_t structure to another | |
unsigned int | snd_rawmidi_info_get_device (const snd_rawmidi_info_t *info) |
get rawmidi device number | |
unsigned int | snd_rawmidi_info_get_subdevice (const snd_rawmidi_info_t *info) |
get rawmidi subdevice number | |
snd_rawmidi_stream_t | snd_rawmidi_info_get_stream (const snd_rawmidi_info_t *info) |
get rawmidi stream identification | |
int | snd_rawmidi_info_get_card (const snd_rawmidi_info_t *info) |
get rawmidi card number | |
unsigned int | snd_rawmidi_info_get_flags (const snd_rawmidi_info_t *info) |
get rawmidi flags | |
const char * | snd_rawmidi_info_get_id (const snd_rawmidi_info_t *info) |
get rawmidi hardware driver identifier | |
const char * | snd_rawmidi_info_get_name (const snd_rawmidi_info_t *info) |
get rawmidi hardware driver name | |
const char * | snd_rawmidi_info_get_subdevice_name (const snd_rawmidi_info_t *info) |
get rawmidi subdevice name | |
unsigned int | snd_rawmidi_info_get_subdevices_count (const snd_rawmidi_info_t *info) |
get rawmidi count of subdevices | |
unsigned int | snd_rawmidi_info_get_subdevices_avail (const snd_rawmidi_info_t *info) |
get rawmidi available count of subdevices | |
int | snd_rawmidi_info_get_tied_device (const snd_rawmidi_info_t *info) |
get the tied device number for the given rawmidi device | |
void | snd_rawmidi_info_set_device (snd_rawmidi_info_t *info, unsigned int val) |
set rawmidi device number | |
void | snd_rawmidi_info_set_subdevice (snd_rawmidi_info_t *info, unsigned int val) |
set rawmidi subdevice number | |
void | snd_rawmidi_info_set_stream (snd_rawmidi_info_t *info, snd_rawmidi_stream_t val) |
set rawmidi stream identifier | |
int | snd_rawmidi_info (snd_rawmidi_t *rawmidi, snd_rawmidi_info_t *info) |
get information about RawMidi handle | |
size_t | snd_rawmidi_params_sizeof () |
get size of the snd_rawmidi_params_t structure in bytes | |
int | snd_rawmidi_params_malloc (snd_rawmidi_params_t **params) |
allocate the snd_rawmidi_params_t structure | |
void | snd_rawmidi_params_free (snd_rawmidi_params_t *params) |
frees the snd_rawmidi_params_t structure | |
void | snd_rawmidi_params_copy (snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src) |
copy one snd_rawmidi_params_t structure to another | |
int | snd_rawmidi_params_set_buffer_size (snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, size_t val) |
set rawmidi I/O ring buffer size | |
size_t | snd_rawmidi_params_get_buffer_size (const snd_rawmidi_params_t *params) |
get rawmidi I/O ring buffer size | |
int | snd_rawmidi_params_set_avail_min (snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, size_t val) |
set minimum available bytes in rawmidi I/O ring buffer for wakeup | |
size_t | snd_rawmidi_params_get_avail_min (const snd_rawmidi_params_t *params) |
get minimum available bytes in rawmidi I/O ring buffer for wakeup | |
int | snd_rawmidi_params_set_no_active_sensing (snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, int val) |
set no-active-sensing action on snd_rawmidi_close() | |
int | snd_rawmidi_params_get_no_active_sensing (const snd_rawmidi_params_t *params) |
get no-active-sensing action status | |
int | snd_rawmidi_params_set_read_mode (const snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, snd_rawmidi_read_mode_t val) |
set read mode | |
snd_rawmidi_read_mode_t | snd_rawmidi_params_get_read_mode (const snd_rawmidi_params_t *params) |
get current read mode | |
int | snd_rawmidi_params_set_clock_type (const snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, snd_rawmidi_clock_t val) |
sets clock type for tstamp type framing | |
snd_rawmidi_clock_t | snd_rawmidi_params_get_clock_type (const snd_rawmidi_params_t *params) |
get current clock type (for tstamp type framing) | |
int | snd_rawmidi_params (snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params) |
set parameters about rawmidi stream | |
int | snd_rawmidi_params_current (snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params) |
get current parameters about rawmidi stream | |
size_t | snd_rawmidi_status_sizeof () |
get size of the snd_rawmidi_status_t structure in bytes | |
int | snd_rawmidi_status_malloc (snd_rawmidi_status_t **ptr) |
allocate the snd_rawmidi_status_t structure | |
void | snd_rawmidi_status_free (snd_rawmidi_status_t *status) |
frees the snd_rawmidi_status_t structure | |
void | snd_rawmidi_status_copy (snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src) |
copy one snd_rawmidi_status_t structure to another | |
void | snd_rawmidi_status_get_tstamp (const snd_rawmidi_status_t *status, snd_htimestamp_t *tstamp) |
get the start timestamp | |
size_t | snd_rawmidi_status_get_avail (const snd_rawmidi_status_t *status) |
get current available bytes in the rawmidi I/O ring buffer | |
size_t | snd_rawmidi_status_get_xruns (const snd_rawmidi_status_t *status) |
get count of xruns | |
int | snd_rawmidi_status (snd_rawmidi_t *rawmidi, snd_rawmidi_status_t *status) |
get status of rawmidi stream | |
int | snd_rawmidi_drop (snd_rawmidi_t *rawmidi) |
drop all bytes in the rawmidi I/O ring buffer immediately | |
int | snd_rawmidi_drain (snd_rawmidi_t *rawmidi) |
drain all bytes in the rawmidi I/O ring buffer | |
ssize_t | snd_rawmidi_write (snd_rawmidi_t *rawmidi, const void *buffer, size_t size) |
write MIDI bytes to MIDI stream | |
ssize_t | snd_rawmidi_read (snd_rawmidi_t *rawmidi, void *buffer, size_t size) |
read MIDI bytes from MIDI stream | |
ssize_t | snd_rawmidi_tread (snd_rawmidi_t *rawmidi, struct timespec *tstamp, void *buffer, size_t size) |
read MIDI bytes from MIDI stream with timestamp | |
int snd_rawmidi_close | ( | snd_rawmidi_t * | rawmidi | ) |
close RawMidi handle
rawmidi | RawMidi handle |
Closes the specified RawMidi handle and frees all associated resources.
int snd_rawmidi_drain | ( | snd_rawmidi_t * | rawmidi | ) |
drain all bytes in the rawmidi I/O ring buffer
rawmidi | RawMidi handle |
Waits until all MIDI bytes are not drained (sent) to the hardware device.
int snd_rawmidi_drop | ( | snd_rawmidi_t * | rawmidi | ) |
drop all bytes in the rawmidi I/O ring buffer immediately
rawmidi | RawMidi handle |
int snd_rawmidi_info | ( | snd_rawmidi_t * | rawmidi, |
snd_rawmidi_info_t * | info ) |
get information about RawMidi handle
rawmidi | RawMidi handle |
info | pointer to a snd_rawmidi_info_t structure to be filled |
void snd_rawmidi_info_copy | ( | snd_rawmidi_info_t * | dst, |
const snd_rawmidi_info_t * | src ) |
copy one snd_rawmidi_info_t structure to another
dst | destination snd_rawmidi_info_t structure |
src | source snd_rawmidi_info_t structure |
void snd_rawmidi_info_free | ( | snd_rawmidi_info_t * | info | ) |
frees the snd_rawmidi_info_t structure
info | pointer to the snd_rawmidi_info_t structure to free |
Frees the given snd_rawmidi_params_t structure using the standard free C library function.
int snd_rawmidi_info_get_card | ( | const snd_rawmidi_info_t * | info | ) |
get rawmidi card number
info | pointer to a snd_rawmidi_info_t structure |
unsigned int snd_rawmidi_info_get_device | ( | const snd_rawmidi_info_t * | info | ) |
get rawmidi device number
info | pointer to a snd_rawmidi_info_t structure |
unsigned int snd_rawmidi_info_get_flags | ( | const snd_rawmidi_info_t * | info | ) |
get rawmidi flags
info | pointer to a snd_rawmidi_info_t structure |
const char * snd_rawmidi_info_get_id | ( | const snd_rawmidi_info_t * | info | ) |
get rawmidi hardware driver identifier
info | pointer to a snd_rawmidi_info_t structure |
const char * snd_rawmidi_info_get_name | ( | const snd_rawmidi_info_t * | info | ) |
get rawmidi hardware driver name
info | pointer to a snd_rawmidi_info_t structure |
snd_rawmidi_stream_t snd_rawmidi_info_get_stream | ( | const snd_rawmidi_info_t * | info | ) |
get rawmidi stream identification
info | pointer to a snd_rawmidi_info_t structure |
unsigned int snd_rawmidi_info_get_subdevice | ( | const snd_rawmidi_info_t * | info | ) |
get rawmidi subdevice number
info | pointer to a snd_rawmidi_info_t structure |
const char * snd_rawmidi_info_get_subdevice_name | ( | const snd_rawmidi_info_t * | info | ) |
get rawmidi subdevice name
info | pointer to a snd_rawmidi_info_t structure |
unsigned int snd_rawmidi_info_get_subdevices_avail | ( | const snd_rawmidi_info_t * | info | ) |
get rawmidi available count of subdevices
info | pointer to a snd_rawmidi_info_t structure |
unsigned int snd_rawmidi_info_get_subdevices_count | ( | const snd_rawmidi_info_t * | info | ) |
get rawmidi count of subdevices
info | pointer to a snd_rawmidi_info_t structure |
int snd_rawmidi_info_get_tied_device | ( | const snd_rawmidi_info_t * | info | ) |
get the tied device number for the given rawmidi device
info | pointer to a snd_rawmidi_info_t structure |
This function is useful for UMP rawmidi devices where each of them may have the mirroring legacy rawmidi device. Those are shown as "tied".
int snd_rawmidi_info_malloc | ( | snd_rawmidi_info_t ** | info | ) |
allocate a new snd_rawmidi_info_t structure
info | returned pointer |
Allocates a new snd_rawmidi_params_t structure using the standard malloc C library function.
void snd_rawmidi_info_set_device | ( | snd_rawmidi_info_t * | info, |
unsigned int | val ) |
set rawmidi device number
info | pointer to a snd_rawmidi_info_t structure |
val | device number |
void snd_rawmidi_info_set_stream | ( | snd_rawmidi_info_t * | info, |
snd_rawmidi_stream_t | val ) |
set rawmidi stream identifier
info | pointer to a snd_rawmidi_info_t structure |
val | rawmidi stream identifier |
void snd_rawmidi_info_set_subdevice | ( | snd_rawmidi_info_t * | info, |
unsigned int | val ) |
set rawmidi subdevice number
info | pointer to a snd_rawmidi_info_t structure |
val | subdevice number |
size_t snd_rawmidi_info_sizeof | ( | ) |
get size of the snd_rawmidi_info_t structure in bytes
const char * snd_rawmidi_name | ( | snd_rawmidi_t * | rawmidi | ) |
get identifier of RawMidi handle
rawmidi | a RawMidi handle |
Returns the ASCII identifier of given RawMidi handle. It's the same identifier specified in snd_rawmidi_open().
int snd_rawmidi_nonblock | ( | snd_rawmidi_t * | rawmidi, |
int | nonblock ) |
set nonblock mode
rawmidi | RawMidi handle |
nonblock | 0 = block, 1 = nonblock mode |
The nonblock mode cannot be used when the stream is in #SND_RAWMIDI_APPEND state.
int snd_rawmidi_open | ( | snd_rawmidi_t ** | inputp, |
snd_rawmidi_t ** | outputp, | ||
const char * | name, | ||
int | mode ) |
Opens a new connection to the RawMidi interface.
inputp | Returned input handle (NULL if not wanted) |
outputp | Returned output handle (NULL if not wanted) |
name | ASCII identifier of the RawMidi handle |
mode | Open mode |
Opens a new connection to the RawMidi interface specified with an ASCII identifier and mode.
int snd_rawmidi_open_lconf | ( | snd_rawmidi_t ** | inputp, |
snd_rawmidi_t ** | outputp, | ||
const char * | name, | ||
int | mode, | ||
snd_config_t * | lconf ) |
Opens a new connection to the RawMidi interface using local configuration.
inputp | Returned input handle (NULL if not wanted) |
outputp | Returned output handle (NULL if not wanted) |
name | ASCII identifier of the RawMidi handle |
mode | Open mode |
lconf | Local configuration |
Opens a new connection to the RawMidi interface specified with an ASCII identifier and mode.
int snd_rawmidi_params | ( | snd_rawmidi_t * | rawmidi, |
snd_rawmidi_params_t * | params ) |
set parameters about rawmidi stream
rawmidi | RawMidi handle |
params | pointer to a snd_rawmidi_params_t structure to be filled |
void snd_rawmidi_params_copy | ( | snd_rawmidi_params_t * | dst, |
const snd_rawmidi_params_t * | src ) |
copy one snd_rawmidi_params_t structure to another
dst | destination snd_rawmidi_params_t structure |
src | source snd_rawmidi_params_t structure |
int snd_rawmidi_params_current | ( | snd_rawmidi_t * | rawmidi, |
snd_rawmidi_params_t * | params ) |
get current parameters about rawmidi stream
rawmidi | RawMidi handle |
params | pointer to a snd_rawmidi_params_t structure to be filled |
void snd_rawmidi_params_free | ( | snd_rawmidi_params_t * | params | ) |
frees the snd_rawmidi_params_t structure
params | pointer to the #snd_rawmidi_params_t structure to free |
Frees the given snd_rawmidi_params_t structure using the standard free C library function.
size_t snd_rawmidi_params_get_avail_min | ( | const snd_rawmidi_params_t * | params | ) |
get minimum available bytes in rawmidi I/O ring buffer for wakeup
params | pointer to snd_rawmidi_params_t structure |
size_t snd_rawmidi_params_get_buffer_size | ( | const snd_rawmidi_params_t * | params | ) |
get rawmidi I/O ring buffer size
params | pointer to a snd_rawmidi_params_t structure |
snd_rawmidi_clock_t snd_rawmidi_params_get_clock_type | ( | const snd_rawmidi_params_t * | params | ) |
get current clock type (for tstamp type framing)
params | pointer to snd_rawmidi_params_t structure |
int snd_rawmidi_params_get_no_active_sensing | ( | const snd_rawmidi_params_t * | params | ) |
get no-active-sensing action status
params | pointer to snd_rawmidi_params_t structure |
snd_rawmidi_read_mode_t snd_rawmidi_params_get_read_mode | ( | const snd_rawmidi_params_t * | params | ) |
get current read mode
params | pointer to snd_rawmidi_params_t structure |
int snd_rawmidi_params_malloc | ( | snd_rawmidi_params_t ** | params | ) |
allocate the snd_rawmidi_params_t structure
params | returned pointer |
Allocates a new snd_rawmidi_params_t structure using the standard malloc C library function.
int snd_rawmidi_params_set_avail_min | ( | snd_rawmidi_t * | rawmidi, |
snd_rawmidi_params_t * | params, | ||
size_t | val ) |
set minimum available bytes in rawmidi I/O ring buffer for wakeup
rawmidi | RawMidi handle |
params | pointer to a snd_rawmidi_params_t structure |
val | desired value |
int snd_rawmidi_params_set_buffer_size | ( | snd_rawmidi_t * | rawmidi, |
snd_rawmidi_params_t * | params, | ||
size_t | val ) |
set rawmidi I/O ring buffer size
rawmidi | RawMidi handle |
params | pointer to a snd_rawmidi_params_t structure |
val | size in bytes |
int snd_rawmidi_params_set_clock_type | ( | const snd_rawmidi_t * | rawmidi, |
snd_rawmidi_params_t * | params, | ||
snd_rawmidi_clock_t | val ) |
sets clock type for tstamp type framing
rawmidi | RawMidi handle |
params | pointer to snd_rawmidi_params_t structure |
val | one of the SND_RAWMIDI_CLOCK_* constants |
Notable error codes: -EINVAL - "val" is invalid -ENOTSUP - Kernel is too old to support framing.
int snd_rawmidi_params_set_no_active_sensing | ( | snd_rawmidi_t * | rawmidi, |
snd_rawmidi_params_t * | params, | ||
int | val ) |
set no-active-sensing action on snd_rawmidi_close()
rawmidi | RawMidi handle |
params | pointer to snd_rawmidi_params_t structure |
val | value: 0 = enable to send the active sensing message, 1 = disable |
int snd_rawmidi_params_set_read_mode | ( | const snd_rawmidi_t * | rawmidi, |
snd_rawmidi_params_t * | params, | ||
snd_rawmidi_read_mode_t | val ) |
set read mode
rawmidi | RawMidi handle |
params | pointer to snd_rawmidi_params_t structure |
val | type of read_mode |
Notable error codes: -EINVAL - "val" is invalid -ENOTSUP - mode is not supported
size_t snd_rawmidi_params_sizeof | ( | ) |
get size of the snd_rawmidi_params_t structure in bytes
int snd_rawmidi_poll_descriptors | ( | snd_rawmidi_t * | rawmidi, |
struct pollfd * | pfds, | ||
unsigned int | space ) |
get poll descriptors
rawmidi | RawMidi handle |
pfds | array of poll descriptors |
space | space in the poll descriptor array |
int snd_rawmidi_poll_descriptors_count | ( | snd_rawmidi_t * | rawmidi | ) |
get count of poll descriptors for RawMidi handle
rawmidi | RawMidi handle |
int snd_rawmidi_poll_descriptors_revents | ( | snd_rawmidi_t * | rawmidi, |
struct pollfd * | pfds, | ||
unsigned int | nfds, | ||
unsigned short * | revents ) |
get returned events from poll descriptors
rawmidi | rawmidi RawMidi handle |
pfds | array of poll descriptors |
nfds | count of poll descriptors |
revents | returned events |
ssize_t snd_rawmidi_read | ( | snd_rawmidi_t * | rawmidi, |
void * | buffer, | ||
size_t | size ) |
read MIDI bytes from MIDI stream
rawmidi | RawMidi handle |
buffer | buffer to store the input MIDI bytes |
size | input buffer size in bytes |
count | of MIDI bytes otherwise a negative error code |
int snd_rawmidi_status | ( | snd_rawmidi_t * | rawmidi, |
snd_rawmidi_status_t * | status ) |
get status of rawmidi stream
rawmidi | RawMidi handle |
status | pointer to a snd_rawmidi_status_t structure to be filled |
void snd_rawmidi_status_copy | ( | snd_rawmidi_status_t * | dst, |
const snd_rawmidi_status_t * | src ) |
copy one snd_rawmidi_status_t structure to another
dst | destination snd_rawmidi_status_t structure |
src | source snd_rawmidi_status_t structure |
void snd_rawmidi_status_free | ( | snd_rawmidi_status_t * | status | ) |
frees the snd_rawmidi_status_t structure
status | pointer to the snd_rawmidi_status_t structure to free |
Frees the given snd_rawmidi_status_t structure using the standard free C library function.
size_t snd_rawmidi_status_get_avail | ( | const snd_rawmidi_status_t * | status | ) |
get current available bytes in the rawmidi I/O ring buffer
status | pointer to a snd_rawmidi_status_t structure |
void snd_rawmidi_status_get_tstamp | ( | const snd_rawmidi_status_t * | status, |
snd_htimestamp_t * | tstamp ) |
get the start timestamp
status | pointer to a snd_rawmidi_status_t structure |
tstamp | returned timestamp value |
size_t snd_rawmidi_status_get_xruns | ( | const snd_rawmidi_status_t * | status | ) |
get count of xruns
status | pointer to a snd_rawmidi_status_t structure |
int snd_rawmidi_status_malloc | ( | snd_rawmidi_status_t ** | ptr | ) |
allocate the snd_rawmidi_status_t structure
ptr | returned pointer |
Allocates a new snd_rawmidi_status_t structure using the standard malloc C library function.
size_t snd_rawmidi_status_sizeof | ( | ) |
get size of the snd_rawmidi_status_t structure in bytes
snd_rawmidi_stream_t snd_rawmidi_stream | ( | snd_rawmidi_t * | rawmidi | ) |
get stream (direction) of RawMidi handle
rawmidi | a RawMidi handle |
Returns the stream #snd_rawmidi_stream_t of given RawMidi handle.
ssize_t snd_rawmidi_tread | ( | snd_rawmidi_t * | rawmidi, |
struct timespec * | tstamp, | ||
void * | buffer, | ||
size_t | size ) |
read MIDI bytes from MIDI stream with timestamp
rawmidi | RawMidi handle | |
[out] | tstamp | timestamp for the returned MIDI bytes |
buffer | buffer to store the input MIDI bytes | |
size | input buffer size in bytes |
count | of MIDI bytes otherwise a negative error code |
snd_rawmidi_type_t snd_rawmidi_type | ( | snd_rawmidi_t * | rawmidi | ) |
get type of RawMidi handle
rawmidi | a RawMidi handle |
Returns the type #snd_rawmidi_type_t of given RawMidi handle.
ssize_t snd_rawmidi_write | ( | snd_rawmidi_t * | rawmidi, |
const void * | buffer, | ||
size_t | size ) |
write MIDI bytes to MIDI stream
rawmidi | RawMidi handle |
buffer | buffer containing MIDI bytes |
size | output buffer size in bytes |