Subject: Re: Ideas on the audio framework
To: None <tech-kern@NetBSD.org>
From: Jukka Marin <jmarin@embedtronics.fi>
List: tech-kern
Date: 12/12/2004 22:34:21
On Sun, Dec 12, 2004 at 01:05:40PM -0600, David Young wrote:
> On Sun, Dec 12, 2004 at 11:11:23AM +0200, Jukka Marin wrote:
> > On Sat, Dec 11, 2004 at 04:45:42PM -0600, David Young wrote:
> > > Every volume control is not a slider.  Oftentimes the volume control is
> > > a a pair of buttons, volume up/down.
> > 
> > Never seen such an application, but I guess they exist.
> 
> *sigh* If you don't know the application space, you should not presume
> to suggest an audio API.

Well, what can you expect, after using computers for 21 or 22 years only
and being a NetBSD user since 0.9c..  I certainly haven't used all the
software that has been written in these decades.  I'm glad to hear that
you know every single application there is.

> It doesn't matter.  The important thing is that it makes the choice with
> knowledge of the hardware capabilities.

The problem is that I believe the operating system and drivers exist to
"hide" the hardware details behind the API so that the applications can
run with many kinds of hardware unchanged and unaware of the limitations
that can be hidden.  Obviously, you do not like this idea.

> > I don't need to know the size of a hard disk to be able to write a file to
> > it.  Why doesn't the audio driver hide volume control details?
> 
> This is a false analogy if I ever heard one.  You *do* need to know the
> size of a hard disk to mkfs it.  You are quite naive if you think that
> it is always possible or desirable to insulate applications from the
> hardware capabilities.

Yeah, you're right - it wasn't a good example.

> Can you state *quite explicitly* what xmmix and/or the NetBSD API does
> wrong?  If you mean the boneheaded stateful API, I agree with you that
> *that* is broken.

Drag a volume control knob in xmmix and release it at a random point.
Does it stay there?  Does the volume remain the same when you release
the mouse button?  On my machines, the volume changes when I release
the knob and I definately think this is wrong.  I have to try several
times to get the volume I want.

If the mixer accepted a level of, say, 0...255 and then internally converted
it to suit the hardware needs, any application could just pass that value
to the API and things would Just Work.  If the application wanted a slightly
higher volume, it would pass a greater value - if the hardware didn't have
enough steps in the volume control, the change might not have any effect -
but you can't really fix that if no such hardware gain exists.  Bumping the
volume up to the next hardware level is any better - the volume would still
not be the one requested by the user, but instead a higher one (which is
often undesirable).

I'm not sure if 0...255 is a good range.. to humans, 0...100% might be
easier, but that would lose some accuracy.  A logarithmic scale would
be nice, but I guess it would upset the applications, which expect to
see a linear mapping between the values supplied to API and the actual
hardware registers.

I wonder why the BSD folks are so hostile to all "new" ideas.  On the
other hand, I begin to understand why ever other guy is working on his
own copy of a BSD operating system.

  -jm