ALSA project - the C library reference
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 
64 /*
65  * Protocol version
66  */
67 #define SND_CTL_EXT_VERSION_MAJOR 1
68 #define SND_CTL_EXT_VERSION_MINOR 0
69 #define SND_CTL_EXT_VERSION_TINY 0
73 #define SND_CTL_EXT_VERSION ((SND_CTL_EXT_VERSION_MAJOR<<16) |\
74  (SND_CTL_EXT_VERSION_MINOR<<8) |\
75  (SND_CTL_EXT_VERSION_TINY))
76 
78 struct snd_ctl_ext {
83  unsigned int version;
87  int card_idx;
91  char id[16];
95  char driver[16];
99  char name[32];
103  char longname[80];
107  char mixername[80];
111  int poll_fd;
112 
116  const snd_ctl_ext_callback_t *callback;
125 
126  int nonblock;
128 };
129 
135  void (*close)(snd_ctl_ext_t *ext);
139  int (*elem_count)(snd_ctl_ext_t *ext);
143  int (*elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id);
147  snd_ctl_ext_key_t (*find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id);
151  void (*free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key);
155  int (*get_attribute)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
156  int *type, unsigned int *acc, unsigned int *count);
160  int (*get_integer_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
161  long *imin, long *imax, long *istep);
165  int (*get_integer64_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
166  int64_t *imin, int64_t *imax, int64_t *istep);
170  int (*get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
174  int (*get_enumerated_name)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int item,
175  char *name, size_t name_max_len);
179  int (*read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
183  int (*read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
187  int (*read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
191  int (*read_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
192  size_t max_bytes);
196  int (*read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
200  int (*write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
204  int (*write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
208  int (*write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
212  int (*write_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
213  size_t max_bytes);
217  int (*write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
221  void (*subscribe_events)(snd_ctl_ext_t *ext, int subscribe);
225  int (*read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask);
229  int (*poll_descriptors_count)(snd_ctl_ext_t *ext);
233  int (*poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space);
237  int (*poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
238 };
239 
243 typedef enum snd_ctl_ext_access {
244  SND_CTL_EXT_ACCESS_READ = (1<<0),
245  SND_CTL_EXT_ACCESS_WRITE = (1<<1),
246  SND_CTL_EXT_ACCESS_READWRITE = (3<<0),
247  SND_CTL_EXT_ACCESS_VOLATILE = (1<<2),
248  SND_CTL_EXT_ACCESS_INACTIVE = (1<<8),
250 
254 #define SND_CTL_EXT_KEY_NOT_FOUND (snd_ctl_ext_key_t)(-1)
255 
256 int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode);
257 int snd_ctl_ext_delete(snd_ctl_ext_t *ext);
258 
261 #ifdef __cplusplus
262 }
263 #endif
264 
265 #endif /* __ALSA_CONTROL_EXTERNAL_H */
int poll_fd
Definition: control_external.h:111
int(* write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value)
Definition: control_external.h:204
snd_ctl_t * handle
Definition: control_external.h:124
int subscribed
Definition: control_external.h:127
void(* free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key)
Definition: control_external.h:151
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:174
int(* read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value)
Definition: control_external.h:183
int snd_ctl_ext_delete(snd_ctl_ext_t *ext)
Delete the external control plugin.
Definition: control_ext.c:688
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:155
int(* write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items)
Definition: control_external.h:208
int(* read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items)
Definition: control_external.h:187
int(* poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
Definition: control_external.h:237
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:191
int(* poll_descriptors_count)(snd_ctl_ext_t *ext)
Definition: control_external.h:229
snd_ctl_ext_key_t(* find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id)
Definition: control_external.h:147
const snd_ctl_ext_callback_t * callback
Definition: control_external.h:116
Definition: control.h:46
char mixername[80]
Definition: control_external.h:107
struct _snd_ctl snd_ctl_t
Definition: control.h:207
int(* poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space)
Definition: control_external.h:233
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:160
struct _snd_ctl_elem_id snd_ctl_elem_id_t
Definition: control.h:57
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:212
Definition: control_external.h:131
unsigned long snd_ctl_ext_key_t
Definition: control_external.h:62
void(* subscribe_events)(snd_ctl_ext_t *ext, int subscribe)
Definition: control_external.h:221
int(* read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask)
Definition: control_external.h:225
int(* elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id)
Definition: control_external.h:143
int(* read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value)
Definition: control_external.h:179
unsigned int version
Definition: control_external.h:83
Definition: control_external.h:78
int nonblock
Definition: control_external.h:126
int(* get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items)
Definition: control_external.h:170
snd_ctl_ext_access_t
Definition: control_external.h:243
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:165
int(* elem_count)(snd_ctl_ext_t *ext)
Definition: control_external.h:139
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:658
char name[32]
Definition: control_external.h:99
Application interface library for the ALSA driver.
int(* read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958)
Definition: control_external.h:196
int(* write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958)
Definition: control_external.h:217
char longname[80]
Definition: control_external.h:103
void(* close)(snd_ctl_ext_t *ext)
Definition: control_external.h:135
void * private_data
Definition: control_external.h:120
int card_idx
Definition: control_external.h:87
int(* write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value)
Definition: control_external.h:200
char driver[16]
Definition: control_external.h:95