ALSA project - the C library reference
Loading...
Searching...
No Matches
rawmidi.c File 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
 

Detailed Description

RawMidi Interface.

Author
Jaroslav Kysela perex.nosp@m.@per.nosp@m.ex.cz
Abramo Bagnara abram.nosp@m.o@al.nosp@m.sa-pr.nosp@m.ojec.nosp@m.t.org
Date
2000-2001

See the RawMidi interface page for more details.

Function Documentation

◆ snd_rawmidi_close()

int snd_rawmidi_close ( snd_rawmidi_t * rawmidi)

close RawMidi handle

Parameters
rawmidiRawMidi handle
Returns
0 on success otherwise a negative error code

Closes the specified RawMidi handle and frees all associated resources.

Examples
/test/rawmidi.c.

◆ snd_rawmidi_drain()

int snd_rawmidi_drain ( snd_rawmidi_t * rawmidi)

drain all bytes in the rawmidi I/O ring buffer

Parameters
rawmidiRawMidi handle
Returns
0 on success otherwise a negative error code

Waits until all MIDI bytes are not drained (sent) to the hardware device.

Examples
/test/rawmidi.c.

◆ snd_rawmidi_drop()

int snd_rawmidi_drop ( snd_rawmidi_t * rawmidi)

drop all bytes in the rawmidi I/O ring buffer immediately

Parameters
rawmidiRawMidi handle
Returns
0 on success otherwise a negative error code

◆ snd_rawmidi_info()

int snd_rawmidi_info ( snd_rawmidi_t * rawmidi,
snd_rawmidi_info_t * info )

get information about RawMidi handle

Parameters
rawmidiRawMidi handle
infopointer to a snd_rawmidi_info_t structure to be filled
Returns
0 on success otherwise a negative error code

◆ snd_rawmidi_info_copy()

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

Parameters
dstdestination snd_rawmidi_info_t structure
srcsource snd_rawmidi_info_t structure

◆ snd_rawmidi_info_free()

void snd_rawmidi_info_free ( snd_rawmidi_info_t * info)

frees the snd_rawmidi_info_t structure

Parameters
infopointer to the snd_rawmidi_info_t structure to free

Frees the given snd_rawmidi_params_t structure using the standard free C library function.

◆ snd_rawmidi_info_get_card()

int snd_rawmidi_info_get_card ( const snd_rawmidi_info_t * info)

get rawmidi card number

Parameters
infopointer to a snd_rawmidi_info_t structure
Returns
rawmidi card number

◆ snd_rawmidi_info_get_device()

unsigned int snd_rawmidi_info_get_device ( const snd_rawmidi_info_t * info)

get rawmidi device number

Parameters
infopointer to a snd_rawmidi_info_t structure
Returns
rawmidi device number

◆ snd_rawmidi_info_get_flags()

unsigned int snd_rawmidi_info_get_flags ( const snd_rawmidi_info_t * info)

get rawmidi flags

Parameters
infopointer to a snd_rawmidi_info_t structure
Returns
rawmidi flags

◆ snd_rawmidi_info_get_id()

const char * snd_rawmidi_info_get_id ( const snd_rawmidi_info_t * info)

get rawmidi hardware driver identifier

Parameters
infopointer to a snd_rawmidi_info_t structure
Returns
rawmidi hardware driver identifier

◆ snd_rawmidi_info_get_name()

const char * snd_rawmidi_info_get_name ( const snd_rawmidi_info_t * info)

get rawmidi hardware driver name

Parameters
infopointer to a snd_rawmidi_info_t structure
Returns
rawmidi hardware driver name

◆ snd_rawmidi_info_get_stream()

snd_rawmidi_stream_t snd_rawmidi_info_get_stream ( const snd_rawmidi_info_t * info)

get rawmidi stream identification

Parameters
infopointer to a snd_rawmidi_info_t structure
Returns
rawmidi stream identification

◆ snd_rawmidi_info_get_subdevice()

unsigned int snd_rawmidi_info_get_subdevice ( const snd_rawmidi_info_t * info)

get rawmidi subdevice number

Parameters
infopointer to a snd_rawmidi_info_t structure
Returns
rawmidi subdevice number

◆ snd_rawmidi_info_get_subdevice_name()

const char * snd_rawmidi_info_get_subdevice_name ( const snd_rawmidi_info_t * info)

get rawmidi subdevice name

Parameters
infopointer to a snd_rawmidi_info_t structure
Returns
rawmidi subdevice name

◆ snd_rawmidi_info_get_subdevices_avail()

unsigned int snd_rawmidi_info_get_subdevices_avail ( const snd_rawmidi_info_t * info)

