Rob Browning <[EMAIL PROTECTED]> writes:

> Hmm if you make it an "|" dependency, then it seems like you would
> have to have a reliable and quick way of detecting which backend to
> use whenever the -b option is not specified (i.e. detect which sox
> backends are installed).  For now, I'd be tempted to just require
> both backends (which would add 60k to the install).

I take that back.  I wasn't considering the size of libsox-fmt-alsa's
dependencies.

> Even then, it'd still be nice to automatically pick the default
> backend based on whether or not the system is using oss or alsa, but
> offhand, I don't know if there's a reliable indicator...

I've nearly finished a patch here that should address these issues.
It fixes the first issue by running "sox --help" at startup and
parsing the output to detect if the alsa and/or oss backends are
available.  This isn't an ideal solution since it will break if sox is
ever localized, but as yet, I haven't thought of a better solution
that wouldn't require modifying sox (i.e. to support something like
"sox --list-output-formats" or a test like "sox --supports
ouput-alsa").

To help address the second problem, I added a test for the existence
of /proc/asound.  The assumption is that if it exists, then alsa is
available in the kernel.

Given that, the combination of the sox --help tests and the
/proc/asound test are used to determine which backend to use.  If alsa
is available (both in the kernel and in sox), and the user hasn't
specified otherwise, then saytime will prefer alsa.  Otherwise it will
use oss.  If the user requests (via -b) a backend that isn't
available, saytime reports an error.

Of course with the new code, anyone who (perhaps accidentally) doesn't
install libsox-fmt-alsa on an alsa system like mine will just hear bad
(echoing) sound.

One issue with the patch is that it uses popen, pclose, and GNU
getline.  I dont't know whether or not those additional dependencies
are acceptable.  In any case, when I have a chance, I'll clean up the
patch and send it.

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to