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>
9 * Application interface library for the ALSA driver
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as
14 * published by the Free Software Foundation; either version 2.1 of
15 * the License, or (at your option) any later version.
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 Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36 * \defgroup Config Configuration Interface
37 * Configuration Interface
41 /** dlsym version for config evaluate callback */
42 #define SND_CONFIG_DLSYM_VERSION_EVALUATE _dlsym_config_evaluate_001
43 /** dlsym version for config hook callback */
44 #define SND_CONFIG_DLSYM_VERSION_HOOK _dlsym_config_hook_001
46 /** Config node type */
47 typedef enum _snd_config_type {
49 SND_CONFIG_TYPE_INTEGER,
52 /** Character string */
53 SND_CONFIG_TYPE_STRING,
54 /** Pointer - runtime only - cannot be saved */
55 SND_CONFIG_TYPE_POINTER,
57 SND_CONFIG_TYPE_COMPOUND = 1024,
60 /** Config node handle */
61 typedef struct _snd_config snd_config_t;
62 /** Config compound iterator */
63 typedef struct _snd_config_iterator *snd_config_iterator_t;
64 /** Config private update structure */
65 typedef struct _snd_config_update snd_config_update_t;
67 extern snd_config_t *snd_config;
69 int snd_config_top(snd_config_t **config);
71 int snd_config_load(snd_config_t *config, snd_input_t *in);
72 int snd_config_load_override(snd_config_t *config, snd_input_t *in);
73 int snd_config_save(snd_config_t *config, snd_output_t *out);
74 int snd_config_update(void);
75 int snd_config_update_r(snd_config_t **top, snd_config_update_t **update, const char *path);
76 int snd_config_update_free(snd_config_update_t *update);
77 int snd_config_update_free_global(void);
79 int snd_config_search(snd_config_t *config, const char *key,
80 snd_config_t **result);
81 int snd_config_searchv(snd_config_t *config,
82 snd_config_t **result, ...);
83 int snd_config_search_definition(snd_config_t *config,
84 const char *base, const char *key,
85 snd_config_t **result);
87 int snd_config_expand(snd_config_t *config, snd_config_t *root,
88 const char *args, snd_config_t *private_data,
89 snd_config_t **result);
90 int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
91 snd_config_t *private_data, snd_config_t **result);
93 int snd_config_add(snd_config_t *config, snd_config_t *leaf);
94 int snd_config_delete(snd_config_t *config);
95 int snd_config_delete_compound_members(const snd_config_t *config);
96 int snd_config_copy(snd_config_t **dst, snd_config_t *src);
98 int snd_config_make(snd_config_t **config, const char *key,
99 snd_config_type_t type);
100 int snd_config_make_integer(snd_config_t **config, const char *key);
101 int snd_config_make_real(snd_config_t **config, const char *key);
102 int snd_config_make_string(snd_config_t **config, const char *key);
103 int snd_config_make_pointer(snd_config_t **config, const char *key);
104 int snd_config_make_compound(snd_config_t **config, const char *key, int join);
106 int snd_config_imake_integer(snd_config_t **config, const char *key, const long value);
107 int snd_config_imake_real(snd_config_t **config, const char *key, const double value);
108 int snd_config_imake_string(snd_config_t **config, const char *key, const char *ascii);
109 int snd_config_imake_pointer(snd_config_t **config, const char *key, const void *ptr);
111 snd_config_type_t snd_config_get_type(const snd_config_t *config);
113 int snd_config_set_id(snd_config_t *config, const char *id);
114 int snd_config_set_integer(snd_config_t *config, long value);
115 int snd_config_set_real(snd_config_t *config, double value);
116 int snd_config_set_string(snd_config_t *config, const char *value);
117 int snd_config_set_ascii(snd_config_t *config, const char *ascii);
118 int snd_config_set_pointer(snd_config_t *config, const void *ptr);
119 int snd_config_get_id(const snd_config_t *config, const char **value);
120 int snd_config_get_integer(const snd_config_t *config, long *value);
121 int snd_config_get_real(const snd_config_t *config, double *value);
122 int snd_config_get_ireal(const snd_config_t *config, double *value);
123 int snd_config_get_string(const snd_config_t *config, const char **value);
124 int snd_config_get_ascii(const snd_config_t *config, char **value);
125 int snd_config_get_pointer(const snd_config_t *config, const void **value);
126 int snd_config_test_id(const snd_config_t *config, const char *id);
128 const snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node);
129 const snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator);
130 const snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node);
131 snd_config_t *snd_config_iterator_entry(const snd_config_iterator_t iterator);
133 /** Helper for compound config node leaves traversal
134 * \param pos Current node iterator
135 * \param next Next node iterator
136 * \param node Compound config node
138 * This macro is designed to permit the removal of current node.
140 #define snd_config_for_each(pos, next, node) \
141 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))
145 int snd_config_get_bool_ascii(const char *ascii);
146 int snd_config_get_bool(const snd_config_t *conf);
147 int snd_config_get_ctl_iface_ascii(const char *ascii);
148 int snd_config_get_ctl_iface(const snd_config_t *conf);
156 #endif /* __ALSA_CONF_H */