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 
27 #ifndef __ALSA_CONTROL_EXTERNAL_H
28 #define __ALSA_CONTROL_EXTERNAL_H
29 
30 #ifndef __ASOUNDLIB_LOCAL
31 #include <alsa/asoundlib.h>
32 #endif
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
46 #define SND_CTL_PLUGIN_ENTRY(name) _snd_ctl_##name##_open
47 
51 #define SND_CTL_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_CTL_PLUGIN_ENTRY(name), SND_CONTROL_DLSYM_VERSION);
52 
56 #define SND_CTL_PLUGIN_DEFINE_FUNC(plugin) \
57 int SND_CTL_PLUGIN_ENTRY(plugin) (snd_ctl_t **handlep, const char *name,\
58  snd_config_t *root, snd_config_t *conf, int mode)
59 
61 typedef struct snd_ctl_ext snd_ctl_ext_t;
65 typedef unsigned long snd_ctl_ext_key_t;
66 #ifdef DOC_HIDDEN
67 /* redefine typedef's for stupid doxygen */
70 #endif
72 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,
73  unsigned int *tlv, unsigned int tlv_size);
74 
75 /*
76  * Protocol version
77  */
78 #define SND_CTL_EXT_VERSION_MAJOR 1
79 #define SND_CTL_EXT_VERSION_MINOR 0
80 #define SND_CTL_EXT_VERSION_TINY 1
84 #define SND_CTL_EXT_VERSION ((SND_CTL_EXT_VERSION_MAJOR<<16) |\
85  (SND_CTL_EXT_VERSION_MINOR<<8) |\
86  (SND_CTL_EXT_VERSION_TINY))
87 
89 struct snd_ctl_ext {
94  unsigned int version;
98  int card_idx;
102  char id[16];
106  char driver[16];
110  char name[32];
114  char longname[80];
118  char mixername[80];
122  int poll_fd;
123 
136 
137  int nonblock;
143  union {
145  const unsigned int *p;
146  } tlv;
147 };
148 
154  void (*close)(snd_ctl_ext_t *ext);
158  int (*elem_count)(snd_ctl_ext_t *ext);
162  int (*elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id);
175  int *type, unsigned int *acc, unsigned int *count);
180  long *imin, long *imax, long *istep);
185  int64_t *imin, int64_t *imax, int64_t *istep);
189  int (*get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
193  int (*get_enumerated_name)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int item,
194  char *name, size_t name_max_len);
198  int (*read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
202  int (*read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
206  int (*read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
210  int (*read_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
211  size_t max_bytes);
219  int (*write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
223  int (*write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
227  int (*write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
231  int (*write_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
232  size_t max_bytes);
240  void (*subscribe_events)(snd_ctl_ext_t *ext, int subscribe);
244  int (*read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask);
252  int (*poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space);
256  int (*poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
257 };
258 
262 typedef enum snd_ctl_ext_access {
263  SND_CTL_EXT_ACCESS_READ = (1<<0),
264  SND_CTL_EXT_ACCESS_WRITE = (1<<1),
265  SND_CTL_EXT_ACCESS_READWRITE = (3<<0),
266  SND_CTL_EXT_ACCESS_VOLATILE = (1<<2),
267  SND_CTL_EXT_ACCESS_TLV_READ = (1<<4),
268  SND_CTL_EXT_ACCESS_TLV_WRITE = (1<<5),
269  SND_CTL_EXT_ACCESS_TLV_READWRITE = (3<<4),
270  SND_CTL_EXT_ACCESS_TLV_COMMAND = (1<<6),
271  SND_CTL_EXT_ACCESS_INACTIVE = (1<<8),
272  SND_CTL_EXT_ACCESS_TLV_CALLBACK = (1<<28),
274 
278 #define SND_CTL_EXT_KEY_NOT_FOUND (snd_ctl_ext_key_t)(-1)
279 
280 int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode);
282 
285 #ifdef __cplusplus
286 }
287 #endif
288 
289 #endif /* __ALSA_CONTROL_EXTERNAL_H */
struct _snd_ctl snd_ctl_t
Definition: control.h:369
struct _snd_ctl_elem_id snd_ctl_elem_id_t
Definition: control.h:88
int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode)
Create an external control plugin instance.
Definition: control_ext.c:708
int snd_ctl_ext_delete(snd_ctl_ext_t *ext)
Delete the external control plugin.
Definition: control_ext.c:739
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:72
snd_ctl_ext snd_ctl_ext_t
Definition: control_external.h:68
snd_ctl_ext_callback snd_ctl_ext_callback_t
Definition: control_external.h:69
unsigned long snd_ctl_ext_key_t
Definition: control_external.h:65
snd_ctl_ext_access_t
Definition: control_external.h:262
Definition: control.h:52
Definition: control_external.h:150
int(* poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
Definition: control_external.h:256
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:193
int(* write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value)
Definition: control_external.h:223
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:179
int(* elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id)
Definition: control_external.h:162
int(* read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value)
Definition: control_external.h:202
int(* read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items)
Definition: control_external.h:206
int(* read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value)
Definition: control_external.h:198
int(* write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value)
Definition: control_external.h:219
void(* subscribe_events)(snd_ctl_ext_t *ext, int subscribe)
Definition: control_external.h:240
void(* free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key)
Definition: control_external.h:170
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:231
int(* poll_descriptors_count)(snd_ctl_ext_t *ext)
Definition: control_external.h:248
snd_ctl_ext_key_t(* find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id)
Definition: control_external.h:166
int(* read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958)
Definition: control_external.h:215
int(* write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items)
Definition: control_external.h:227
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:184
int(* elem_count)(snd_ctl_ext_t *ext)
Definition: control_external.h:158
int(* read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask)
Definition: control_external.h:244
void(* close)(snd_ctl_ext_t *ext)
Definition: control_external.h:154
int(* get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items)
Definition: control_external.h:189
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:174
int(* poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space)
Definition: control_external.h:252
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:210
int(* write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958)
Definition: control_external.h:236
Definition: control_external.h:89
char name[32]
Definition: control_external.h:110
int poll_fd
Definition: control_external.h:122
const snd_ctl_ext_callback_t * callback
Definition: control_external.h:127
int nonblock
Definition: control_external.h:137
char longname[80]
Definition: control_external.h:114
int subscribed
Definition: control_external.h:138
char mixername[80]
Definition: control_external.h:118
void * private_data
Definition: control_external.h:131
int card_idx
Definition: control_external.h:98
char driver[16]
Definition: control_external.h:106
snd_ctl_t * handle
Definition: control_external.h:135
unsigned int version
Definition: control_external.h:94
union snd_ctl_ext::@26 tlv
uint8_t data
Definition: ump_msg.h:6
uint8_t type
Definition: ump_msg.h:1