Jonathan Martin <[EMAIL PROTECTED]> 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.
> > 
> > that bug has existed for at least 5 years.
> 
> I have this patch for that.  I can't remember where it came from.

The problem is that our mixers don't provide a smooth range 0..255
(scaled to 0..100 by the OSS emulation) but will ratchet up to the
next supported value.  The details may vary with the sound hardware,
on my laptops (clcs, auich) the step size is 8.  mp3blaster tries
to adjust the volume by +/- 2 on the OSS scale, which doesn't work.

Example:  Let outputs.mixer be 103.  Setting it to 103+1 will ratchet
it up to 111, but 103-1 will return to 103.

>  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);
>  }

I don't see how this can work, since it doesn't bump the increment
up to the required step size.

*Compiles...*

Nope, doesn't work here.

-- 
Christian "naddy" Weisgerber                          [EMAIL PROTECTED]

Reply via email to