From 856cbf6aea682f547e21da5550fe7c3293b19c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 14 Feb 2013 20:28:26 +0000 Subject: [PATCH] e_mixer: add E_MIXER_CHANNEL_IS_MONO capability SVN revision: 83916 --- src/modules/mixer/e_mod_mixer.c | 5 +++++ src/modules/mixer/e_mod_mixer.h | 8 +++++--- src/modules/mixer/sys_alsa.c | 3 +++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/modules/mixer/e_mod_mixer.c b/src/modules/mixer/e_mod_mixer.c index 122a50715..72a6ebc7d 100644 --- a/src/modules/mixer/e_mod_mixer.c +++ b/src/modules/mixer/e_mod_mixer.c @@ -64,6 +64,11 @@ int e_mod_mixer_channel_mutable(const E_Mixer_Channel_Info *channel) return ((channel->capabilities & E_MIXER_CHANNEL_CAN_MUTE )!=0); } +int e_mod_mixer_channel_is_mono(const E_Mixer_Channel_Info *channel) +{ + return ((channel->capabilities & E_MIXER_CHANNEL_IS_MONO )!=0); +} + int e_mod_mixer_channel_has_capture(const E_Mixer_Channel_Info *channel) { return ((channel->capabilities & E_MIXER_CHANNEL_HAS_CAPTURE )!=0); diff --git a/src/modules/mixer/e_mod_mixer.h b/src/modules/mixer/e_mod_mixer.h index e8fc94f6b..6277cd6d2 100644 --- a/src/modules/mixer/e_mod_mixer.h +++ b/src/modules/mixer/e_mod_mixer.h @@ -15,9 +15,10 @@ typedef struct _E_Mixer_Channel_State } E_Mixer_Channel_State; #define E_MIXER_CHANNEL_CAN_MUTE 0x01 -#define E_MIXER_CHANNEL_HAS_CAPTURE 0x02 -#define E_MIXER_CHANNEL_HAS_PLAYBACK 0x04 -#define E_MIXER_CHANNEL_MASK 0xFE +#define E_MIXER_CHANNEL_IS_MONO 0x02 +#define E_MIXER_CHANNEL_HAS_CAPTURE 0x04 +#define E_MIXER_CHANNEL_HAS_PLAYBACK 0x08 +#define E_MIXER_CHANNEL_MASK 0xFC typedef struct _E_Mixer_Channel_Info { @@ -59,6 +60,7 @@ void e_mod_mixer_channel_names_free(Eina_List*); void e_mod_mixer_card_names_free(Eina_List*); int e_mod_mixer_channel_mutable(const E_Mixer_Channel_Info *channel); +int e_mod_mixer_channel_is_mono(const E_Mixer_Channel_Info *channel); int e_mod_mixer_channel_has_capture(const E_Mixer_Channel_Info *channel); int e_mod_mixer_channel_has_playback(const E_Mixer_Channel_Info *channel); int e_mod_mixer_channel_is_boost(const E_Mixer_Channel_Info *channel); diff --git a/src/modules/mixer/sys_alsa.c b/src/modules/mixer/sys_alsa.c index acdbf279a..c35e3a5d8 100644 --- a/src/modules/mixer/sys_alsa.c +++ b/src/modules/mixer/sys_alsa.c @@ -318,6 +318,9 @@ _mixer_channel_capabilities(snd_mixer_elem_t *elem) if (snd_mixer_selem_has_capture_volume(elem)) capabilities |= E_MIXER_CHANNEL_HAS_CAPTURE; + if (snd_mixer_selem_is_playback_mono(elem)==1 || + snd_mixer_selem_is_capture_mono(elem)==1) + capabilities |= E_MIXER_CHANNEL_IS_MONO; if (snd_mixer_selem_has_playback_volume(elem)) capabilities |= E_MIXER_CHANNEL_HAS_PLAYBACK; if (snd_mixer_selem_has_playback_switch(elem) ||