--- gst-plugins-0.8.11/sys/sunaudio/gstsunmixer.c-orig	2005-12-26 00:15:25.749083000 -0800
+++ gst-plugins-0.8.11/sys/sunaudio/gstsunmixer.c	2005-12-26 00:12:16.311836000 -0800
@@ -232,9 +232,11 @@ gst_sunaudiomixer_set_volume (GstMixer *
 
 
   if (ioctl (sunaudio->mixer_fd, AUDIO_SETINFO, &audioinfo) < 0) {
-    g_warning ("Error setting volume");
+    g_warning ("Error setting audio device volume");
     return;
   }
+
+  sunaudiotrack->lvol = volume;
 }
 
 static void
@@ -249,7 +251,7 @@ gst_sunaudiomixer_get_volume (GstMixer *
   g_return_if_fail (sunaudio->mixer_fd != -1);
 
   if (ioctl (sunaudio->mixer_fd, AUDIO_GETINFO, &audioinfo) < 0) {
-    g_warning ("Error setting volume device");
+    g_warning ("Error getting audio device volume");
     return;
   }
 
@@ -277,6 +279,7 @@ gst_sunaudiomixer_set_mute (GstMixer * m
   struct audio_info audioinfo;
   GstSunAudioElement *sunaudio = GST_SUNAUDIOELEMENT (mixer);
   GstSunAudioMixerTrack *sunaudiotrack = GST_SUNAUDIOMIXER_TRACK (track);
+  gint volume;
 
   g_return_if_fail (sunaudio->mixer_fd != -1);
   if (sunaudiotrack->track_num != 0)
@@ -286,12 +289,27 @@ gst_sunaudiomixer_set_mute (GstMixer * m
 
   if (mute) {
     audioinfo.output_muted = 1;
+    volume = 0;
   } else {
     audioinfo.output_muted = 0;
+    volume = sunaudiotrack->lvol;
+  }
+
+  /* Set the volume */
+  switch (sunaudiotrack->track_num) {
+    case 0:
+      audioinfo.play.gain = volume;
+      break;
+    case 1:
+      audioinfo.record.gain = volume;
+      break;
+    case 2:
+      audioinfo.monitor_gain = volume;
+      break;
   }
 
   if (ioctl (sunaudio->mixer_fd, AUDIO_SETINFO, &audioinfo) < 0) {
-    g_warning ("Error setting volume device");
+    g_warning ("Error setting audio device volume");
     return;
   }
 }
--- gst-plugins-0.8.11/sys/sunaudio/gstsunelement.c-orig	2005-12-26 00:25:15.690855000 -0800
+++ gst-plugins-0.8.11/sys/sunaudio/gstsunelement.c	2005-12-26 00:33:02.982703000 -0800
@@ -198,9 +198,18 @@ gst_sunaudioelement_class_probe_devices 
     }
   }
 
-
   if (!init && !check) {
-    if ((fd = open ("/dev/audioctl", openmode | O_NONBLOCK)) > 0
+     const char *audiodev;
+     char *mixdevice;
+
+     audiodev = g_getenv ("AUDIODEV");
+     if (audiodev == NULL) {
+       mixdevice = g_strdup ("/dev/audioctl");
+     } else {
+       mixdevice = g_strdup_printf ("/dev/%sctl", audiodev);
+     }
+
+    if ((fd = open (mixdevice, openmode | O_NONBLOCK)) > 0
         || errno == EBUSY) {
       GstSunAudioDeviceCombination *combi;
 
@@ -208,9 +217,11 @@ gst_sunaudioelement_class_probe_devices 
         close (fd);
 
       combi = g_new0 (GstSunAudioDeviceCombination, 1);
-      combi->mixer = g_strdup ("/dev/audioctl");
+      combi->mixer = mixdevice;
       device_combinations =
           device_combination_append (device_combinations, combi);
+    } else {
+      g_free (mixdevice);
     }
     init = TRUE;
   }
@@ -326,8 +337,15 @@ gst_sunaudioprobe_interface_init (GstPro
 static void
 gst_sunaudioelement_init (GstSunAudioElement * sunaudio)
 {
+  const char *audiodev;
+
   sunaudio->device = g_strdup ("/dev/audio");
-  sunaudio->mixer_dev = g_strdup ("/dev/audioctl");
+
+  audiodev = g_getenv ("AUDIODEV");
+  if (audiodev == NULL)
+     sunaudio->mixer_dev = g_strdup ("/dev/audioctl");
+  else
+     sunaudio->mixer_dev = g_strdup_printf ("/dev/%sctl", audiodev);
   sunaudio->fd = -1;
   sunaudio->mixer_fd = -1;
   sunaudio->tracklist = NULL;
