ALSA project - the C library reference

Loading...
Searching...
No Matches
rawmidi.h
Go to the documentation of this file.
1
11/*
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as
14 * published by the Free Software Foundation; either version 2.1 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 *
26 */
27
28#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
29/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
30#warning "use #include <alsa/asoundlib.h>, <alsa/rawmidi.h> should not be used directly"
31#include <alsa/asoundlib.h>
32#endif
33
34#ifndef __ALSA_RAWMIDI_H
35#define __ALSA_RAWMIDI_H
37#ifdef __cplusplus
38 extern "C" {
39#endif
40
48#define SND_RAWMIDI_DLSYM_VERSION _dlsym_rawmidi_001
49
51 typedef struct _snd_rawmidi_info snd_rawmidi_info_t;
53 typedef struct _snd_rawmidi_params snd_rawmidi_params_t;
55 typedef struct _snd_rawmidi_status snd_rawmidi_status_t;
56
58 typedef enum _snd_rawmidi_stream {
60 SND_RAWMIDI_STREAM_OUTPUT = 0,
62 SND_RAWMIDI_STREAM_INPUT,
63 SND_RAWMIDI_STREAM_LAST = SND_RAWMIDI_STREAM_INPUT
64} snd_rawmidi_stream_t;
65
67#define SND_RAWMIDI_APPEND 0x0001
69#define SND_RAWMIDI_NONBLOCK 0x0002
71#define SND_RAWMIDI_SYNC 0x0004
72
74 typedef struct _snd_rawmidi snd_rawmidi_t;
75
77 typedef enum _snd_rawmidi_type {
79 SND_RAWMIDI_TYPE_HW,
81 SND_RAWMIDI_TYPE_SHM,
83 SND_RAWMIDI_TYPE_INET,
85 SND_RAWMIDI_TYPE_VIRTUAL
86} snd_rawmidi_type_t;
87
89 typedef enum _snd_rawmidi_clock {
90 SND_RAWMIDI_CLOCK_NONE = 0,
91 SND_RAWMIDI_CLOCK_REALTIME = 1,
92 SND_RAWMIDI_CLOCK_MONOTONIC = 2,
93 SND_RAWMIDI_CLOCK_MONOTONIC_RAW = 3,
94} snd_rawmidi_clock_t;
95
97 typedef enum _snd_rawmidi_read_mode {
98 SND_RAWMIDI_READ_STANDARD = 0,
99 SND_RAWMIDI_READ_TSTAMP = 1,
100} snd_rawmidi_read_mode_t;
101
103#define SND_RAWMIDI_INFO_UMP 0x00000008
104#define SND_RAWMIDI_INFO_STREAM_INACTIVE 0x00000010
105#ifndef SNDRV_RAWMIDI_INFO_STREAM_INACTIVE
106#define SNDRV_RAWMIDI_INFO_STREAM_INACTIVE SND_RAWMIDI_INFO_STREAM_INACTIVE
107#endif
108
109 int snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
110 const char *name, int mode);
111 int snd_rawmidi_open_lconf(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
112 const char *name, int mode, snd_config_t *lconf);
113 int snd_rawmidi_close(snd_rawmidi_t *rmidi);
114 int snd_rawmidi_poll_descriptors_count(snd_rawmidi_t *rmidi);
115 int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rmidi, struct pollfd *pfds, unsigned int space);
116 int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revent);
117 int snd_rawmidi_nonblock(snd_rawmidi_t *rmidi, int nonblock);
118 size_t snd_rawmidi_info_sizeof(void);
123#define snd_rawmidi_info_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_info)
124 int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr);
125 void snd_rawmidi_info_free(snd_rawmidi_info_t *obj);
126 void snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src);
127 unsigned int snd_rawmidi_info_get_device(const snd_rawmidi_info_t *obj);
128 unsigned int snd_rawmidi_info_get_subdevice(const snd_rawmidi_info_t *obj);
129 snd_rawmidi_stream_t snd_rawmidi_info_get_stream(const snd_rawmidi_info_t *obj);
130 int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj);
131 unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj);
132 const char *snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj);
133 const char *snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj);
134 const char *snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj);
135 unsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *obj);
136 unsigned int snd_rawmidi_info_get_subdevices_avail(const snd_rawmidi_info_t *obj);
137 int snd_rawmidi_info_get_tied_device(const snd_rawmidi_info_t *obj);
138 void snd_rawmidi_info_set_device(snd_rawmidi_info_t *obj, unsigned int val);
139 void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val);
140 void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);
141 int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info);
142 size_t snd_rawmidi_params_sizeof(void);
147#define snd_rawmidi_params_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_params)
148 int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr);
149 void snd_rawmidi_params_free(snd_rawmidi_params_t *obj);
150 void snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src);
151 int snd_rawmidi_params_set_buffer_size(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
152 size_t snd_rawmidi_params_get_buffer_size(const snd_rawmidi_params_t *params);
153 int snd_rawmidi_params_set_avail_min(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
154 size_t snd_rawmidi_params_get_avail_min(const snd_rawmidi_params_t *params);
155 int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, int val);
156 int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params);
157 int snd_rawmidi_params_set_read_mode(const snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, snd_rawmidi_read_mode_t val);
158 snd_rawmidi_read_mode_t snd_rawmidi_params_get_read_mode(const snd_rawmidi_params_t *params);
159 int snd_rawmidi_params_set_clock_type(const snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, snd_rawmidi_clock_t val);
160 snd_rawmidi_clock_t snd_rawmidi_params_get_clock_type(const snd_rawmidi_params_t *params);
161
162 int snd_rawmidi_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params);
163 int snd_rawmidi_params_current(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params);
164 size_t snd_rawmidi_status_sizeof(void);
169#define snd_rawmidi_status_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_status)
170 int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr);
171 void snd_rawmidi_status_free(snd_rawmidi_status_t *obj);
172 void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src);
173 void snd_rawmidi_status_get_tstamp(const snd_rawmidi_status_t *obj, snd_htimestamp_t *ptr);
174 size_t snd_rawmidi_status_get_avail(const snd_rawmidi_status_t *obj);
175 size_t snd_rawmidi_status_get_xruns(const snd_rawmidi_status_t *obj);
176 int snd_rawmidi_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status);
177 int snd_rawmidi_drain(snd_rawmidi_t *rmidi);
178 int snd_rawmidi_drop(snd_rawmidi_t *rmidi);
179ssize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size);
180ssize_t snd_rawmidi_read(snd_rawmidi_t *rmidi, void *buffer, size_t size);
181ssize_t snd_rawmidi_tread(snd_rawmidi_t *rmidi, struct timespec *tstamp, void *buffer, size_t size);
182 const char *snd_rawmidi_name(snd_rawmidi_t *rmidi);
183 snd_rawmidi_type_t snd_rawmidi_type(snd_rawmidi_t *rmidi);
184 snd_rawmidi_stream_t snd_rawmidi_stream(snd_rawmidi_t *rawmidi);
185
188#ifdef __cplusplus
189}
190#endif
191
192#endif /* __RAWMIDI_H */
193
snd_config_t
struct _snd_config snd_config_t
Internal structure for a configuration node object.
Definition conf.h:74
snd_htimestamp_t
struct timespec snd_htimestamp_t
Definition global.h:157
snd_rawmidi_drop
int snd_rawmidi_drop(snd_rawmidi_t *rmidi)
drop all bytes in the rawmidi I/O ring buffer immediately
Definition rawmidi.c:1070
snd_rawmidi_write
ssize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size)
write MIDI bytes to MIDI stream
Definition rawmidi.c:1096
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
Definition rawmidi.c:778
snd_rawmidi_status_t
struct _snd_rawmidi_status snd_rawmidi_status_t
Definition rawmidi.h:55
snd_rawmidi_info_malloc
int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr)
allocate a new snd_rawmidi_info_t structure
Definition rawmidi.c:499
snd_rawmidi_clock_t
snd_rawmidi_clock_t
Definition rawmidi.h:89
snd_rawmidi_info_get_id
const char * snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj)
get rawmidi hardware driver identifier
Definition rawmidi.c:592
snd_rawmidi_poll_descriptors
int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rmidi, struct pollfd *pfds, unsigned int space)
get poll descriptors
Definition rawmidi.c:430
snd_rawmidi_type_t
snd_rawmidi_type_t
Definition rawmidi.h:77
snd_rawmidi_stream
snd_rawmidi_stream_t snd_rawmidi_stream(snd_rawmidi_t *rawmidi)
get stream (direction) of RawMidi handle
Definition rawmidi.c:406
snd_rawmidi_open
int snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi, const char *name, int mode)
Opens a new connection to the RawMidi interface.
Definition rawmidi.c:312
snd_rawmidi_info_sizeof
size_t snd_rawmidi_info_sizeof(void)
get size of the snd_rawmidi_info_t structure in bytes
Definition rawmidi.c:486
snd_rawmidi_poll_descriptors_revents
int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revent)
get returned events from poll descriptors
Definition rawmidi.c:449
snd_rawmidi_poll_descriptors_count
int snd_rawmidi_poll_descriptors_count(snd_rawmidi_t *rmidi)
get count of poll descriptors for RawMidi handle
Definition rawmidi.c:417
snd_rawmidi_info
int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t *info)
get information about RawMidi handle
Definition rawmidi.c:697
snd_rawmidi_info_get_subdevice
unsigned int snd_rawmidi_info_get_subdevice(const snd_rawmidi_info_t *obj)
get rawmidi subdevice number
Definition rawmidi.c:548
snd_rawmidi_params
int snd_rawmidi_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params)
set parameters about rawmidi stream
Definition rawmidi.c:937
snd_rawmidi_info_get_card
int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj)
get rawmidi card number
Definition rawmidi.c:570
snd_rawmidi_info_set_subdevice
void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val)
set rawmidi subdevice number
Definition rawmidi.c:674
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
Definition rawmidi.c:884
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
Definition rawmidi.c:748
snd_rawmidi_info_get_tied_device
int snd_rawmidi_info_get_tied_device(const snd_rawmidi_info_t *obj)
get the tied device number for the given rawmidi device
Definition rawmidi.c:650
snd_rawmidi_tread
ssize_t snd_rawmidi_tread(snd_rawmidi_t *rmidi, struct timespec *tstamp, void *buffer, size_t size)
read MIDI bytes from MIDI stream with timestamp
Definition rawmidi.c:1129
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
Definition rawmidi.c:854
snd_rawmidi_type
snd_rawmidi_type_t snd_rawmidi_type(snd_rawmidi_t *rmidi)
get type of RawMidi handle
Definition rawmidi.c:393
snd_rawmidi_params_set_buffer_size
int snd_rawmidi_params_set_buffer_size(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val)
set rawmidi I/O ring buffer size
Definition rawmidi.c:764
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
Definition rawmidi.c:836
snd_rawmidi_info_get_name
const char * snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj)
get rawmidi hardware driver name
Definition rawmidi.c:603
snd_rawmidi_info_get_subdevices_avail
unsigned int snd_rawmidi_info_get_subdevices_avail(const snd_rawmidi_info_t *obj)
get rawmidi available count of subdevices
Definition rawmidi.c:636
snd_rawmidi_info_get_stream
snd_rawmidi_stream_t snd_rawmidi_info_get_stream(const snd_rawmidi_info_t *obj)
get rawmidi stream identification
Definition rawmidi.c:559
snd_rawmidi_status_sizeof
size_t snd_rawmidi_status_sizeof(void)
get size of the snd_rawmidi_status_t structure in bytes
Definition rawmidi.c:973
snd_rawmidi_status_get_avail
size_t snd_rawmidi_status_get_avail(const snd_rawmidi_status_t *obj)
get current available bytes in the rawmidi I/O ring buffer
Definition rawmidi.c:1035
snd_rawmidi_params_current
int snd_rawmidi_params_current(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params)
get current parameters about rawmidi stream
Definition rawmidi.c:958
snd_rawmidi_params_set_avail_min
int snd_rawmidi_params_set_avail_min(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val)
set minimum available bytes in rawmidi I/O ring buffer for wakeup
Definition rawmidi.c:793
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
Definition rawmidi.c:907
snd_rawmidi_params_t
struct _snd_rawmidi_params snd_rawmidi_params_t
Definition rawmidi.h:53
snd_rawmidi_info_set_device
void snd_rawmidi_info_set_device(snd_rawmidi_info_t *obj, unsigned int val)
set rawmidi device number
Definition rawmidi.c:663
snd_rawmidi_read
ssize_t snd_rawmidi_read(snd_rawmidi_t *rmidi, void *buffer, size_t size)
read MIDI bytes from MIDI stream
Definition rawmidi.c:1111
snd_rawmidi_t
struct _snd_rawmidi snd_rawmidi_t
Definition rawmidi.h:74
snd_rawmidi_open_lconf
int snd_rawmidi_open_lconf(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi, const char *name, int mode, snd_config_t *lconf)
Opens a new connection to the RawMidi interface using local configuration.
Definition rawmidi.c:345
snd_rawmidi_info_free
void snd_rawmidi_info_free(snd_rawmidi_info_t *obj)
frees the snd_rawmidi_info_t structure
Definition rawmidi.c:515
snd_rawmidi_info_t
struct _snd_rawmidi_info snd_rawmidi_info_t
Definition rawmidi.h:51
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
Definition rawmidi.c:1013
snd_rawmidi_params_set_no_active_sensing
int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, int val)
set no-active-sensing action on snd_rawmidi_close()
Definition rawmidi.c:823
snd_rawmidi_status
int snd_rawmidi_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t *status)
get status of rawmidi stream
Definition rawmidi.c:1058
snd_rawmidi_close
int snd_rawmidi_close(snd_rawmidi_t *rmidi)
close RawMidi handle
Definition rawmidi.c:360
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
Definition rawmidi.c:526
snd_rawmidi_drain
int snd_rawmidi_drain(snd_rawmidi_t *rmidi)
drain all bytes in the rawmidi I/O ring buffer
Definition rawmidi.c:1084
snd_rawmidi_info_get_subdevices_count
unsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *obj)
get rawmidi count of subdevices
Definition rawmidi.c:625
snd_rawmidi_status_malloc
int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr)
allocate the snd_rawmidi_status_t structure
Definition rawmidi.c:986
snd_rawmidi_stream_t
snd_rawmidi_stream_t
Definition rawmidi.h:58
snd_rawmidi_status_free
void snd_rawmidi_status_free(snd_rawmidi_status_t *obj)
frees the snd_rawmidi_status_t structure
Definition rawmidi.c:1002
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)
Definition rawmidi.c:924
snd_rawmidi_info_get_device
unsigned int snd_rawmidi_info_get_device(const snd_rawmidi_info_t *obj)
get rawmidi device number
Definition rawmidi.c:537
snd_rawmidi_info_set_stream
void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val)
set rawmidi stream identifier
Definition rawmidi.c:685
snd_rawmidi_params_free
void snd_rawmidi_params_free(snd_rawmidi_params_t *obj)
frees the snd_rawmidi_params_t structure
Definition rawmidi.c:737
snd_rawmidi_status_get_xruns
size_t snd_rawmidi_status_get_xruns(const snd_rawmidi_status_t *obj)
get count of xruns
Definition rawmidi.c:1046
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
Definition rawmidi.c:807
snd_rawmidi_info_get_subdevice_name
const char * snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj)
get rawmidi subdevice name
Definition rawmidi.c:614
snd_rawmidi_params_sizeof
size_t snd_rawmidi_params_sizeof(void)
get size of the snd_rawmidi_params_t structure in bytes
Definition rawmidi.c:708
snd_rawmidi_status_get_tstamp
void snd_rawmidi_status_get_tstamp(const snd_rawmidi_status_t *obj, snd_htimestamp_t *ptr)
get the start timestamp
Definition rawmidi.c:1024
snd_rawmidi_params_malloc
int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr)
allocate the snd_rawmidi_params_t structure
Definition rawmidi.c:721
snd_rawmidi_name
const char * snd_rawmidi_name(snd_rawmidi_t *rmidi)
get identifier of RawMidi handle
Definition rawmidi.c:380
snd_rawmidi_info_get_flags
unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj)
get rawmidi flags
Definition rawmidi.c:581
snd_rawmidi_read_mode_t
snd_rawmidi_read_mode_t
Definition rawmidi.h:97
snd_rawmidi_nonblock
int snd_rawmidi_nonblock(snd_rawmidi_t *rmidi, int nonblock)
set nonblock mode
Definition rawmidi.c:468
SND_RAWMIDI_TYPE_SHM
@ SND_RAWMIDI_TYPE_SHM
Definition rawmidi.h:81
SND_RAWMIDI_TYPE_HW
@ SND_RAWMIDI_TYPE_HW
Definition rawmidi.h:79
SND_RAWMIDI_TYPE_INET
@ SND_RAWMIDI_TYPE_INET
Definition rawmidi.h:83
SND_RAWMIDI_TYPE_VIRTUAL
@ SND_RAWMIDI_TYPE_VIRTUAL
Definition rawmidi.h:85
SND_RAWMIDI_STREAM_INPUT
@ SND_RAWMIDI_STREAM_INPUT
Definition rawmidi.h:62
SND_RAWMIDI_STREAM_OUTPUT
@ SND_RAWMIDI_STREAM_OUTPUT
Definition rawmidi.h:60
status
uint8_t status
Definition ump_msg.h:3