ALSA project - the C library reference

control_external.h
Go to the documentation of this file.
1
10/*
11 * This library is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as
13 * published by the Free Software Foundation; either version 2.1 of
14 * the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 *
25 */
26#ifndef __ALSA_CONTROL_EXTERNAL_H
27#define __ALSA_CONTROL_EXTERNAL_H
28
29#include "control.h"
30
31#ifdef __cplusplus
32 extern "C" {
33#endif
34
43#define SND_CTL_PLUGIN_ENTRY(name) _snd_ctl_##name##_open
44
48#define SND_CTL_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_CTL_PLUGIN_ENTRY(name), SND_CONTROL_DLSYM_VERSION);
49
53#define SND_CTL_PLUGIN_DEFINE_FUNC(plugin) \
54 int SND_CTL_PLUGIN_ENTRY(plugin) (snd_ctl_t **handlep, const char *name,\
55 snd_config_t *root, snd_config_t *conf, int mode)
56
58 typedef struct snd_ctl_ext snd_ctl_ext_t;
60 typedef struct snd_ctl_ext_callback snd_ctl_ext_callback_t;
62 typedef unsigned long snd_ctl_ext_key_t;
63#ifdef DOC_HIDDEN
64/* redefine typedef's for stupid doxygen */
65 typedef snd_ctl_ext snd_ctl_ext_t;
66 typedef snd_ctl_ext_callback snd_ctl_ext_callback_t;
67#endif
69 typedef int (snd_ctl_ext_tlv_rw_t)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int op_flag, unsigned int numid,
70 unsigned int *tlv, unsigned int tlv_size);
71
72/*
73 * Protocol version
74 */
75#define SND_CTL_EXT_VERSION_MAJOR 1
76#define SND_CTL_EXT_VERSION_MINOR 0
77#define SND_CTL_EXT_VERSION_TINY 1
81#define SND_CTL_EXT_VERSION ((SND_CTL_EXT_VERSION_MAJOR<<16) |\
82 (SND_CTL_EXT_VERSION_MINOR<<8) |\
83 (SND_CTL_EXT_VERSION_TINY))
84
86 struct snd_ctl_ext {
91 unsigned int version;
95 int card_idx;
99 char id[16];
103 char driver[16];
107 char name[32];
111 char longname[80];
115 char mixername[80];
119 int poll_fd;
120
124 const snd_ctl_ext_callback_t *callback;
128 void *private_data;
132 snd_ctl_t *handle;
133
134 int nonblock;
135 int subscribed;
140 union {
141 snd_ctl_ext_tlv_rw_t *c;
142 const unsigned int *p;
143 } tlv;
144};
145
147 struct snd_ctl_ext_callback {
151 void (*close)(snd_ctl_ext_t *ext);
155 int (*elem_count)(snd_ctl_ext_t *ext);
159 int (*elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id);
163 snd_ctl_ext_key_t (*find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id);
167 void (*free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key);
171 int (*get_attribute)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
172 int *type, unsigned int *acc, unsigned int *count);
176 int (*get_integer_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
177 long *imin, long *imax, long *istep);
181 int (*get_integer64_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
182 int64_t *imin, int64_t *imax, int64_t *istep);
186 int (*get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
190 int (*get_enumerated_name)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int item,
191 char *name, size_t name_max_len);
195 int (*read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
199 int (*read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
203 int (*read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
207 int (*read_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
208 size_t max_bytes);
212 int (*read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
216 int (*write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
220 int (*write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
224 int (*write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
228 int (*write_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
229 size_t max_bytes);
233 int (*write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
237 void (*subscribe_events)(snd_ctl_ext_t *ext, int subscribe);
241 int (*read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask);
245 int (*poll_descriptors_count)(snd_ctl_ext_t *ext);
249 int (*poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space);
253 int (*poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
254};
255
259 typedef enum snd_ctl_ext_access {
260 SND_CTL_EXT_ACCESS_READ = (1<<0),
261 SND_CTL_EXT_ACCESS_WRITE = (1<<1),
262 SND_CTL_EXT_ACCESS_READWRITE = (3<<0),
263 SND_CTL_EXT_ACCESS_VOLATILE = (1<<2),
264 SND_CTL_EXT_ACCESS_TLV_READ = (1<<4),
265 SND_CTL_EXT_ACCESS_TLV_WRITE = (1<<5),
266 SND_CTL_EXT_ACCESS_TLV_READWRITE = (3<<4),
267 SND_CTL_EXT_ACCESS_TLV_COMMAND = (1<<6),
268 SND_CTL_EXT_ACCESS_INACTIVE = (1<<8),
269 SND_CTL_EXT_ACCESS_TLV_CALLBACK = (1<<28),
270} snd_ctl_ext_access_t;
271
275#define SND_CTL_EXT_KEY_NOT_FOUND (snd_ctl_ext_key_t)(-1)
276
277 int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode);
278 int snd_ctl_ext_delete(snd_ctl_ext_t *ext);
279
282#ifdef __cplusplus
283}
284#endif
285
286#endif /* __ALSA_CONTROL_EXTERNAL_H */
control.h
Application interface library for the ALSA driver.
snd_ctl_t
struct _snd_ctl snd_ctl_t
Definition: control.h:360
snd_ctl_elem_id_t
struct _snd_ctl_elem_id snd_ctl_elem_id_t
Definition: control.h:82
snd_ctl_ext_tlv_rw_t
int() snd_ctl_ext_tlv_rw_t(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int op_flag, unsigned int numid, unsigned int *tlv, unsigned int tlv_size)
Definition: control_external.h:69
snd_ctl_ext_t
snd_ctl_ext snd_ctl_ext_t
Definition: control_external.h:65
snd_ctl_ext_callback_t
snd_ctl_ext_callback snd_ctl_ext_callback_t
Definition: control_external.h:66
snd_ctl_ext_key_t
unsigned long snd_ctl_ext_key_t
Definition: control_external.h:62
snd_ctl_ext_access_t
snd_ctl_ext_access_t
Definition: control_external.h:259
snd_aes_iec958_t
Definition: control.h:46
snd_ctl_ext_callback
Definition: control_external.h:147
snd_ctl_ext_callback::poll_revents
int(* poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
Definition: control_external.h:253
snd_ctl_ext_callback::get_enumerated_name
int(* get_enumerated_name)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int item, char *name, size_t name_max_len)
Definition: control_external.h:190
snd_ctl_ext_callback::write_integer64
int(* write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value)
Definition: control_external.h:220
snd_ctl_ext_callback::get_integer_info
int(* get_integer_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *imin, long *imax, long *istep)
Definition: control_external.h:176
snd_ctl_ext_callback::elem_list
int(* elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id)
Definition: control_external.h:159
snd_ctl_ext_callback::read_integer64
int(* read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value)
Definition: control_external.h:199
snd_ctl_ext_callback::read_enumerated
int(* read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items)
Definition: control_external.h:203
snd_ctl_ext_callback::read_integer
int(* read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value)
Definition: control_external.h:195
snd_ctl_ext_callback::write_integer
int(* write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value)
Definition: control_external.h:216
snd_ctl_ext_callback::subscribe_events
void(* subscribe_events)(snd_ctl_ext_t *ext, int subscribe)
Definition: control_external.h:237
snd_ctl_ext_callback::free_key
void(* free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key)
Definition: control_external.h:167
snd_ctl_ext_callback::write_bytes
int(* write_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data, size_t max_bytes)
Definition: control_external.h:228
snd_ctl_ext_callback::poll_descriptors_count
int(* poll_descriptors_count)(snd_ctl_ext_t *ext)
Definition: control_external.h:245
snd_ctl_ext_callback::find_elem
snd_ctl_ext_key_t(* find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id)
Definition: control_external.h:163
snd_ctl_ext_callback::read_iec958
int(* read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958)
Definition: control_external.h:212
snd_ctl_ext_callback::write_enumerated
int(* write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items)
Definition: control_external.h:224
snd_ctl_ext_callback::get_integer64_info
int(* get_integer64_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *imin, int64_t *imax, int64_t *istep)
Definition: control_external.h:181
snd_ctl_ext_callback::elem_count
int(* elem_count)(snd_ctl_ext_t *ext)
Definition: control_external.h:155
snd_ctl_ext_callback::read_event
int(* read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask)
Definition: control_external.h:241
snd_ctl_ext_callback::close
void(* close)(snd_ctl_ext_t *ext)
Definition: control_external.h:151
snd_ctl_ext_callback::get_enumerated_info
int(* get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items)
Definition: control_external.h:186
snd_ctl_ext_callback::get_attribute
int(* get_attribute)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int *type, unsigned int *acc, unsigned int *count)
Definition: control_external.h:171
snd_ctl_ext_callback::poll_descriptors
int(* poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space)
Definition: control_external.h:249
snd_ctl_ext_callback::read_bytes
int(* read_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data, size_t max_bytes)
Definition: control_external.h:207
snd_ctl_ext_callback::write_iec958
int(* write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958)
Definition: control_external.h:233
snd_ctl_ext
Definition: control_external.h:86
snd_ctl_ext::name
char name[32]
Definition: control_external.h:107
snd_ctl_ext::poll_fd
int poll_fd
Definition: control_external.h:119
snd_ctl_ext::callback
const snd_ctl_ext_callback_t * callback
Definition: control_external.h:124
snd_ctl_ext::nonblock
int nonblock
Definition: control_external.h:134
snd_ctl_ext::longname
char longname[80]
Definition: control_external.h:111
snd_ctl_ext::subscribed
int subscribed
Definition: control_external.h:135
snd_ctl_ext::mixername
char mixername[80]
Definition: control_external.h:115
snd_ctl_ext::tlv
union snd_ctl_ext::@7 tlv
snd_ctl_ext::private_data
void * private_data
Definition: control_external.h:128
snd_ctl_ext::card_idx
int card_idx
Definition: control_external.h:95
snd_ctl_ext::driver
char driver[16]
Definition: control_external.h:103
snd_ctl_ext::handle
snd_ctl_t * handle
Definition: control_external.h:132
snd_ctl_ext::version
unsigned int version
Definition: control_external.h:91