3 * Copyright (C) 2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 [CCode (lower_case_cprefix = "snd_", cheader_filename = "alsa/asoundlib.h")]
24 public unowned string strerror (int error);
26 [CCode (cname = "snd_aes_iec958_t", destroy_function = "")]
27 public struct AesIec958
29 public uchar[] status;
30 public uchar[] subcode;
32 public uchar[] dig_subframe;
35 [CCode (cprefix = "SND_CTL_", cheader_filename = "alsa/control.h")]
36 public enum CardOpenType
44 [CCode (cprefix = "snd_ctl_card_info_", cname = "snd_ctl_card_info_t", free_function = "snd_ctl_card_info_free")]
47 [CCode (cname = "snd_ctl_card_info_malloc")]
48 public static int alloc (out CardInfo info);
50 public unowned string get_id();
51 public unowned string get_longname();
53 public unowned string get_mixername();
54 public unowned string get_components();
58 [CCode (cprefix = "snd_ctl_", cname = "snd_ctl_t", free_function = "snd_ctl_close")]
61 public static int open (out Card card, string name = "default", CardOpenType t = 0);
63 public int card_info (CardInfo info);
64 public int elem_list (ElemList list);
65 public int elem_info (ElemInfo info);
66 public int elem_read (ElemValue value);
67 public int elem_write (ElemValue value);
69 public int get_dB_range (ElemId eid, out long min, out long max);
70 public int convert_to_dB (ElemId eid, long volume, out long gain);
71 public int convert_from_dB (ElemId eid, long gain, out long value, int xdir);
75 [CCode (cprefix = "snd_ctl_elem_id_", cname = "snd_ctl_elem_id_t", free_function = "snd_ctl_elem_id_free")]
78 [CCode (cname = "snd_ctl_elem_id_malloc")]
79 public static int alloc (out ElemId eid);
81 public unowned string get_name();
82 public uint get_numid();
83 public uint get_index();
84 public uint get_device();
85 public uint get_subdevice();
89 [CCode (cprefix = "snd_ctl_elem_info_", cname = "snd_ctl_elem_info_t", free_function = "snd_ctl_elem_info_free")]
92 [CCode (cname = "snd_ctl_elem_info_malloc")]
93 public static int alloc (out ElemInfo t);
95 public void set_id (ElemId eid);
96 public void set_numid (uint n);
98 public uint get_count ();
99 public ElemType get_type ();
102 [CCode (cprefix = "SND_CTL_ELEM_IFACE_", cname = "snd_ctl_elem_iface_t")]
103 public enum ElemInterface
114 [CCode (cprefix = "SND_CTL_ELEM_TYPE_", cname = "snd_ctl_elem_type_t")]
127 [CCode (cprefix = "snd_ctl_elem_value_", cname = "snd_ctl_elem_value_t", free_function = "snd_ctl_elem_value_free")]
128 public class ElemValue
130 [CCode (cname = "snd_ctl_elem_value_malloc")]
131 public static int alloc (out ElemValue t);
133 public void set_id (ElemId eid);
135 public bool get_boolean (uint idx);
136 public long get_integer (uint idx);
137 public int64 get_integer64 (uint idx);
138 public uint get_enumerated (uint idx);
139 public uchar get_byte (uint idx);
140 public void get_iec958 (AesIec958 val);
142 public void set_boolean (uint idx, bool b);
143 public void set_integer (uint idx, long l);
144 public void set_integer64 (uint idx, int64 i);
145 public void set_enumerated (uint idx, uint val);
146 public void set_byte (uint idx, uchar val);
147 public void set_iec958 (AesIec958 val);
151 [CCode (cprefix = "snd_ctl_elem_list_", cname = "snd_ctl_elem_list_t", free_function = "snd_ctl_elem_list_free")]
152 public class ElemList
154 [CCode (cname = "snd_ctl_elem_list_malloc")]
155 public static int alloc (out ElemList list);
156 public int alloc_space (uint entries);
157 public uint get_count();
158 public uint get_used();
159 public void free_space ();
160 public void set_offset (uint offset);
162 public void get_id (uint n, ElemId eid);
166 [CCode (cprefix = "snd_pcm_", cname = "snd_pcm_t", free_function = "snd_pcm_close")]
167 public class PcmDevice
172 [CCode (cprefix = "SND_MIXER_SABSTRACT_", cname = "snd_mixer_selem_regopt_abstract")]
173 public enum MixerAbstractionLevel
179 [CCode (cname = "struct snd_mixer_selem_regopt", destroy_function = "", cheader_filename = "alsa/mixer.h")]
180 public struct MixerRegistrationOptions
183 public MixerAbstractionLevel @abstract;
184 public string device;
185 public PcmDevice playback_pcm;
186 public PcmDevice capture_pcm;
190 [CCode (cprefix = "snd_mixer_class_", cname = "snd_mixer_class_t", free_function = "snd_mixer_class_close", cheader_filename = "alsa/mixer.h")]
191 public class MixerClass
196 [CCode (cprefix = "snd_mixer_", cname = "snd_mixer_t", free_function = "snd_mixer_close")]
199 public static int open (out Mixer mixer, int t = 0 /* MixerOpenType t = 0 */ );
200 public int attach (string card = "default");
201 public int detach (string card = "default");
202 public uint get_count ();
205 [CCode (cname = "snd_mixer_selem_register")]
206 public int register (MixerRegistrationOptions? options = 0, out MixerClass classp = null );
208 public MixerElement first_elem ();
209 public MixerElement last_elem ();
213 [CCode (cprefix = "snd_mixer_selem_", cname = "snd_mixer_elem_t", free_function = "")]
214 public class MixerElement
216 [CCode (cname = "snd_mixer_elem_next")]
217 public MixerElement next ();
218 [CCode (cname = "snd_mixer_elem_prev")]
219 public MixerElement prev ();
221 public void get_id (SimpleElementId eid);
222 public bool is_active ();
223 public bool is_playback_mono ();
224 public bool has_playback_channel (SimpleChannelId channel);
225 public bool is_capture_mono ();
226 public bool has_capture_channel (SimpleChannelId channel);
227 public int get_capture_group ();
228 public bool has_common_volume ();
229 public bool has_playback_volume ();
230 public bool has_playback_volume_joined ();
231 public bool has_capture_volume ();
232 public bool has_capture_volume_joined ();
233 public bool has_common_switch ();
234 public bool has_playback_switch ();
235 public bool has_playback_switch_joined ();
236 public bool has_capture_switch ();
237 public bool has_capture_switch_joined ();
238 public bool has_capture_switch_exclusive ();
240 public int ask_playback_vol_dB (long val, out long dBval);
241 public int ask_capture_vol_dB (long val, out long dBval);
242 public int ask_playback_dB_vol (long dBval, int dir, out long val);
243 public int ask_capture_dB_vol (long dBval, int dir, out long val);
244 public int get_playback_volume (SimpleChannelId channel, out long val);
245 public int get_capture_volume (SimpleChannelId channel, out long val);
246 public int get_playback_dB (SimpleChannelId channel, out long val);
247 public int get_capture_dB (SimpleChannelId channel, out long val);
248 public int get_playback_switch (SimpleChannelId channel, out int val);
249 public int get_capture_switch (SimpleChannelId channel, out int val);
250 public int set_playback_volume (SimpleChannelId channel, long val);
251 public int set_capture_volume (SimpleChannelId channel, long val);
252 public int set_playback_dB (SimpleChannelId channel, long val, int dir);
253 public int set_capture_dB (SimpleChannelId channel, long val, int dir);
254 public int set_playback_volume_all (long val);
255 public int set_capture_volume_all (long val);
256 public int set_playback_dB_all (long val, int dir);
257 public int set_capture_dB_all (long val, int dir);
258 public int set_playback_switch (SimpleChannelId channel, int val);
259 public int set_capture_switch (SimpleChannelId channel, int val);
260 public int set_playback_switch_all (int val);
261 public int set_capture_switch_all (int val);
262 public int get_playback_volume_range (out long min, out long max);
263 public int get_playback_dB_range (out long min, out long max);
264 public int set_playback_volume_range (long min, long max);
265 public int get_capture_volume_range (out long min, out long max);
266 public int get_capture_dB_range (out long min, out long max);
267 public int set_capture_volume_range (long min, long max);
268 public int is_enumerated ();
269 public int is_enum_playback ();
270 public int is_enum_capture ();
271 public int get_enum_items ();
272 public int get_enum_item_name (uint idx, size_t maxlen, out string str);
273 public int get_enum_item (SimpleChannelId channel, out uint idxp);
274 public int set_enum_item (SimpleChannelId channel, uint idx);
277 [CCode (cprefix = "SND_MIXER_SCHN_", cname = "snd_mixer_selem_channel_id_t")]
278 public enum SimpleChannelId
295 [CCode (cprefix = "snd_mixer_selem_id_", cname = "snd_mixer_selem_id_t", free_function = "")]
296 public class SimpleElementId
298 [CCode (cname = "snd_mixer_selem_id_malloc")]
299 public static int alloc (out SimpleElementId eid);
301 public unowned string get_name();
302 public uint get_index();