sys/sunaudio/gstsunaudiomixerctrl.c: Improvements for the SunAudio mixer by handling mute as no gain for tracks that ...

Original commit message from CVS:
Patch by: Brian Cameron <brian.cameron at sun dot com>
* sys/sunaudio/gstsunaudiomixerctrl.c:
(gst_sunaudiomixer_ctrl_get_volume),
(gst_sunaudiomixer_ctrl_set_volume):
Improvements for the SunAudio mixer by handling mute as no gain
for tracks that have a gain property but no mute property.
Fixes bug #536067.
This commit is contained in:
Brian Cameron 2008-06-10 06:52:44 +00:00 committed by Sebastian Dröge
parent f3b03cd773
commit fe573a687f
2 changed files with 42 additions and 4 deletions

View file

@ -1,3 +1,14 @@
2008-06-10 Sebastian Dröge <slomo@circular-chaos.org>
Patch by: Brian Cameron <brian.cameron at sun dot com>
* sys/sunaudio/gstsunaudiomixerctrl.c:
(gst_sunaudiomixer_ctrl_get_volume),
(gst_sunaudiomixer_ctrl_set_volume):
Improvements for the SunAudio mixer by handling mute as no gain
for tracks that have a gain property but no mute property.
Fixes bug #536067.
2008-06-10 Sebastian Dröge <slomo@circular-chaos.org> 2008-06-10 Sebastian Dröge <slomo@circular-chaos.org>
* configure.ac: * configure.ac:

View file

@ -73,6 +73,7 @@ void
gst_sunaudiomixer_ctrl_build_list (GstSunAudioMixerCtrl * mixer) gst_sunaudiomixer_ctrl_build_list (GstSunAudioMixerCtrl * mixer)
{ {
GstMixerTrack *track; GstMixerTrack *track;
struct audio_info audioinfo; struct audio_info audioinfo;
/* /*
@ -175,8 +176,11 @@ gst_sunaudiomixer_ctrl_get_volume (GstSunAudioMixerCtrl * mixer,
GstMixerTrack * track, gint * volumes) GstMixerTrack * track, gint * volumes)
{ {
gint gain, balance; gint gain, balance;
float ratio; float ratio;
struct audio_info audioinfo; struct audio_info audioinfo;
GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track); GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track);
g_return_if_fail (mixer->mixer_fd != -1); g_return_if_fail (mixer->mixer_fd != -1);
@ -242,12 +246,12 @@ gst_sunaudiomixer_ctrl_get_volume (GstSunAudioMixerCtrl * mixer,
if ((sunaudiotrack->track_num == GST_SUNAUDIO_TRACK_OUTPUT && if ((sunaudiotrack->track_num == GST_SUNAUDIO_TRACK_OUTPUT &&
audioinfo.output_muted == 1) || audioinfo.output_muted == 1) ||
(sunaudiotrack->track_num != GST_SUNAUDIO_TRACK_OUTPUT && gain == 0)) { (sunaudiotrack->track_num != GST_SUNAUDIO_TRACK_OUTPUT && gain == 0)) {
track->flags |= GST_MIXER_TRACK_MUTE;
} else {
/* /*
* If MUTE is set, then gain is always 0, so don't bother * If MUTE is set, then gain is always 0, so don't bother
* resetting our internal value. * resetting our internal value.
*/ */
track->flags |= GST_MIXER_TRACK_MUTE;
} else {
sunaudiotrack->gain = gain; sunaudiotrack->gain = gain;
sunaudiotrack->balance = balance; sunaudiotrack->balance = balance;
track->flags &= ~GST_MIXER_TRACK_MUTE; track->flags &= ~GST_MIXER_TRACK_MUTE;
@ -259,13 +263,21 @@ gst_sunaudiomixer_ctrl_set_volume (GstSunAudioMixerCtrl * mixer,
GstMixerTrack * track, gint * volumes) GstMixerTrack * track, gint * volumes)
{ {
gint gain; gint gain;
gint balance; gint balance;
gint l_real_gain; gint l_real_gain;
gint r_real_gain; gint r_real_gain;
float ratio; float ratio;
gchar buf[100]; gchar buf[100];
struct audio_info audioinfo; struct audio_info audioinfo;
GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track); GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track);
gint temp[2]; gint temp[2];
l_real_gain = volumes[0]; l_real_gain = volumes[0];
@ -289,8 +301,19 @@ gst_sunaudiomixer_ctrl_set_volume (GstSunAudioMixerCtrl * mixer,
sunaudiotrack->gain = gain; sunaudiotrack->gain = gain;
sunaudiotrack->balance = balance; sunaudiotrack->balance = balance;
if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE)) if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE)) {
if (sunaudiotrack->track_num == GST_SUNAUDIO_TRACK_OUTPUT) {
return; return;
} else if (gain == 0) {
return;
} else {
/*
* If the volume is set to a non-zero value for LINE_IN
* or MONITOR, then unset MUTE.
*/
track->flags &= ~GST_MIXER_TRACK_MUTE;
}
}
/* Set the volume */ /* Set the volume */
AUDIO_INITINFO (&audioinfo); AUDIO_INITINFO (&audioinfo);
@ -323,7 +346,9 @@ gst_sunaudiomixer_ctrl_set_mute (GstSunAudioMixerCtrl * mixer,
GstMixerTrack * track, gboolean mute) GstMixerTrack * track, gboolean mute)
{ {
struct audio_info audioinfo; struct audio_info audioinfo;
GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track); GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track);
gint volume, balance; gint volume, balance;
AUDIO_INITINFO (&audioinfo); AUDIO_INITINFO (&audioinfo);
@ -372,7 +397,9 @@ gst_sunaudiomixer_ctrl_set_record (GstSunAudioMixerCtrl * mixer,
GstMixerTrack * track, gboolean record) GstMixerTrack * track, gboolean record)
{ {
GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track); GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track);
struct audio_info audioinfo; struct audio_info audioinfo;
GList *trk; GList *trk;
/* Don't change the setting */ /* Don't change the setting */