get rawmidi available count of subdevices

Parameters
infopointer to a snd_rawmidi_info_t structure
Returns
rawmidi available count of subdevices

◆ snd_rawmidi_info_get_subdevices_count()

unsigned int snd_rawmidi_info_get_subdevices_count ( const snd_rawmidi_info_t * info)

get rawmidi count of subdevices

Parameters
infopointer to a snd_rawmidi_info_t structure
Returns
rawmidi count of subdevices

◆ snd_rawmidi_info_get_tied_device()

int snd_rawmidi_info_get_tied_device ( const snd_rawmidi_info_t * info)

get the tied device number for the given rawmidi device

Parameters
infopointer to a snd_rawmidi_info_t structure
Returns
the device number for the tied device, or -1 if untied / unknown.

This function is useful for UMP rawmidi devices where each of them may have the mirroring legacy rawmidi device. Those are shown as "tied".

◆ snd_rawmidi_info_malloc()

int snd_rawmidi_info_malloc ( snd_rawmidi_info_t ** info)

allocate a new snd_rawmidi_info_t structure

Parameters
inforeturned pointer
Returns
0 on success otherwise a negative error code if fails

Allocates a new snd_rawmidi_params_t structure using the standard malloc C library function.

◆ snd_rawmidi_info_set_device()

void snd_rawmidi_info_set_device ( snd_rawmidi_info_t * info,
unsigned int val )

set rawmidi device number

Parameters
infopointer to a snd_rawmidi_info_t structure
valdevice number

◆ snd_rawmidi_info_set_stream()

void snd_rawmidi_info_set_stream ( snd_rawmidi_info_t * info,
snd_rawmidi_stream_t val )

set rawmidi stream identifier

Parameters
infopointer to a snd_rawmidi_info_t structure
valrawmidi stream identifier

◆ snd_rawmidi_info_set_subdevice()

void snd_rawmidi_info_set_subdevice ( snd_rawmidi_info_t * info,
unsigned int val )

set rawmidi subdevice number

Parameters
infopointer to a snd_rawmidi_info_t structure
valsubdevice number

◆ snd_rawmidi_info_sizeof()

size_t snd_rawmidi_info_sizeof ( )

get size of the snd_rawmidi_info_t structure in bytes

Returns
size of the snd_rawmidi_info_t structure in bytes

◆ snd_rawmidi_name()

const char * snd_rawmidi_name ( snd_rawmidi_t * rawmidi)

get identifier of RawMidi handle

Parameters
rawmidia RawMidi handle
Returns
ascii identifier of RawMidi handle

Returns the ASCII identifier of given RawMidi handle. It's the same identifier specified in snd_rawmidi_open().

◆ snd_rawmidi_nonblock()

int snd_rawmidi_nonblock ( snd_rawmidi_t * rawmidi,
int nonblock )

set nonblock mode

Parameters
rawmidiRawMidi handle
nonblock0 = block, 1 = nonblock mode
Returns
0 on success otherwise a negative error code

The nonblock mode cannot be used when the stream is in #SND_RAWMIDI_APPEND state.

◆ snd_rawmidi_open()

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.

Parameters
inputpReturned input handle (NULL if not wanted)
outputpReturned output handle (NULL if not wanted)
nameASCII identifier of the RawMidi handle
modeOpen mode
Returns
0 on success otherwise a negative error code

Opens a new connection to the RawMidi interface specified with an ASCII identifier and mode.

Examples
/test/rawmidi.c.

◆ snd_rawmidi_open_lconf()

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.

Parameters
inputpReturned input handle (NULL if not wanted)
outputpReturned output handle (NULL if not wanted)
nameASCII identifier of the RawMidi handle
modeOpen mode
lconfLocal configuration
Returns
0 on success otherwise a negative error code

Opens a new connection to the RawMidi interface specified with an ASCII identifier and mode.

◆ snd_rawmidi_params()

int snd_rawmidi_params ( snd_rawmidi_t * rawmidi,
snd_rawmidi_params_t * params )

set parameters about rawmidi stream

Parameters
rawmidiRawMidi handle
paramspointer to a snd_rawmidi_params_t structure to be filled
Returns
0 on success otherwise a negative error code
Examples
/test/rawmidi.c.

◆ snd_rawmidi_params_copy()

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

Parameters
dstdestination snd_rawmidi_params_t structure
srcsource snd_rawmidi_params_t structure

◆ snd_rawmidi_params_current()

int snd_rawmidi_params_current ( snd_rawmidi_t * rawmidi,
snd_rawmidi_params_t * params )

