1 module deimos.alsa.conf;
2 
3 import core.stdc.config;
4 
5 import deimos.alsa.input;
6 import deimos.alsa.output;
7 
8 extern(C):
9 
10 // #define SND_CONFIG_DLSYM_VERSION_EVALUATE	_dlsym_config_evaluate_001
11 // #define SND_CONFIG_DLSYM_VERSION_HOOK		_dlsym_config_hook_001
12 
13 enum snd_config_type_t
14 {
15     SND_CONFIG_TYPE_INTEGER,
16     SND_CONFIG_TYPE_INTEGER64,
17     SND_CONFIG_TYPE_REAL,
18     SND_CONFIG_TYPE_STRING,
19     SND_CONFIG_TYPE_POINTER,
20 	SND_CONFIG_TYPE_COMPOUND = 1024
21 }
22 
23 struct snd_config_t;
24 
25 struct _snd_config_iterator;
26 alias snd_config_iterator_t = _snd_config_iterator*;
27 
28 struct snd_config_update_t;
29 
30 extern __gshared snd_config_t* snd_config;
31 
32 int snd_config_top(snd_config_t** config);
33 
34 int snd_config_load(snd_config_t* config, snd_input_t* in_);
35 int snd_config_load_override(snd_config_t* config, snd_input_t* in_);
36 int snd_config_save(snd_config_t* config, snd_output_t* out_);
37 int snd_config_update();
38 int snd_config_update_r(snd_config_t** top, snd_config_update_t** update, const(char)* path);
39 int snd_config_update_free(snd_config_update_t* update);
40 int snd_config_update_free_global();
41 
42 int snd_config_search(snd_config_t* config, const(char)* key, snd_config_t** result);
43 int snd_config_searchv(snd_config_t* config, snd_config_t** result, ...);
44 int snd_config_search_definition(snd_config_t* config, const(char)* base, const(char)* key, snd_config_t** result);
45 
46 int snd_config_expand(snd_config_t* config, snd_config_t* root, const(char)* args, snd_config_t* private_data, snd_config_t** result);
47 int snd_config_evaluate(snd_config_t* config, snd_config_t* root, snd_config_t* private_data, snd_config_t** result);
48 
49 int snd_config_add(snd_config_t* config, snd_config_t* leaf);
50 int snd_config_delete(snd_config_t* config);
51 int snd_config_delete_compound_members(const(snd_config_t)* config);
52 int snd_config_copy(snd_config_t** dst, snd_config_t* src);
53 
54 int snd_config_make(snd_config_t** config, const(char)* key,
55 		    snd_config_type_t type);
56 int snd_config_make_integer(snd_config_t** config, const(char)* key);
57 int snd_config_make_integer64(snd_config_t** config, const(char)* key);
58 int snd_config_make_real(snd_config_t** config, const(char)* key);
59 int snd_config_make_string(snd_config_t** config, const(char)* key);
60 int snd_config_make_pointer(snd_config_t** config, const(char)* key);
61 int snd_config_make_compound(snd_config_t** config, const(char)* key, int join);
62 
63 int snd_config_imake_integer(snd_config_t** config, const(char)* key, const(c_long) value);
64 int snd_config_imake_integer64(snd_config_t** config, const(char)* key, const(long) value);
65 int snd_config_imake_real(snd_config_t** config, const(char)* key, const(double) value);
66 int snd_config_imake_string(snd_config_t** config, const(char)* key, const(char)* ascii);
67 int snd_config_imake_pointer(snd_config_t** config, const(char)* key, const(void)* ptr);
68 
69 snd_config_type_t snd_config_get_type(const(snd_config_t)* config);
70 
71 int snd_config_set_id(snd_config_t* config, const(char)* id);
72 int snd_config_set_integer(snd_config_t* config, c_long value);
73 int snd_config_set_integer64(snd_config_t* config, long value);
74 int snd_config_set_real(snd_config_t* config, double value);
75 int snd_config_set_string(snd_config_t* config, const(char)* value);
76 int snd_config_set_ascii(snd_config_t* config, const(char)* ascii);
77 int snd_config_set_pointer(snd_config_t* config, const(void)* ptr);
78 int snd_config_get_id(const(snd_config_t)* config, const(char)** value);
79 int snd_config_get_integer(const(snd_config_t)* config, c_long* value);
80 int snd_config_get_integer64(const(snd_config_t)* config, long* value);
81 int snd_config_get_real(const(snd_config_t)* config, double* value);
82 int snd_config_get_ireal(const(snd_config_t)* config, double* value);
83 int snd_config_get_string(const(snd_config_t)* config, const(char)** value);
84 int snd_config_get_ascii(const(snd_config_t)* config, char** value);
85 int snd_config_get_pointer(const(snd_config_t)* config, const(void)** value);
86 int snd_config_test_id(const(snd_config_t)* config, const(char)* id);
87 
88 snd_config_iterator_t snd_config_iterator_first(const(snd_config_t)* node);
89 snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator);
90 snd_config_iterator_t snd_config_iterator_end(const(snd_config_t)* node);
91 snd_config_t* snd_config_iterator_entry(const snd_config_iterator_t iterator);
92 
93 int snd_config_get_bool_ascii(const(char)* ascii);
94 int snd_config_get_bool(const(snd_config_t)* conf);
95 int snd_config_get_ctl_iface_ascii(const(char)* ascii);
96 int snd_config_get_ctl_iface(const(snd_config_t)* conf);
97 
98 struct snd_devname
99 {
100 	char* name;
101 	char* comment;
102 	snd_devname_t* next;
103 };
104 alias snd_devname_t = snd_devname;
105 
106 int snd_names_list(const(char)* iface, snd_devname_t** list);
107 void snd_names_list_free(snd_devname_t* list);