- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

- File List
- Globals

# /builddir/build/BUILD/alsa-lib-1.1.0/include/mixer.h

Go to the documentation of this file.

    00001
    00011 /*
    00012  *   This library is free software; you can redistribute it and/or modify
    00013  *   it under the terms of the GNU Lesser General Public License as
    00014  *   published by the Free Software Foundation; either version 2.1 of
    00015  *   the License, or (at your option) any later version.
    00016  *
    00017  *   This program is distributed in the hope that it will be useful,
    00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00020  *   GNU Lesser General Public License for more details.
    00021  *
    00022  *   You should have received a copy of the GNU Lesser General Public
    00023  *   License along with this library; if not, write to the Free Software
    00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    00025  *
    00026  */
    00027
    00028 #ifndef __ALSA_MIXER_H
    00029 #define __ALSA_MIXER_H
    00030
    00031 #ifdef __cplusplus
    00032 extern "C" {
    00033 #endif
    00034
    00042 typedef struct _snd_mixer snd_mixer_t;
    00044 typedef struct _snd_mixer_class snd_mixer_class_t;
    00046 typedef struct _snd_mixer_elem snd_mixer_elem_t;
    00047
    00055 typedef int (*snd_mixer_callback_t)(snd_mixer_t *ctl,
    00056                                     unsigned int mask,
    00057                                     snd_mixer_elem_t *elem);
    00058
    00065 typedef int (*snd_mixer_elem_callback_t)(snd_mixer_elem_t *elem,
    00066                                          unsigned int mask);
    00067
    00074 typedef int (*snd_mixer_compare_t)(const snd_mixer_elem_t *e1,
    00075                                    const snd_mixer_elem_t *e2);
    00076
    00085 typedef int (*snd_mixer_event_t)(snd_mixer_class_t *class_, unsigned int mask,
    00086                                  snd_hctl_elem_t *helem, snd_mixer_elem_t *melem);
    00087
    00088
    00090 typedef enum _snd_mixer_elem_type {
    00091         /* Simple mixer elements */
    00092         SND_MIXER_ELEM_SIMPLE,
    00093         SND_MIXER_ELEM_LAST = SND_MIXER_ELEM_SIMPLE
    00094 } snd_mixer_elem_type_t;
    00095
    00096 int snd_mixer_open(snd_mixer_t **mixer, int mode);
    00097 int snd_mixer_close(snd_mixer_t *mixer);
    00098 snd_mixer_elem_t *snd_mixer_first_elem(snd_mixer_t *mixer);
    00099 snd_mixer_elem_t *snd_mixer_last_elem(snd_mixer_t *mixer);
    00100 int snd_mixer_handle_events(snd_mixer_t *mixer);
    00101 int snd_mixer_attach(snd_mixer_t *mixer, const char *name);
    00102 int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
    00103 int snd_mixer_detach(snd_mixer_t *mixer, const char *name);
    00104 int snd_mixer_detach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
    00105 int snd_mixer_get_hctl(snd_mixer_t *mixer, const char *name, snd_hctl_t **hctl);
    00106 int snd_mixer_poll_descriptors_count(snd_mixer_t *mixer);
    00107 int snd_mixer_poll_descriptors(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int space);
    00108 int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
    00109 int snd_mixer_load(snd_mixer_t *mixer);
    00110 void snd_mixer_free(snd_mixer_t *mixer);
    00111 int snd_mixer_wait(snd_mixer_t *mixer, int timeout);
    00112 int snd_mixer_set_compare(snd_mixer_t *mixer, snd_mixer_compare_t msort);
    00113 void snd_mixer_set_callback(snd_mixer_t *obj, snd_mixer_callback_t val);
    00114 void * snd_mixer_get_callback_private(const snd_mixer_t *obj);
    00115 void snd_mixer_set_callback_private(snd_mixer_t *obj, void * val);
    00116 unsigned int snd_mixer_get_count(const snd_mixer_t *obj);
    00117 int snd_mixer_class_unregister(snd_mixer_class_t *clss);
    00118
    00119 snd_mixer_elem_t *snd_mixer_elem_next(snd_mixer_elem_t *elem);
    00120 snd_mixer_elem_t *snd_mixer_elem_prev(snd_mixer_elem_t *elem);
    00121 void snd_mixer_elem_set_callback(snd_mixer_elem_t *obj, snd_mixer_elem_callback_t val);
    00122 void * snd_mixer_elem_get_callback_private(const snd_mixer_elem_t *obj);
    00123 void snd_mixer_elem_set_callback_private(snd_mixer_elem_t *obj, void * val);
    00124 snd_mixer_elem_type_t snd_mixer_elem_get_type(const snd_mixer_elem_t *obj);
    00125
    00126 int snd_mixer_class_register(snd_mixer_class_t *class_, snd_mixer_t *mixer);
    00127 int snd_mixer_elem_new(snd_mixer_elem_t **elem,
    00128                        snd_mixer_elem_type_t type,
    00129                        int compare_weight,
    00130                        void *private_data,
    00131                        void (*private_free)(snd_mixer_elem_t *elem));
    00132 int snd_mixer_elem_add(snd_mixer_elem_t *elem, snd_mixer_class_t *class_);
    00133 int snd_mixer_elem_remove(snd_mixer_elem_t *elem);
    00134 void snd_mixer_elem_free(snd_mixer_elem_t *elem);
    00135 int snd_mixer_elem_info(snd_mixer_elem_t *elem);
    00136 int snd_mixer_elem_value(snd_mixer_elem_t *elem);
    00137 int snd_mixer_elem_attach(snd_mixer_elem_t *melem, snd_hctl_elem_t *helem);
    00138 int snd_mixer_elem_detach(snd_mixer_elem_t *melem, snd_hctl_elem_t *helem);
    00139 int snd_mixer_elem_empty(snd_mixer_elem_t *melem);
    00140 void *snd_mixer_elem_get_private(const snd_mixer_elem_t *melem);
    00141
    00142 size_t snd_mixer_class_sizeof(void);
    00147 #define snd_mixer_class_alloca(ptr) __snd_alloca(ptr, snd_mixer_class)
    00148 int snd_mixer_class_malloc(snd_mixer_class_t **ptr);
    00149 void snd_mixer_class_free(snd_mixer_class_t *obj);
    00150 void snd_mixer_class_copy(snd_mixer_class_t *dst, const snd_mixer_class_t *src);
    00151 snd_mixer_t *snd_mixer_class_get_mixer(const snd_mixer_class_t *class_);
    00152 snd_mixer_event_t snd_mixer_class_get_event(const snd_mixer_class_t *class_);
    00153 void *snd_mixer_class_get_private(const snd_mixer_class_t *class_);
    00154 snd_mixer_compare_t snd_mixer_class_get_compare(const snd_mixer_class_t *class_);
    00155 int snd_mixer_class_set_event(snd_mixer_class_t *class_, snd_mixer_event_t event);
    00156 int snd_mixer_class_set_private(snd_mixer_class_t *class_, void *private_data);
    00157 int snd_mixer_class_set_private_free(snd_mixer_class_t *class_, void (*private_free)(snd_mixer_class_t *));
    00158 int snd_mixer_class_set_compare(snd_mixer_class_t *class_, snd_mixer_compare_t compare);
    00159
    00167 /* Simple mixer elements API */
    00168
    00170 typedef enum _snd_mixer_selem_channel_id {
    00172         SND_MIXER_SCHN_UNKNOWN = -1,
    00174         SND_MIXER_SCHN_FRONT_LEFT = 0,
    00176         SND_MIXER_SCHN_FRONT_RIGHT,
    00178         SND_MIXER_SCHN_REAR_LEFT,
    00180         SND_MIXER_SCHN_REAR_RIGHT,
    00182         SND_MIXER_SCHN_FRONT_CENTER,
    00184         SND_MIXER_SCHN_WOOFER,
    00186         SND_MIXER_SCHN_SIDE_LEFT,
    00188         SND_MIXER_SCHN_SIDE_RIGHT,
    00190         SND_MIXER_SCHN_REAR_CENTER,
    00191         SND_MIXER_SCHN_LAST = 31,
    00193         SND_MIXER_SCHN_MONO = SND_MIXER_SCHN_FRONT_LEFT
    00194 } snd_mixer_selem_channel_id_t;
    00195
    00197 enum snd_mixer_selem_regopt_abstract {
    00199         SND_MIXER_SABSTRACT_NONE = 0,
    00201         SND_MIXER_SABSTRACT_BASIC,
    00202 };
    00203
    00205 struct snd_mixer_selem_regopt {
    00207         int ver;
    00209         enum snd_mixer_selem_regopt_abstract abstract;
    00211         const char *device;
    00213         snd_pcm_t *playback_pcm;
    00215         snd_pcm_t *capture_pcm;
    00216 };
    00217
    00219 typedef struct _snd_mixer_selem_id snd_mixer_selem_id_t;
    00220
    00221 const char *snd_mixer_selem_channel_name(snd_mixer_selem_channel_id_t channel);
    00222
    00223 int snd_mixer_selem_register(snd_mixer_t *mixer,
    00224                              struct snd_mixer_selem_regopt *options,
    00225                              snd_mixer_class_t **classp);
    00226 void snd_mixer_selem_get_id(snd_mixer_elem_t *element,
    00227                             snd_mixer_selem_id_t *id);
    00228 const char *snd_mixer_selem_get_name(snd_mixer_elem_t *elem);
    00229 unsigned int snd_mixer_selem_get_index(snd_mixer_elem_t *elem);
    00230 snd_mixer_elem_t *snd_mixer_find_selem(snd_mixer_t *mixer,
    00231                                        const snd_mixer_selem_id_t *id);
    00232
    00233 int snd_mixer_selem_is_active(snd_mixer_elem_t *elem);
    00234 int snd_mixer_selem_is_playback_mono(snd_mixer_elem_t *elem);
    00235 int snd_mixer_selem_has_playback_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
    00236 int snd_mixer_selem_is_capture_mono(snd_mixer_elem_t *elem);
    00237 int snd_mixer_selem_has_capture_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
    00238 int snd_mixer_selem_get_capture_group(snd_mixer_elem_t *elem);
    00239 int snd_mixer_selem_has_common_volume(snd_mixer_elem_t *elem);
    00240 int snd_mixer_selem_has_playback_volume(snd_mixer_elem_t *elem);
    00241 int snd_mixer_selem_has_playback_volume_joined(snd_mixer_elem_t *elem);
    00242 int snd_mixer_selem_has_capture_volume(snd_mixer_elem_t *elem);
    00243 int snd_mixer_selem_has_capture_volume_joined(snd_mixer_elem_t *elem);
    00244 int snd_mixer_selem_has_common_switch(snd_mixer_elem_t *elem);
    00245 int snd_mixer_selem_has_playback_switch(snd_mixer_elem_t *elem);
    00246 int snd_mixer_selem_has_playback_switch_joined(snd_mixer_elem_t *elem);
    00247 int snd_mixer_selem_has_capture_switch(snd_mixer_elem_t *elem);
    00248 int snd_mixer_selem_has_capture_switch_joined(snd_mixer_elem_t *elem);
    00249 int snd_mixer_selem_has_capture_switch_exclusive(snd_mixer_elem_t *elem);
    00250
    00251 int snd_mixer_selem_ask_playback_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
    00252 int snd_mixer_selem_ask_capture_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
    00253 int snd_mixer_selem_ask_playback_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
    00254 int snd_mixer_selem_ask_capture_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
    00255 int snd_mixer_selem_get_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
    00256 int snd_mixer_selem_get_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
    00257 int snd_mixer_selem_get_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
    00258 int snd_mixer_selem_get_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
    00259 int snd_mixer_selem_get_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
    00260 int snd_mixer_selem_get_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
    00261 int snd_mixer_selem_set_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
    00262 int snd_mixer_selem_set_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
    00263 int snd_mixer_selem_set_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
    00264 int snd_mixer_selem_set_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
    00265 int snd_mixer_selem_set_playback_volume_all(snd_mixer_elem_t *elem, long value);
    00266 int snd_mixer_selem_set_capture_volume_all(snd_mixer_elem_t *elem, long value);
    00267 int snd_mixer_selem_set_playback_dB_all(snd_mixer_elem_t *elem, long value, int dir);
    00268 int snd_mixer_selem_set_capture_dB_all(snd_mixer_elem_t *elem, long value, int dir);
    00269 int snd_mixer_selem_set_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
    00270 int snd_mixer_selem_set_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
    00271 int snd_mixer_selem_set_playback_switch_all(snd_mixer_elem_t *elem, int value);
    00272 int snd_mixer_selem_set_capture_switch_all(snd_mixer_elem_t *elem, int value);
    00273 int snd_mixer_selem_get_playback_volume_range(snd_mixer_elem_t *elem,
    00274                                               long *min, long *max);
    00275 int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem,
    00276                                           long *min, long *max);
    00277 int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem,
    00278                                               long min, long max);
    00279 int snd_mixer_selem_get_capture_volume_range(snd_mixer_elem_t *elem,
    00280                                              long *min, long *max);
    00281 int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem,
    00282                                          long *min, long *max);
    00283 int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem,
    00284                                              long min, long max);
    00285
    00286 int snd_mixer_selem_is_enumerated(snd_mixer_elem_t *elem);
    00287 int snd_mixer_selem_is_enum_playback(snd_mixer_elem_t *elem);
    00288 int snd_mixer_selem_is_enum_capture(snd_mixer_elem_t *elem);
    00289 int snd_mixer_selem_get_enum_items(snd_mixer_elem_t *elem);
    00290 int snd_mixer_selem_get_enum_item_name(snd_mixer_elem_t *elem, unsigned int idx, size_t maxlen, char *str);
    00291 int snd_mixer_selem_get_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *idxp);
    00292 int snd_mixer_selem_set_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int idx);
    00293
    00294 size_t snd_mixer_selem_id_sizeof(void);
    00299 #define snd_mixer_selem_id_alloca(ptr) __snd_alloca(ptr, snd_mixer_selem_id)
    00300 int snd_mixer_selem_id_malloc(snd_mixer_selem_id_t **ptr);
    00301 void snd_mixer_selem_id_free(snd_mixer_selem_id_t *obj);
    00302 void snd_mixer_selem_id_copy(snd_mixer_selem_id_t *dst, const snd_mixer_selem_id_t *src);
    00303 const char *snd_mixer_selem_id_get_name(const snd_mixer_selem_id_t *obj);
    00304 unsigned int snd_mixer_selem_id_get_index(const snd_mixer_selem_id_t *obj);
    00305 void snd_mixer_selem_id_set_name(snd_mixer_selem_id_t *obj, const char *val);
    00306 void snd_mixer_selem_id_set_index(snd_mixer_selem_id_t *obj, unsigned int val);
    00307
    00312 #ifdef __cplusplus
    00313 }
    00314 #endif
    00315
    00316 #endif /* __ALSA_MIXER_H */
    00317

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines