summaryrefslogtreecommitdiffstats
path: root/Modules/ossaudiodev.c
Commit message (Collapse)AuthorAgeFilesLines
...
* SF #818006: merge from release24-maint branch: add useful read-onlyGreg Ward2005-03-071-26/+54
| | | | attributes to oss_audio_device object: 'closed', 'name', and 'mode'.
* SF #832236: merge from release23-maint branch: wrap a bunch ofGreg Ward2004-05-111-0/+18
| | | | | _EXPORT_INT calls in #ifdef's, to avoid breaking the build on MkLinux (Linux 2.0).
* Whitespace normalization; break a long line.Guido van Rossum2003-06-021-39/+40
|
* Fix a subtle decref bug that caused a GC assertion to fail in a debugGuido van Rossum2003-06-021-0/+3
| | | | | | | build (assert(gc->gc.gc_refs != 0) in visit_decref()). Because OSSAudioError is a global, we must compensate (twice!) for PyModule_AddObject()'s "helpful" decref of the object it adds.
* Comment fix.Greg Ward2003-05-291-1/+1
|
* Change _ssize() so it doesn't rely on sizeof(char) or sizeof(short):Greg Ward2003-05-291-2/+2
| | | | 8 bits is 1 byte, and that isn't about to change any time soon. (I hope!)
* Completely change the interface to setparameters():Greg Ward2003-05-291-79/+48
| | | | | | | | | | | | | | | | | | | * it no longer takes ssize, which served no purpose apart from scolding you if you got it wrong * changed the order of the three remaining required arguments to (format, channels, rate) to match the order in which they must be set * replaced the optional argument 'emulate' with 'strict': if strict true, and the audio device does not accept the requested sampling parameters, raise OSSAudioError * return a tuple (format, channels, rate) reflecting the sampling parameters that were actually set Change the canonical name of ossaudiodev.error to ossaudiodev.OSSAudioError (keep an alias for backwards compatibility). Remove 'audio_types' list and 'n_audio_types' (no longer needed now that setparameters() no longer has an 'ssize' argument to police).
* Oops, move the GIL release/reacquire from oss_sync() to _do_ioctl_0():Greg Ward2003-05-271-7/+11
| | | | | that way it applies to *only* the ioctl() call, and also happens for the other blocking ioctls (POST, RESET).
* Release the GIL in two more methods:Greg Ward2003-05-261-1/+8
| | | | | | | * sync(), because it waits for hardware buffers to flush, which can take several seconds depending on cirumstances (according to the OSS docs) * close(), because it does an implicit sync()
* Release the GIL around read(), write(), and select() calls.Greg Ward2003-05-231-2/+16
| | | | Bug spotted by Joerg Lehmann <joerg@luga.de>.
* Use fcntl() to put the audio device *back* into blocking mode afterGreg Ward2003-04-041-0/+9
| | | | | opening it in non-blocking mode. Both Guido and David Hammerton have reported that this fixes their problems with ossaudiodev -- hooray!
* Open with O_NONBLOCK to avoid hanging on open().Greg Ward2003-03-111-1/+5
|
* <sys/soundcard.h> seems to exist on both Linux and FreeBSD, so includeGreg Ward2003-03-101-22/+10
| | | | | | | | | it instead of the OS-specific <linux/soundcard.h> or <machine/soundcard.h>. Mixers devices have an ioctl-only interface, no read/write -- so the flags passed to open() don't really matter. Thus, drop the 'mode' parameter to openmixer() (ie. second arg to newossmixerobject()) and always open mixers with O_RDWR.
* Conditionalize another constantAndrew M. Kuchling2003-02-131-0/+2
|
* Get ossaudiodev to compile on freebsd 4.7Neal Norwitz2003-02-021-0/+18
|
* Get build working on Redhat 7.2 linux 2.4.7Neal Norwitz2003-01-101-0/+4
|
* Add build_namelists() to expose the OSS macros SOUND_DEVICE_LABELS andGreg Ward2002-12-311-0/+45
| | | | SOUND_DEVICE_NAMES as 'control_labels' and 'control_names'.
* Rename the parameter 'xp' in several methods to 'self', since that'sGreg Ward2002-12-311-23/+23
| | | | what it is.
* For symmetry with the mixer interface, rename oss_t to oss_audio_t andGreg Ward2002-12-311-29/+29
| | | | OSSType to OSSAudioType.
* Add a bunch of comments to clearly delineate sections of the code.Greg Ward2002-12-311-1/+28
|
* Yet another renaming of some mixer methods:Greg Ward2002-12-311-9/+9
| | | | | | | | | | | | | | | devices(), stereodevices(), recdevices() -> controls(), stereocontrols(), reccontrols() Based on recommendation of Hannu Savolainen <hannu@opensound.com>: The right term to use for things like bass/treble/mic/vol/etc is "control". "Device" refers to different mixer devices (/dev/mixer0 to /dev/mixerN). "Channel" cannot be used because it refers to mono/stereo/multich channels. In fact most mixer controls have left/right channels so ...
* Rename more mixer methods: getrecsrc() -> get_recsrc(),Greg Ward2002-12-301-6/+6
| | | | setrecsrc() -> set_recsrc().
* Untabify.Greg Ward2002-12-301-106/+106
|
* Whitespace fixes to conform to coding standards.Greg Ward2002-12-301-18/+18
|
* Comment fix.Greg Ward2002-12-301-9/+2
|
* Rename some mixer methods:Greg Ward2002-12-301-16/+16
| | | | | | | | | | | | | * channels() -> devices() * stereochannels() -> stereodevices() * recchannels() -> recdevices() * getvol() -> get() * setvol() -> set() This is for (slightly) more consistency with the OSS ioctl names (READ_DEVMASK, READ_RECMASK, READ_STEREODEVS). Also make sure the C function names correspond more closely to the Python method names for mixer methods.
* Remove 'x_' prefix from oss_t and oss_mixer_t struct members.Greg Ward2002-12-301-57/+58
| | | | | | (It added nothing, and served no obvious purpose.) Export SOUND_MIXER_NRDEVICES constant.
* Typo fix.Greg Ward2002-12-121-1/+1
|
* Add OSS mixer interface (from Nicholas FitzRoy-Dale <wzdd@lardcave.net>):Greg Ward2002-12-111-0/+267
| | | | | | | | | | | * add oss_mixer_t and OSSMixerType * add newossmixerobject(), oss_mixer_dealloc(), ossopenmixer() * add _do_ioctl_1_internal() to support mixer ioctls * add mixer methods: oss_mixer_{close,fileno,channels,stereo_channels, rec_channels,getvol,setvol,getrecsrc,setrecsrc}() * add oss_mixer_methods list * add oss_mixer_getattr() (why?!) * export SOUND_MIXER_* constants from soundcard.h
* Prepare for the coming mixer support patch: change _do_ioctl_0() andGreg Ward2002-12-111-14/+14
| | | | | _do_ioctl_1() so they take a file descriptor rather than an oss_t pointer.
* Finish expunging the 'linuxaudiodev' name:Greg Ward2002-12-111-55/+55
| | | | | | | * rename oss_t to lad_t, Ladtype to OSSType, * rename lad_*() methods to oss_*() * rename lad_methods list to oss_methods Patch and impetus supplied by Nicholas FitzRoy-Dale <wzdd@lardcave.net>.
* Expunge any remaining mentions of linuxaudiodev -- it's ossaudiodev now!Greg Ward2002-11-301-7/+7
|
* Rename LinuxAudioError to OSSAudioError ('ossaudiodev.error').Greg Ward2002-11-301-25/+25
| | | | | | Use OSSAudioError much less frequently -- all real I/O errors (ie. any time open(), read(), write(), ioctl(), or select() return an error) become IOError. OSSAudioError is only used now for bad open() mode.
* Added mode 'rw' for full-duplex (play and record at the same time) mode.Greg Ward2002-11-301-21/+97
| | | | | | | | | | | | Added _EXPORT_INT macro to export an integer constant to Python-space. Use it for all the AFMT_* constants, and update the list of AFMT_* constants to match what's in Linux 2.4: add AFMT_{QUERY,IMA_ADPCM, MPEG,AC3}. This should probably be tested with older versions of OSS, eg. with Linux 2.2 and 2.0. Export all SNDCTL_* ioctl numbers (where "all" is the set found in /usr/include/linux/soundcard.h on my Debian 3.0 system -- again Linux 2.4). Again needs to be tested with older OSS versions.
* * Don't put the device in non-blocking mode at open() time; this makesGreg Ward2002-11-301-46/+184
| | | | | | | | | | | | | | | | | | | | | 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.
* ossaudiodev -- Python interface to the OSS (Open Sound System) API.Greg Ward2002-11-301-0/+524
This module is a replacement for linuxaudiodev, which will eventually be deprecated. Initial revision is rev 2.20 of linuxaudiodev.c, with a rewritten header comment.