[Patches] [ python-Patches-645786 ] More linuxaudiodev fixes
noreply@sourceforge.net
noreply@sourceforge.net
Sat, 30 Nov 2002 14:57:52 -0800
Patches item #645786, was opened at 2002-11-29 13:15
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=645786&group_id=5470
Category: Modules
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Greg Ward (gward)
Assigned to: Nobody/Anonymous (nobody)
Summary: More linuxaudiodev fixes
Initial Comment:
This patch provides a bunch of improvements / fixes /
rearrangements / clarifications to the linuxaudiodev
module:
* Don't put the device in non-blocking mode at open()
time; this makes
it impossible to access blocking mode!
* Rename write() to writeall(), and add a write()
method that just
does one write().
* Rearrange/simplify writeall(): in particular, don't
supply a timeout
to select. Let it block forever if it has to.
* Add a bunch of simple ioctl() wrappers: nonblock(),
setfmt(),
getfmts(), channels(), speed(), sync(), reset(),
post(). These
wrap, respectively, SNDCTL_DSP_NONBLOCK,
SNDCTL_DSP_SETFMT, SNDCTL_DSP_GETFMTS, etc.
* Reduce flush() (which was a wrapper for the
SNDCTL_DSP_SYNC
ioctl) to an alias for sync().
* Rearrange the lad_methods list to reflect the order
in which the
methods are defined, and add some grouping comments.
With this patch, the module now acts sanely enough that
it's worth documenting (IMHO). And I understand it
well enough to write some docs!
----------------------------------------------------------------------
>Comment By: Greg Ward (gward)
Date: 2002-11-30 17:57
Message:
Logged In: YES
user_id=14422
Instead of hacking up linuxaudiodev.c, I've created a new module ossaudiodev.c (derived from linuxaudiodev.c of course), and applied this patch to ossaudiodev.
----------------------------------------------------------------------
Comment By: Greg Ward (gward)
Date: 2002-11-29 13:20
Message:
Logged In: YES
user_id=14422
Oops, forgot to mention: this *should* be backwards
compatible for anyone who's not trying to do funky stuff
with linuxaudiodev. In particular, the old code opened the
device non-blocking, and its write() method guaranteed
consuming the whole buffer and blocking until that was done.
My patch makes it open in blocking mode, and the much
simpler write() method relies on OSS's guarantee to block
and consume the whole buffer. If that doesn't work, apps
can just use writeall() in either blocking or non-blocking mode.
Since the whole point of my changes is to allow people to do
funky stuff with linuxaudiodev (eg. writing to two devices
simultaneously), then I rather doubt that anyone is using
it that way now.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=645786&group_id=5470