get current parameters about rawmidi stream

Parameters
rawmidiRawMidi handle
paramspointer to a snd_rawmidi_params_t structure to be filled
Returns
0 on success otherwise a negative error code
Examples
/test/rawmidi.c.

◆ snd_rawmidi_params_free()

void snd_rawmidi_params_free ( snd_rawmidi_params_t * params)

frees the snd_rawmidi_params_t structure

Parameters
paramspointer to the #snd_rawmidi_params_t structure to free

Frees the given snd_rawmidi_params_t structure using the standard free C library function.

Examples
/test/rawmidi.c.

◆ snd_rawmidi_params_get_avail_min()

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

Parameters
paramspointer to snd_rawmidi_params_t structure
Returns
minimum available bytes

◆ snd_rawmidi_params_get_buffer_size()

size_t snd_rawmidi_params_get_buffer_size ( const snd_rawmidi_params_t * params)

get rawmidi I/O ring buffer size

Parameters
paramspointer to a snd_rawmidi_params_t structure
Returns
size of rawmidi I/O ring buffer in bytes

◆ snd_rawmidi_params_get_clock_type()

snd_rawmidi_clock_t snd_rawmidi_params_get_clock_type ( const snd_rawmidi_params_t * params)

get current clock type (for tstamp type framing)

Parameters
paramspointer to snd_rawmidi_params_t structure
Returns
the current clock type (one of the SND_RAWMIDI_CLOCK_* constants)

◆ snd_rawmidi_params_get_no_active_sensing()

int snd_rawmidi_params_get_no_active_sensing ( const snd_rawmidi_params_t * params)

get no-active-sensing action status

Parameters
paramspointer to snd_rawmidi_params_t structure
Returns
the current status (0 = enable, 1 = disable the active sensing message)

◆ snd_rawmidi_params_get_read_mode()

snd_rawmidi_read_mode_t snd_rawmidi_params_get_read_mode ( const snd_rawmidi_params_t * params)

get current read mode

Parameters
paramspointer to snd_rawmidi_params_t structure
Returns
the current read mode (see enum)

◆ snd_rawmidi_params_malloc()

int snd_rawmidi_params_malloc ( snd_rawmidi_params_t ** params)

allocate the snd_rawmidi_params_t structure

Parameters
paramsreturned pointer
Returns
0 on success otherwise a negative error code if fails

Allocates a new snd_rawmidi_params_t structure using the standard malloc C library function.

Examples
/test/rawmidi.c.

◆ snd_rawmidi_params_set_avail_min()

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

Parameters
rawmidiRawMidi handle
paramspointer to a snd_rawmidi_params_t structure
valdesired value

◆ snd_rawmidi_params_set_buffer_size()

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

Parameters
rawmidiRawMidi handle
paramspointer to a snd_rawmidi_params_t structure
valsize in bytes
Returns
0 on success otherwise a negative error code

◆ snd_rawmidi_params_set_clock_type()

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

Parameters
rawmidiRawMidi handle
paramspointer to snd_rawmidi_params_t structure
valone of the SND_RAWMIDI_CLOCK_* constants
Returns
0 on success, otherwise a negative error code.

Notable error codes: -EINVAL - "val" is invalid -ENOTSUP - Kernel is too old to support framing.

Examples
/test/rawmidi.c.

◆ snd_rawmidi_params_set_no_active_sensing()

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

Parameters
rawmidiRawMidi handle
paramspointer to snd_rawmidi_params_t structure
valvalue: 0 = enable to send the active sensing message, 1 = disable
Returns
0 on success otherwise a negative error code

◆ snd_rawmidi_params_set_read_mode()

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

Parameters
rawmidiRawMidi handle
paramspointer to snd_rawmidi_params_t structure
valtype of read_mode
Returns
0 on success, otherwise a negative error code.

Notable error codes: -EINVAL - "val" is invalid -ENOTSUP - mode is not supported

Examples
/test/rawmidi.c.

◆ snd_rawmidi_params_sizeof()

size_t snd_rawmidi_params_sizeof ( )

get size of the snd_rawmidi_params_t structure in bytes

Returns
size of the snd_rawmidi_params_t structure in bytes

◆ snd_rawmidi_poll_descriptors()

int snd_rawmidi_poll_descriptors ( snd_rawmidi_t * rawmidi,
struct pollfd * pfds,
unsigned int space )

get poll descriptors

Parameters
rawmidiRawMidi handle
pfdsarray of poll descriptors
spacespace in the poll descriptor array
Returns
count of filled descriptors

◆ snd_rawmidi_poll_descriptors_count()

