changeset 1243:4cf6ccace89c

made OSS report latest set volume when not having opened a vmix device; removed the balance hack because Hannu will implement it soon
author Cristi Magherusan <majeru@atheme-project.org>
date Thu, 12 Jul 2007 17:51:36 +0300
parents 5e41a7affccb
children d0f1e147cf62 626f78ff2439
files src/OSS4/audio.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/OSS4/audio.c	Thu Jul 12 14:59:38 2007 +0900
+++ b/src/OSS4/audio.c	Thu Jul 12 17:51:36 2007 +0300
@@ -36,7 +36,7 @@
 
 #define NFRAGS		32
 
-static gint fd = 0;
+static gint fd = 0,temp_vol=0x6464;
 static char *buffer;
 static gboolean going, prebuffer, paused, unpause, do_pause, remove_prebuffer;
 static gint device_buffer_used, buffer_size, prebuffer_size, blk_size;
@@ -739,7 +739,8 @@
 {
     int v;
     long cmd=SNDCTL_DSP_GETPLAYVOL;
-    ioctl(fd, cmd, &v);
+    if(ioctl(fd, cmd, &v) == -1)
+        v=temp_vol;
     *r = (v & 0xFF00) >> 8;
     *l = (v & 0x00FF);
 }
@@ -747,11 +748,9 @@
 void
 oss_set_volume(int l, int r)
 {   
-    if(l!=r)
-        l=r=((l>r) ? l : r);
     long cmd=SNDCTL_DSP_SETPLAYVOL;   
-    int v = (r << 8) | l;
-    ioctl(fd, cmd, &v);
+    temp_vol = (r << 8) | l;
+    ioctl(fd, cmd, &temp_vol);
 }
 
 void