ALSA project - the C library reference
|
00001 00010 /* 00011 * This library is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU Lesser General Public License as 00013 * published by the Free Software Foundation; either version 2.1 of 00014 * the License, or (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 * 00025 */ 00026 #ifndef __ALSA_CONTROL_EXTERNAL_H 00027 #define __ALSA_CONTROL_EXTERNAL_H 00028 00029 #include "control.h" 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 00043 #define SND_CTL_PLUGIN_ENTRY(name) _snd_ctl_##name##_open 00044 00048 #define SND_CTL_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_CTL_PLUGIN_ENTRY(name), SND_CONTROL_DLSYM_VERSION); 00049 00053 #define SND_CTL_PLUGIN_DEFINE_FUNC(plugin) \ 00054 int SND_CTL_PLUGIN_ENTRY(plugin) (snd_ctl_t **handlep, const char *name,\ 00055 snd_config_t *root, snd_config_t *conf, int mode) 00056 00058 typedef struct snd_ctl_ext snd_ctl_ext_t; 00060 typedef struct snd_ctl_ext_callback snd_ctl_ext_callback_t; 00062 typedef unsigned long snd_ctl_ext_key_t; 00063 00064 /* 00065 * Protocol version 00066 */ 00067 #define SND_CTL_EXT_VERSION_MAJOR 1 00068 #define SND_CTL_EXT_VERSION_MINOR 0 00069 #define SND_CTL_EXT_VERSION_TINY 0 00073 #define SND_CTL_EXT_VERSION ((SND_CTL_EXT_VERSION_MAJOR<<16) |\ 00074 (SND_CTL_EXT_VERSION_MINOR<<8) |\ 00075 (SND_CTL_EXT_VERSION_TINY)) 00076 00078 struct snd_ctl_ext { 00083 unsigned int version; 00087 int card_idx; 00091 char id[16]; 00095 char driver[16]; 00099 char name[32]; 00103 char longname[80]; 00107 char mixername[80]; 00111 int poll_fd; 00112 00116 const snd_ctl_ext_callback_t *callback; 00120 void *private_data; 00124 snd_ctl_t *handle; 00125 00126 int nonblock; 00127 int subscribed; 00128 }; 00129 00131 struct snd_ctl_ext_callback { 00135 void (*close)(snd_ctl_ext_t *ext); 00139 int (*elem_count)(snd_ctl_ext_t *ext); 00143 int (*elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id); 00147 snd_ctl_ext_key_t (*find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id); 00151 void (*free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key); 00155 int (*get_attribute)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, 00156 int *type, unsigned int *acc, unsigned int *count); 00160 int (*get_integer_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, 00161 long *imin, long *imax, long *istep); 00165 int (*get_integer64_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, 00166 int64_t *imin, int64_t *imax, int64_t *istep); 00170 int (*get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items); 00174 int (*get_enumerated_name)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int item, 00175 char *name, size_t name_max_len); 00179 int (*read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value); 00183 int (*read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value); 00187 int (*read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items); 00191 int (*read_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data, 00192 size_t max_bytes); 00196 int (*read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958); 00200 int (*write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value); 00204 int (*write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value); 00208 int (*write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items); 00212 int (*write_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data, 00213 size_t max_bytes); 00217 int (*write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958); 00221 void (*subscribe_events)(snd_ctl_ext_t *ext, int subscribe); 00225 int (*read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask); 00229 int (*poll_descriptors_count)(snd_ctl_ext_t *ext); 00233 int (*poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space); 00237 int (*poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); 00238 }; 00239 00243 typedef enum snd_ctl_ext_access { 00244 SND_CTL_EXT_ACCESS_READ = (1<<0), 00245 SND_CTL_EXT_ACCESS_WRITE = (1<<1), 00246 SND_CTL_EXT_ACCESS_READWRITE = (3<<0), 00247 SND_CTL_EXT_ACCESS_VOLATILE = (1<<2), 00248 SND_CTL_EXT_ACCESS_INACTIVE = (1<<8), 00249 } snd_ctl_ext_access_t; 00250 00254 #define SND_CTL_EXT_KEY_NOT_FOUND (snd_ctl_ext_key_t)(-1) 00255 00256 int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode); 00257 int snd_ctl_ext_delete(snd_ctl_ext_t *ext); 00258 00261 #ifdef __cplusplus 00262 } 00263 #endif 00264 00265 #endif /* __ALSA_CONTROL_EXTERNAL_H */