[vala] alsa: bind simple mixer API



commit d53cab076a32268250ef291b43b25d0b171dba85
Author: Michael 'Mickey' Lauer <mickey vanille-media de>
Date:   Fri Apr 9 17:04:08 2010 +0200

    alsa: bind simple mixer API

 vapi/alsa.vapi |  117 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 112 insertions(+), 5 deletions(-)
---
diff --git a/vapi/alsa.vapi b/vapi/alsa.vapi
index ede0bb7..1539dbc 100644
--- a/vapi/alsa.vapi
+++ b/vapi/alsa.vapi
@@ -65,6 +65,10 @@ namespace Alsa {
         public int elem_info (ElemInfo info);
         public int elem_read (ElemValue value);
         public int elem_write (ElemValue value);
+
+        public int get_dB_range (ElemId eid, out long min, out long max);
+        public int convert_to_dB (ElemId eid, long volume, out long gain);
+        public int convert_from_dB (ElemId eid, long gain, out long value, int xdir);
     }
 
     [Compact]
@@ -143,7 +147,7 @@ namespace Alsa {
         public void set_iec958 (AesIec958 val);
     }
 
-    [Compact] 
+    [Compact]
     [CCode (cprefix = "snd_ctl_elem_list_", cname = "snd_ctl_elem_list_t", free_function = "snd_ctl_elem_list_free")]
     public class ElemList
     {
@@ -159,6 +163,36 @@ namespace Alsa {
     }
 
     [Compact]
+    [CCode (cprefix = "snd_pcm_", cname = "snd_pcm_t", free_function = "snd_pcm_close")]
+    public class PcmDevice
+    {
+    }
+
+
+    [CCode (cprefix = "SND_MIXER_SABSTRACT_", cname = "snd_mixer_selem_regopt_abstract")]
+    public enum MixerAbstractionLevel
+    {
+        NONE,
+        BASIC
+    }
+
+    [CCode (cname = "struct snd_mixer_selem_regopt", destroy_function = "", cheader_filename = "alsa/mixer.h")]
+    public struct MixerRegistrationOptions
+    {
+        public int ver;
+        public MixerAbstractionLevel @abstract;
+        public string device;
+        public PcmDevice playback_pcm;
+        public PcmDevice capture_pcm;
+    }
+
+    [Compact]
+    [CCode (cprefix = "snd_mixer_class_", cname = "snd_mixer_class_t", free_function = "snd_mixer_class_close", cheader_filename = "alsa/mixer.h")]
+    public class MixerClass
+    {
+    }
+
+    [Compact]
     [CCode (cprefix = "snd_mixer_", cname = "snd_mixer_t", free_function = "snd_mixer_close")]
     public class Mixer
     {
@@ -167,20 +201,94 @@ namespace Alsa {
         public int detach (string card = "default");
         public uint get_count ();
         public int load ();
-        public int selem_register (int options = 0, void* classp = null );
+
+        [CCode (cname = "snd_mixer_selem_register")]
+        public int register (MixerRegistrationOptions? options = 0, out MixerClass classp = null );
 
         public MixerElement first_elem ();
         public MixerElement last_elem ();
     }
 
     [Compact]
-    [CCode (cprefix = "snd_mixer_elem_", cname = "snd_mixer_elem_t", free_function = "")]
+    [CCode (cprefix = "snd_mixer_selem_", cname = "snd_mixer_elem_t", free_function = "")]
     public class MixerElement
     {
+        [CCode (cname = "snd_mixer_elem_next")]
         public MixerElement next ();
+        [CCode (cname = "snd_mixer_elem_prev")]
         public MixerElement prev ();
-        [CCode (cname = "snd_mixer_selem_get_id")]
+
         public void get_id (SimpleElementId eid);
+        public bool is_active ();
+        public bool is_playback_mono ();
+        public bool has_playback_channel (SimpleChannelId channel);
+        public bool is_capture_mono ();
+        public bool has_capture_channel (SimpleChannelId channel);
+        public int  get_capture_group ();
+        public bool has_common_volume ();
+        public bool has_playback_volume ();
+        public bool has_playback_volume_joined ();
+        public bool has_capture_volume ();
+        public bool has_capture_volume_joined ();
+        public bool has_common_switch ();
+        public bool has_playback_switch ();
+        public bool has_playback_switch_joined ();
+        public bool has_capture_switch ();
+        public bool has_capture_switch_joined ();
+        public bool has_capture_switch_exclusive ();
+
+        public int ask_playback_vol_dB (long val, out long dBval);
+        public int ask_capture_vol_dB (long val, out long dBval);
+        public int ask_playback_dB_vol (long dBval, int dir, out long val);
+        public int ask_capture_dB_vol (long dBval, int dir, out long val);
+        public int get_playback_volume (SimpleChannelId channel, out long val);
+        public int get_capture_volume (SimpleChannelId channel, out long val);
+        public int get_playback_dB (SimpleChannelId channel, out long val);
+        public int get_capture_dB (SimpleChannelId channel, out long val);
+        public int get_playback_switch (SimpleChannelId channel, out int val);
+        public int get_capture_switch (SimpleChannelId channel, out int val);
+        public int set_playback_volume (SimpleChannelId channel, long val);
+        public int set_capture_volume (SimpleChannelId channel, long val);
+        public int set_playback_dB (SimpleChannelId channel, long val, int dir);
+        public int set_capture_dB (SimpleChannelId channel, long val, int dir);
+        public int set_playback_volume_all (long val);
+        public int set_capture_volume_all (long val);
+        public int set_playback_dB_all (long val, int dir);
+        public int set_capture_dB_all (long val, int dir);
+        public int set_playback_switch (SimpleChannelId channel, int val);
+        public int set_capture_switch (SimpleChannelId channel, int val);
+        public int set_playback_switch_all (int val);
+        public int set_capture_switch_all (int val);
+        public int get_playback_volume_range (out long min, out long max);
+        public int get_playback_dB_range (out long min, out long max);
+        public int set_playback_volume_range (long min, long max);
+        public int get_capture_volume_range (out long min, out long max);
+        public int get_capture_dB_range (out long min, out long max);
+        public int set_capture_volume_range (long min, long max);
+        public int is_enumerated ();
+        public int is_enum_playback ();
+        public int is_enum_capture ();
+        public int get_enum_items ();
+        public int get_enum_item_name (uint idx, size_t maxlen, out string str);
+        public int get_enum_item (SimpleChannelId channel, out uint idxp);
+        public int set_enum_item (SimpleChannelId channel, uint idx);
+    }
+
+    [CCode (cprefix = "SND_MIXER_SCHN_", cname = "snd_mixer_selem_channel_id_t")]
+    public enum SimpleChannelId
+    {
+        SND_MIXER_SCHN_UNKNOWN,
+        SND_MIXER_SCHN_MONO,
+        SND_MIXER_SCHN_FRONT_LEFT,
+        SND_MIXER_SCHN_FRONT_RIGHT,
+        SND_MIXER_SCHN_REAR_LEFT,
+        SND_MIXER_SCHN_REAR_RIGHT,
+        SND_MIXER_SCHN_FRONT_CENTER,
+        SND_MIXER_SCHN_WOOFER,
+        SND_MIXER_SCHN_SIDE_LEFT,
+        SND_MIXER_SCHN_SIDE_RIGHT,
+        SND_MIXER_SCHN_REAR_CENTER,
+        SND_MIXER_SCHN_LAST,
     }
 
     [Compact]
@@ -193,5 +301,4 @@ namespace Alsa {
         public unowned string get_name();
         public uint get_index();
     }
-
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]