From: Jérémy Zurcher <jeremy@asynk.ch>

Subject: [E-devel] mixer module alsa input and mono patch

- fixes the input channel detection
- if channel is mono force right to 0, disable right slider and lock
- add missing dummy implementation of e_mixer_system_is_mono
 


SVN revision: 81317
This commit is contained in:
Jérémy Zurcher 2012-12-19 01:30:15 +00:00 committed by Carsten Haitzler
parent dddfaa1ae2
commit 4ad440dd44
7 changed files with 39 additions and 6 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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);
@ -624,6 +625,16 @@ e_mixer_system_set_state(E_Mixer_System *self,
return r;
}
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)
@ -631,6 +642,6 @@ e_mixer_system_has_capture(E_Mixer_System *self,
if ((!self) || (!channel))
return 0;
return snd_mixer_selem_has_capture_switch(channel);
return snd_mixer_selem_has_capture_volume(channel);
}

View File

@ -178,6 +178,12 @@ e_mixer_system_set_state(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *chann
return 0;
}
int
e_mixer_system_is_mono(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *channel __UNUSED__)
{
return 0;
}
int
e_mixer_system_has_capture(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *channel __UNUSED__)
{

View File

@ -592,6 +592,12 @@ e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int lef
return 1;
}
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__)
{