Commit fe573a68 authored by Brian Cameron's avatar Brian Cameron Committed by Sebastian Dröge

sys/sunaudio/gstsunaudiomixerctrl.c: Improvements for the SunAudio mixer by...

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.
parent f3b03cd7
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>
* configure.ac:
......
......@@ -73,6 +73,7 @@ void
gst_sunaudiomixer_ctrl_build_list (GstSunAudioMixerCtrl * mixer)
{
GstMixerTrack *track;
struct audio_info audioinfo;
/*
......@@ -175,8 +176,11 @@ gst_sunaudiomixer_ctrl_get_volume (GstSunAudioMixerCtrl * mixer,
GstMixerTrack * track, gint * volumes)
{
gint gain, balance;
float ratio;
struct audio_info audioinfo;
GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track);
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 &&
audioinfo.output_muted == 1) ||
(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
* resetting our internal value.
*/
track->flags |= GST_MIXER_TRACK_MUTE;
} else {
sunaudiotrack->gain = gain;
sunaudiotrack->balance = balance;
track->flags &= ~GST_MIXER_TRACK_MUTE;
......@@ -259,13 +263,21 @@ gst_sunaudiomixer_ctrl_set_volume (GstSunAudioMixerCtrl * mixer,
GstMixerTrack * track, gint * volumes)
{
gint gain;
gint balance;
gint l_real_gain;
gint r_real_gain;
float ratio;
gchar buf[100];
struct audio_info audioinfo;
GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track);
gint temp[2];
l_real_gain = volumes[0];
......@@ -289,8 +301,19 @@ gst_sunaudiomixer_ctrl_set_volume (GstSunAudioMixerCtrl * mixer,
sunaudiotrack->gain = gain;
sunaudiotrack->balance = balance;
if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE))
return;
if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE)) {
if (sunaudiotrack->track_num == GST_SUNAUDIO_TRACK_OUTPUT) {
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 */
AUDIO_INITINFO (&audioinfo);
......@@ -323,7 +346,9 @@ gst_sunaudiomixer_ctrl_set_mute (GstSunAudioMixerCtrl * mixer,
GstMixerTrack * track, gboolean mute)
{
struct audio_info audioinfo;
GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track);
gint volume, balance;
AUDIO_INITINFO (&audioinfo);
......@@ -372,7 +397,9 @@ gst_sunaudiomixer_ctrl_set_record (GstSunAudioMixerCtrl * mixer,
GstMixerTrack * track, gboolean record)
{
GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIO_MIXER_TRACK (track);
struct audio_info audioinfo;
GList *trk;
/* Don't change the setting */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment