On Sun, Aug 07, 2005 at 05:18:09PM -0400, Ted Unangst wrote:
> On Thu, 4 Aug 2005, D. Adam Karim wrote:
> 
>> I never even heard of madplay until I just read these emails. Let me say,
>> it is nice!!! I was using mp3blaster but it has some strange bug going on
>> where one cannot adjust the volume down, only up. Maybe it's just me,
>> hehe. Anyways, I'm liking madplay though.
> 
> that bug has existed for at least 5 years.

I have this patch for that.  I can't remember where it came from.
It looks vaguely like something I might have written.
Just whack it into patches/patch-nmixer_ossmixer_cc.

--- ossmixer.cc.orig    Fri Sep 20 14:38:16 2002
+++ ossmixer.cc Mon Aug  8 11:53:34 2005
@@ -49,8 +49,28 @@
 
 bool OSSMixer::Set(int device, struct volume *vol)
 {
+       int retcode;
+       int oldsetting;
+       int delta;
        int setting = (vol->left & 0xFF) + ((vol->right & 0xFF) << 8);
-       return (ioctl(mixer, MIXER_WRITE(device), &setting) >= 0);
+
+       ioctl(mixer, MIXER_READ(device), &oldsetting);
+
+       if (setting > oldsetting) delta = 1;
+       else if (setting < oldsetting) delta = -1;
+       else delta = 0;
+
+       retcode = ioctl(mixer, MIXER_WRITE(device), &setting);
+
+       ioctl(mixer, MIXER_READ(device), &setting);
+       if (setting == oldsetting) {
+               vol->left = vol->left + delta;
+               vol->right = vol->right + delta;
+               setting = (vol->left & 0xFF) + ((vol->right & 0xFF) << 8);
+               retcode = ioctl(mixer, MIXER_WRITE(device), &setting);
+       }
+
+       return (retcode >= 0);
 }
 
 bool OSSMixer::Get(int device, struct volume *vol)

-- 
WWTDD?
Jon Martin - Undergraduate Labs Systems Administrator (ISG - labadmin)
Department of Computing Science at University of Alberta.

Reply via email to