Hi,

- fixes the input channel detection
- if channel is mono force right to 0, disable right slider and lock

regards
Jérémy
diff --git a/e/src/modules/mixer/app_mixer.c b/e/src/modules/mixer/app_mixer.c
index 737bf86..2fb37d1 100644
--- a/e/src/modules/mixer/app_mixer.c
+++ b/e/src/modules/mixer/app_mixer.c
@@ -53,6 +53,7 @@ typedef struct E_Mixer_App_Dialog_Data
 
 struct channel_info
 {
+   int                      is_mono;
    int                      has_capture;
    const char              *name;
    E_Mixer_Channel         *id;
@@ -169,7 +170,9 @@ _populate_channel_editor(E_Mixer_App_Dialog_Data *app)
    e_mod_mixer_state_get(app->sys, app->channel_info->id, &state);
    _update_channel_editor_state(app, state);
 
-   app->lock_sliders = (state.left == state.right);
+   e_widget_disabled_set(ui->right, app->channel_info->is_mono);
+   app->lock_sliders = ( (state.left == state.right) && 
!app->channel_info->is_mono );
+   e_widget_disabled_set(ui->lock_sliders, app->channel_info->is_mono);
    e_widget_check_checked_set(ui->lock_sliders, app->lock_sliders);
 }
 
@@ -211,6 +214,7 @@ _channels_info_new(E_Mixer_System *sys)
         info = malloc(sizeof(*info));
         info->id = l->data;
         info->name = e_mod_mixer_channel_name_get(sys, info->id);
+        info->is_mono = e_mod_mixer_mono_get(sys, info->id);
         info->has_capture = e_mod_mixer_capture_get(sys, info->id);
 
         channels_infos = eina_list_append(channels_infos, info);
diff --git a/e/src/modules/mixer/e_mod_main.c b/e/src/modules/mixer/e_mod_main.c
index d133417..3c8f6d6 100644
--- a/e/src/modules/mixer/e_mod_main.c
+++ b/e/src/modules/mixer/e_mod_main.c
@@ -19,6 +19,7 @@ E_Mixer_Mute_Get_Cb e_mod_mixer_mute_get;
 E_Mixer_Mute_Set_Cb e_mod_mixer_mute_set;
 E_Mixer_Capture_Cb e_mod_mixer_mutable_get;
 E_Mixer_State_Get_Cb e_mod_mixer_state_get;
+E_Mixer_Capture_Cb e_mod_mixer_mono_get;
 E_Mixer_Capture_Cb e_mod_mixer_capture_get;
 E_Mixer_Cb e_mod_mixer_new;
 E_Mixer_Cb e_mod_mixer_del;
@@ -1469,6 +1470,7 @@ e_mixer_default_setup(void)
    e_mod_mixer_mute_set = (void *)e_mixer_system_set_mute;
    e_mod_mixer_mutable_get = (void *)e_mixer_system_can_mute;
    e_mod_mixer_state_get = (void *)e_mixer_system_get_state;
+   e_mod_mixer_mono_get = (void *)e_mixer_system_is_mono;
    e_mod_mixer_capture_get = (void *)e_mixer_system_has_capture;
    e_mod_mixer_new = (void *)e_mixer_system_new;
    e_mod_mixer_del = (void *)e_mixer_system_del;
@@ -1499,6 +1501,7 @@ e_mixer_pulse_setup(void)
    e_mod_mixer_mute_set = (void *)e_mixer_pulse_set_mute;
    e_mod_mixer_mutable_get = (void *)e_mixer_pulse_can_mute;
    e_mod_mixer_state_get = (void *)e_mixer_pulse_get_state;
+   e_mod_mixer_mono_get = (void *)e_mixer_pulse_is_mono;
    e_mod_mixer_capture_get = (void *)e_mixer_pulse_has_capture;
    e_mod_mixer_new = (void *)e_mixer_pulse_new;
    e_mod_mixer_del = (void *)e_mixer_pulse_del;
diff --git a/e/src/modules/mixer/e_mod_main.h b/e/src/modules/mixer/e_mod_main.h
index 8320366..28faab0 100644
--- a/e/src/modules/mixer/e_mod_main.h
+++ b/e/src/modules/mixer/e_mod_main.h
@@ -111,6 +111,7 @@ extern E_Mixer_Mute_Get_Cb e_mod_mixer_mute_get;
 extern E_Mixer_Mute_Set_Cb e_mod_mixer_mute_set;
 extern E_Mixer_Capture_Cb e_mod_mixer_mutable_get;
 extern E_Mixer_State_Get_Cb e_mod_mixer_state_get;