int snd_rawmidi_poll_descriptors_count ( snd_rawmidi_t * rawmidi)

get count of poll descriptors for RawMidi handle

Parameters
rawmidiRawMidi handle
Returns
count of poll descriptors

◆ snd_rawmidi_poll_descriptors_revents()

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

Parameters
rawmidirawmidi RawMidi handle
pfdsarray of poll descriptors
nfdscount of poll descriptors
reventsreturned events
Returns
zero if success, otherwise a negative error code

◆ snd_rawmidi_read()

ssize_t snd_rawmidi_read ( snd_rawmidi_t * rawmidi,
void * buffer,
size_t size )

read MIDI bytes from MIDI stream

Parameters
rawmidiRawMidi handle
bufferbuffer to store the input MIDI bytes
sizeinput buffer size in bytes
Return values
countof MIDI bytes otherwise a negative error code
Examples
/test/rawmidi.c.

◆ snd_rawmidi_status()

int snd_rawmidi_status ( snd_rawmidi_t * rawmidi,
snd_rawmidi_status_t * status )

get status of rawmidi stream

Parameters
rawmidiRawMidi handle
statuspointer to a snd_rawmidi_status_t structure to be filled
Returns
0 on success otherwise a negative error code

◆ snd_rawmidi_status_copy()

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

Parameters
dstdestination snd_rawmidi_status_t structure
srcsource snd_rawmidi_status_t structure

◆ snd_rawmidi_status_free()

void snd_rawmidi_status_free ( snd_rawmidi_status_t * status)

frees the snd_rawmidi_status_t structure

Parameters
statuspointer to the snd_rawmidi_status_t structure to free

Frees the given snd_rawmidi_status_t structure using the standard free C library function.

◆ snd_rawmidi_status_get_avail()

size_t snd_rawmidi_status_get_avail ( const snd_rawmidi_status_t * status)

get current available bytes in the rawmidi I/O ring buffer

Parameters
statuspointer to a snd_rawmidi_status_t structure
Returns
current available bytes in the rawmidi I/O ring buffer

◆ snd_rawmidi_status_get_tstamp()

void snd_rawmidi_status_get_tstamp ( const snd_rawmidi_status_t * status,
snd_htimestamp_t * tstamp )

get the start timestamp

Parameters
statuspointer to a snd_rawmidi_status_t structure
tstampreturned timestamp value

◆ snd_rawmidi_status_get_xruns()

size_t snd_rawmidi_status_get_xruns ( const snd_rawmidi_status_t * status)

get count of xruns

Parameters
statuspointer to a snd_rawmidi_status_t structure
Returns
count of xruns

◆ snd_rawmidi_status_malloc()

int snd_rawmidi_status_malloc ( snd_rawmidi_status_t ** ptr)

allocate the snd_rawmidi_status_t structure

Parameters
ptrreturned pointer
Returns
0 on success otherwise a negative error code if fails

Allocates a new snd_rawmidi_status_t structure using the standard malloc C library function.

◆ snd_rawmidi_status_sizeof()

size_t snd_rawmidi_status_sizeof ( )

get size of the snd_rawmidi_status_t structure in bytes

Returns
size of the snd_rawmidi_status_t structure in bytes

◆ snd_rawmidi_stream()

snd_rawmidi_stream_t snd_rawmidi_stream ( snd_rawmidi_t * rawmidi)

get stream (direction) of RawMidi handle

Parameters
rawmidia RawMidi handle
Returns
stream of RawMidi handle

Returns the stream #snd_rawmidi_stream_t of given RawMidi handle.

◆ snd_rawmidi_tread()

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

Parameters
rawmidiRawMidi handle
[out]tstamptimestamp for the returned MIDI bytes
bufferbuffer to store the input MIDI bytes
sizeinput buffer size in bytes
Return values
countof MIDI bytes otherwise a negative error code
Examples
/test/rawmidi.c.

◆ snd_rawmidi_type()

snd_rawmidi_type_t snd_rawmidi_type ( snd_rawmidi_t * rawmidi)

get type of RawMidi handle

Parameters
rawmidia RawMidi handle
Returns
type of RawMidi handle

Returns the type #snd_rawmidi_type_t of given RawMidi handle.

◆ snd_rawmidi_write()

ssize_t snd_rawmidi_write ( snd_rawmidi_t * rawmidi,
const void * buffer,
size_t size )

write MIDI bytes to MIDI stream

Parameters
rawmidiRawMidi handle
bufferbuffer containing MIDI bytes
sizeoutput buffer size in bytes
Examples
/test/rawmidi.c.