Commit Graph

46 Commits

Author SHA1 Message Date
Gregory P. Smith dd96db63f6 This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html

Python 2.6 should stick with PyString_* in its codebase.  The PyBytes_* names
in the spirit of 3.0 are available via a #define only.  See the email thread.
2008-06-09 04:58:54 +00:00
Christian Heimes 593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Martin v. Löwis 6819210b9e PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
2007-07-21 06:55:02 +00:00
Armin Rigo 0d2f498a4c Compilation problem caused by conflicting typedefs for uint32_t
(unsigned long vs. unsigned int).
2006-10-04 10:23:57 +00:00
Georg Brandl 96a8c3954c Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
2006-05-29 21:04:52 +00:00
Georg Brandl 5c170fd4a9 Fix some missing checks after PyTuple_New, PyList_New, PyDict_New 2006-03-17 19:03:25 +00:00
Thomas Wouters 3ffa59b137 Rework channelnumber/samplesize detetion code's output variables a bit to
convince gcc (4.0.x) the variables are never used uninitialized (and raising
a proper exception if they ever are.)
2006-03-01 22:45:36 +00:00
Neal Norwitz 1ac754fa10 Check return result from Py_InitModule*(). This API can fail.
Probably should be backported.
2006-01-19 06:09:39 +00:00
Neal Norwitz 3f0464839b Fix icc warnings: extra semi-colon 2006-01-07 21:19:49 +00:00
Greg Ward 0f26054736 Conditionally export a few more AFMT_* macros: AFMT_U16_NE, AFMT_S32_LE,
AFMT_S32_BE, AFMT_MPEG.
2005-03-28 02:40:46 +00:00
Greg Ward 50682d0f78 SF #818006: merge from release24-maint branch: add useful read-only
attributes to oss_audio_device object: 'closed', 'name', and 'mode'.
2005-03-07 01:41:11 +00:00
Greg Ward fd0283eaa0 SF #832236: merge from release23-maint branch: wrap a bunch of
_EXPORT_INT calls in #ifdef's, to avoid breaking the build on MkLinux
(Linux 2.0).
2004-05-11 01:34:55 +00:00
Guido van Rossum 0741f801ba Whitespace normalization; break a long line. 2003-06-02 14:15:34 +00:00
Guido van Rossum f39dafb10a Fix a subtle decref bug that caused a GC assertion to fail in a debug
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.
2003-06-02 14:11:45 +00:00
Greg Ward 84f8ecd072 Comment fix. 2003-05-29 23:44:44 +00:00
Greg Ward 38c9266f42 Change _ssize() so it doesn't rely on sizeof(char) or sizeof(short):
8 bits is 1 byte, and that isn't about to change any time soon.  (I hope!)
2003-05-29 21:55:41 +00:00
Greg Ward d676906ab7 Completely change the interface to setparameters():
* 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).
2003-05-29 21:53:06 +00:00
Greg Ward d0d592fd32 Oops, move the GIL release/reacquire from oss_sync() to _do_ioctl_0():
that way it applies to *only* the ioctl() call, and also happens for the
other blocking ioctls (POST, RESET).
2003-05-27 01:57:21 +00:00
Greg Ward b804390ae3 Release the GIL in two more methods:
* 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()
2003-05-26 22:47:30 +00:00
Greg Ward 6492785ee5 Release the GIL around read(), write(), and select() calls.
Bug spotted by Joerg Lehmann <joerg@luga.de>.
2003-05-23 01:50:37 +00:00
Greg Ward 76ffb1918d Use fcntl() to put the audio device *back* into blocking mode after
opening it in non-blocking mode.  Both Guido and David Hammerton have
reported that this fixes their problems with ossaudiodev -- hooray!
2003-04-04 01:47:42 +00:00
Greg Ward 5c49ef2116 Open with O_NONBLOCK to avoid hanging on open(). 2003-03-11 16:53:13 +00:00
Greg Ward 0b6dfb808c <sys/soundcard.h> seems to exist on both Linux and FreeBSD, so include
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.
2003-03-10 03:17:06 +00:00
Andrew M. Kuchling fe62bc917d Conditionalize another constant 2003-02-13 13:27:07 +00:00
Neal Norwitz d156c2d782 Get ossaudiodev to compile on freebsd 4.7 2003-02-02 17:59:06 +00:00
Neal Norwitz faa7b9bb4c Get build working on Redhat 7.2 linux 2.4.7 2003-01-10 21:27:54 +00:00
Greg Ward 744f0fd655 Add build_namelists() to expose the OSS macros SOUND_DEVICE_LABELS and
SOUND_DEVICE_NAMES as 'control_labels' and 'control_names'.
2002-12-31 03:23:59 +00:00
Greg Ward 58ae13c1b2 Rename the parameter 'xp' in several methods to 'self', since that's
what it is.
2002-12-31 03:07:21 +00:00
Greg Ward 499b73e1cd For symmetry with the mixer interface, rename oss_t to oss_audio_t and
OSSType to OSSAudioType.
2002-12-31 03:04:52 +00:00
Greg Ward da1cacb38b Add a bunch of comments to clearly delineate sections of the code. 2002-12-31 03:02:23 +00:00
Greg Ward 2d6f9a9a86 Yet another renaming of some mixer methods:
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 ...
2002-12-31 02:54:43 +00:00
Greg Ward f05aa10eae Rename more mixer methods: getrecsrc() -> get_recsrc(),
setrecsrc() -> set_recsrc().
2002-12-30 23:19:32 +00:00
Greg Ward ad4d9b9749 Untabify. 2002-12-30 03:02:22 +00:00
Greg Ward e70376646e Whitespace fixes to conform to coding standards. 2002-12-30 03:01:48 +00:00
Greg Ward 5c5c577c08 Comment fix. 2002-12-30 02:58:04 +00:00
Greg Ward 37897c2672 Rename some mixer methods:
* 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.
2002-12-30 02:43:36 +00:00
Greg Ward 7b43c68162 Remove 'x_' prefix from oss_t and oss_mixer_t struct members.
(It added nothing, and served no obvious purpose.)

Export SOUND_MIXER_NRDEVICES constant.
2002-12-30 02:29:28 +00:00
Greg Ward b69bb3d019 Typo fix. 2002-12-12 17:35:45 +00:00
Greg Ward 3d9994d3b0 Add OSS mixer interface (from Nicholas FitzRoy-Dale <wzdd@lardcave.net>):
* 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
2002-12-11 15:12:01 +00:00
Greg Ward da9f853b49 Prepare for the coming mixer support patch: change _do_ioctl_0() and
_do_ioctl_1() so they take a file descriptor rather than an oss_t
pointer.
2002-12-11 14:49:59 +00:00
Greg Ward 8c6b6a9f1e Finish expunging the 'linuxaudiodev' name:
* 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>.
2002-12-11 14:43:13 +00:00
Greg Ward 9a568eb245 Expunge any remaining mentions of linuxaudiodev -- it's ossaudiodev now! 2002-11-30 23:20:09 +00:00
Greg Ward 97708bc6f8 Rename LinuxAudioError to OSSAudioError ('ossaudiodev.error').
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.
2002-11-30 23:17:10 +00:00
Greg Ward 1e0f57d0bb Added mode 'rw' for full-duplex (play and record at the same time) mode.
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.
2002-11-30 23:05:26 +00:00
Greg Ward 131bce035a * 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.
2002-11-30 22:56:44 +00:00
Greg Ward 04613a9308 ossaudiodev -- Python interface to the OSS (Open Sound System) API.
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.
2002-11-30 22:47:45 +00:00