+extern E_Mixer_Capture_Cb e_mod_mixer_mono_get;
 extern E_Mixer_Capture_Cb e_mod_mixer_capture_get;
 extern E_Mixer_Cb e_mod_mixer_new;
 extern E_Mixer_Cb e_mod_mixer_del;
diff --git a/e/src/modules/mixer/e_mod_system.h 
b/e/src/modules/mixer/e_mod_system.h
index 7a401c4..206d2c1 100644
--- a/e/src/modules/mixer/e_mod_system.h
+++ b/e/src/modules/mixer/e_mod_system.h
@@ -43,6 +43,7 @@ int e_mixer_system_set_volume(E_Mixer_System *self, 
E_Mixer_Channel *channel, in
 int e_mixer_system_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel, 
int *mute);
 int e_mixer_system_set_mute(E_Mixer_System *self, E_Mixer_Channel *channel, 
int mute);
 int e_mixer_system_can_mute(E_Mixer_System *self, E_Mixer_Channel *channel);
+int e_mixer_system_is_mono(E_Mixer_System *self, E_Mixer_Channel *channel);
 int e_mixer_system_has_capture(E_Mixer_System *self, E_Mixer_Channel *channel);
 
 int pulse_init(void);
@@ -70,6 +71,7 @@ int e_mixer_pulse_get_mute(E_Mixer_System *self, 
E_Mixer_Channel *channel, int *
 int e_mixer_pulse_set_mute(E_Mixer_System *self, E_Mixer_Channel *channel, int 
mute);
 int e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, 
E_Mixer_Channel_State *state);
 int e_mixer_pulse_set_state(E_Mixer_System *self, E_Mixer_Channel *channel, 
const E_Mixer_Channel_State *state);
+int e_mixer_pulse_is_mono(E_Mixer_System *self, E_Mixer_Channel *channel);
 int e_mixer_pulse_has_capture(E_Mixer_System *self, E_Mixer_Channel *channel);
 
 #endif /* E_MOD_SYSTEM_H */
diff --git a/e/src/modules/mixer/sys_alsa.c b/e/src/modules/mixer/sys_alsa.c
index af12281..ad89425 100644
--- a/e/src/modules/mixer/sys_alsa.c
+++ b/e/src/modules/mixer/sys_alsa.c
@@ -473,14 +473,15 @@ e_mixer_system_get_volume(E_Mixer_System *self,
    else
      lvol = min;
 
-   if (snd_mixer_selem_has_playback_channel(channel, 1))
+   if (snd_mixer_selem_is_playback_mono(channel))
+     rvol = min;
+   else if (snd_mixer_selem_has_playback_volume_joined(channel))
+     rvol = lvol;
+   else if (snd_mixer_selem_has_playback_channel(channel, 1))
      snd_mixer_selem_get_playback_volume(channel, 1, &rvol);
    else
      rvol = min;
 
-   if (snd_mixer_selem_is_playback_mono(channel) ||
-       snd_mixer_selem_has_playback_volume_joined(channel))
-     rvol = lvol;
 
    *left = rint((double)(lvol - min) * 100 / (double)range);
    *right = rint((double)(rvol - min) * 100 / (double)range);
@@ -625,12 +626,22 @@ e_mixer_system_set_state(E_Mixer_System *self,
 }
 
 int
+e_mixer_system_is_mono(E_Mixer_System *self,
+                        E_Mixer_Channel *channel)
+{
+   if ((!self) || (!channel))
+     return 0;
+
+   return snd_mixer_selem_is_playback_mono(channel);
+}
+
+int
 e_mixer_system_has_capture(E_Mixer_System *self,
                            E_Mixer_Channel *channel)
 {
    if ((!self) || (!channel))
      return 0;
 
-   return snd_mixer_selem_has_capture_switch(channel);
+   return snd_mixer_selem_has_capture_volume(channel);
 }
 
diff --git a/e/src/modules/mixer/sys_pulse.c b/e/src/modules/mixer/sys_pulse.c
index badfdcf..10a5954 100644
--- a/e/src/modules/mixer/sys_pulse.c
+++ b/e/src/modules/mixer/sys_pulse.c
@@ -593,6 +593,12 @@ e_mixer_pulse_set_volume(E_Mixer_System *self, 
E_Mixer_Channel *channel, int lef
 }
 
 int
+e_mixer_pulse_is_mono(E_Mixer_System *self __UNUSED__, E_Mixer_Channel 
*channel __UNUSED__)
+{
+   return 0;
+}
+
+int
 e_mixer_pulse_can_mute(E_Mixer_System *self __UNUSED__, E_Mixer_Channel 
*channel __UNUSED__)
 {
    return 1;
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to