summaryrefslogtreecommitdiff
path: root/sys/sunaudio
diff options
context:
space:
mode:
authorBrian Cameron <brian.cameron@sun.com>2008-06-10 06:52:44 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-06-10 06:52:44 +0000
commitfe573a687f0f03b3cd41a7fea9a68bb0697a725a (patch)
treefef1742259d782c534b2fb084f5fa71ea436ede0 /sys/sunaudio
parentf3b03cd77318bccf2fd0d724a3f3f6d457b4277f (diff)
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.
Diffstat (limited to 'sys/sunaudio')
-rw-r--r--sys/sunaudio/gstsunaudiomixerctrl.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/sys/sunaudio/gstsunaudiomixerctrl.c b/sys/sunaudio/gstsunaudiomixerctrl.c
index ef296a3aa..15fe11472 100644
--- a/sys/sunaudio/gstsunaudiomixerctrl.c
+++ b/sys/sunaudio/gstsunaudiomixerctrl.c
@@ -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 */