OSDN Git Service

Separated asoundlib.h to small files.
[android-x86/external-alsa-lib.git] / include / conf.h
1 /**
2  * \file <alsa/conf.h>
3  * \brief Application interface library for the ALSA driver
4  * \author Jaroslav Kysela <perex@suse.cz>
5  * \author Abramo Bagnara <abramo@alsa-project.org>
6  * \author Takashi Iwai <tiwai@suse.de>
7  * \date 1998-2001
8  *
9  * Application interface library for the ALSA driver
10  *
11  *
12  *   This library is free software; you can redistribute it and/or modify
13  *   it under the terms of the GNU Library General Public License as
14  *   published by the Free Software Foundation; either version 2 of
15  *   the License, or (at your option) any later version.
16  *
17  *   This program is distributed in the hope that it will be useful,
18  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
19  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  *   GNU Library General Public License for more details.
21  *
22  *   You should have received a copy of the GNU Library General Public
23  *   License along with this library; if not, write to the Free Software
24  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  *
26  */
27
28 #ifndef __ALSA_CONF_H
29 #define __ALSA_CONF_H
30
31 /**
32  *  \defgroup Config Configuration Interface
33  *  Configuration Interface
34  *  \{
35  */
36
37 /** dlsym version for config evaluate callback */
38 #define SND_CONFIG_DLSYM_VERSION_EVALUATE       _dlsym_config_evaluate_001
39 /** dlsym version for config hook callback */
40 #define SND_CONFIG_DLSYM_VERSION_HOOK           _dlsym_config_hook_001
41
42 /** Config node type */
43 typedef enum _snd_config_type {
44         /** Integer number */
45         SND_CONFIG_TYPE_INTEGER,
46         /** Real number */
47         SND_CONFIG_TYPE_REAL,
48         /** Character string */
49         SND_CONFIG_TYPE_STRING,
50         /** Compound */
51         SND_CONFIG_TYPE_COMPOUND,
52 } snd_config_type_t;
53
54 /** Config node handle */
55 typedef struct _snd_config snd_config_t;
56 /** Config compound iterator */
57 typedef struct _snd_config_iterator *snd_config_iterator_t;
58
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62
63 int snd_config_top(snd_config_t **config);
64
65 int snd_config_load(snd_config_t *config, snd_input_t *in);
66 int snd_config_save(snd_config_t *config, snd_output_t *out);
67
68 int snd_config_search(snd_config_t *config, const char *key,
69                       snd_config_t **result);
70 int snd_config_searchv(snd_config_t *config, 
71                        snd_config_t **result, ...);
72 int snd_config_search_definition(snd_config_t *config,
73                                  const char *base, const char *key,
74                                  snd_config_t **result);
75
76 int snd_config_expand(snd_config_t *config, snd_config_t *root,
77                       const char *args, void *private_data,
78                       snd_config_t **result);
79 int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
80                         void *private_data, snd_config_t **result);
81
82 int snd_config_add(snd_config_t *config, snd_config_t *leaf);
83 int snd_config_delete(snd_config_t *config);
84 int snd_config_copy(snd_config_t **dst, snd_config_t *src);
85
86 int snd_config_make(snd_config_t **config, const char *key,
87                     snd_config_type_t type);
88 int snd_config_make_integer(snd_config_t **config, const char *key);
89 int snd_config_make_real(snd_config_t **config, const char *key);
90 int snd_config_make_string(snd_config_t **config, const char *key);
91 int snd_config_make_compound(snd_config_t **config, const char *key, int join);
92
93 int snd_config_set_id(snd_config_t *config, const char *id);
94 int snd_config_set_integer(snd_config_t *config, long value);
95 int snd_config_set_real(snd_config_t *config, double value);
96 int snd_config_set_string(snd_config_t *config, const char *value);
97 int snd_config_set_ascii(snd_config_t *config, const char *ascii);
98 int snd_config_get_integer(snd_config_t *config, long *value);
99 int snd_config_get_real(snd_config_t *config, double *value);
100 int snd_config_get_string(snd_config_t *config, const char **value);
101 int snd_config_get_ascii(snd_config_t *config, char **value);
102
103 snd_config_iterator_t snd_config_iterator_first(snd_config_t *node);
104 snd_config_iterator_t snd_config_iterator_next(snd_config_iterator_t iterator);
105 snd_config_iterator_t snd_config_iterator_end(snd_config_t *node);
106 snd_config_t *snd_config_iterator_entry(snd_config_iterator_t iterator);
107
108 /** Helper for compound config node leaves traversal
109  * \param pos Current node iterator
110  * \param next Next node iterator
111  * \param node Compound config node
112  *
113  * This macro is designed to permit the removal of current node.
114  */
115 #define snd_config_for_each(pos, next, node) \
116         for (pos = snd_config_iterator_first(node), next = snd_config_iterator_next(pos); pos != snd_config_iterator_end(node); pos = next, next = snd_config_iterator_next(pos))
117
118 snd_config_type_t snd_config_get_type(snd_config_t *config);
119 const char *snd_config_get_id(snd_config_t *config);
120
121 extern snd_config_t *snd_config;
122 int snd_config_update(void);
123
124 /* Misc functions */
125
126 int snd_config_get_bool_ascii(const char *ascii);
127 int snd_config_get_bool(snd_config_t *conf);
128 int snd_config_get_ctl_iface_ascii(const char *ascii);
129 int snd_config_get_ctl_iface(snd_config_t *conf);
130
131 #ifdef __cplusplus
132 }
133 #endif
134
135 /** \} */
136
137 #endif /* __ALSA_CONF_H */
138