OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: fix for emulated encodings for uaudio(4)

From: Alexandre Ratchov (alexcaoua.org)
Date: Wed Aug 29 2007 - 17:47:53 CDT


On Wed, Aug 29, 2007 at 11:38:19AM +0000, Jacob Meuser wrote:
> On Wed, Aug 29, 2007 at 09:03:22AM +0200, Alexandre Ratchov wrote:
>
> >
> > ok, so I'll not add this kind of conversions. So, we keep the
> > uaudio fixes I've posted as is, ok?
>
> you should probably make mono playback work if it's not overly
> complicated. mono recording is not possible at the moment though if
> a device doesn't support that natively.
>

ok I'll try to make it work that way

>
> > My very _personal_ point of view is that we don't really need this
> > conversion stuff in the kernel because:
> >
> > - simple apps use stereo/16bit/slinear_le, which is supported by
> > most (all?) devices we support
>
> except that audio(4) says that '$ cat /dev/audio > /tmp/out.pcm'
> should give you mono mulaw 8000 Hz.
>

note that this doesn't work for all devices because not all support
8000Hz sample rate.

> actually, it creates a (very) minor problem for all drivers that
> don't support mulaw mono - it's possible for the audio system to
> actually put a block of mulaw audio into the playback buffer when
> the device is opened, and before the format to be used has been
> selected, resulting in a slight pop on audio playback startup.
>
> the default format should be the default format of the specific
> device, IMO.
>

Yes; I agree too.

> I would like to get rid of all these conversions as well (even though
> they seem to be working pretty well right now), but I think until there
> is an alternative way to provide at least the current functionality,
> removing them is a bad choice.
>
> I bet many people have played mono files on auich(4) devices
> and never knew they were using the kernel audio conversion routines,
> and would be unhappy if that were not possible anymore.
>

ok, so do you agree with the following?

 - provide mulaw_to_any and any_to_mulaw conversions to ensure that
   the default params for /dev/audio always work on any device.
   This requires 26 conversion routines.

   If we assume that the device supports stereo/16bit/slinear_le,
   this would require only two routines.

 - provide mono_to_stereo and stereo_to_mono for all encodings
   this requires 4 routines only (mts8, stm8, mts16 and stm16)

> the reality is the conversions we have now are really pretty
> simple. I suspect the reason the conversion stuff was broken for
> so long is simply that no one really cared to make it work.
>

yeah, while browsing auich, things seem pretty simple and readable.
I'll try to make uaudio use the same style of audio_set_params
method

cheers,

-- Alexandre