This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: More linuxaudiodev fixes
Type: Stage:
Components: Extension Modules Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: gward
Priority: normal Keywords: patch

Created on 2002-11-29 18:15 by gward, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
lad-overhaul-1.patch gward, 2002-11-29 18:15
Messages (3)
msg41856 - (view) Author: Greg Ward (gward) (Python committer) Date: 2002-11-29 18:15
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!
msg41857 - (view) Author: Greg Ward (gward) (Python committer) Date: 2002-11-29 18:20
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.
msg41858 - (view) Author: Greg Ward (gward) (Python committer) Date: 2002-11-30 22:57
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.  
History
Date User Action Args
2022-04-10 16:05:57adminsetgithub: 37554
2002-11-29 18:15:35gwardcreate