[Python-Dev] Change to ossaudiodev setparameters() method

Guido van Rossum guido@python.org
Thu, 29 May 2003 10:50:06 -0400


> [me, on ossaudiodev.setparameters()]
> > In addition to being silly, this is not the documented interface.  The
> > docs don't mention the 'sample_size' argument at all.  Presumably the
> > doc writer realized the silliness and was going to pester me to remove
> > 'sample_size', but never got around to it.  (Lot of that going around.)
> > 
> > So, even though we're in a beta cycle, am I allowed to change the code
> > so it's 1) sensible and 2) consistent with the documentation?
> 
> [Guido]
> > Yes.  I like silliness in a MP skit, but not in my APIs. :-)
> 
> OK, done.  I've also beefed up the test script a bit.  So, once again,
> if you have a Linux or FreeBSD system with working sound card, can you
> run
> 
>   ./python Lib/test/regrtest.py -uaudio test_ossaudiodev
> 
> ...preferably before and after a "cvs up && make" to see if things are
> better, worse, or unchanged?

Did you check in the changes to ossaudiodev?

A cvs update gave me new test files:

    P Lib/test/test_ossaudiodev.py
    P Lib/test/output/test_ossaudiodev

but no new C code, and now I get this error when I run the above test:

    $ ./python ../Lib/test/regrtest.py -uaudio test_ossaudiodev
    test_ossaudiodev
    test test_ossaudiodev crashed -- exceptions.TypeError: setparameters() takes at least 4 arguments (3 given)
    1 test failed:
	test_ossaudiodev
    $

Before the cvs update, the test produced some audio and then hung;
when I interrupted, here's the traceback:

    Traceback (most recent call last):
      File "../Lib/test/regrtest.py", line 974, in ?
	main()
      File "../Lib/test/regrtest.py", line 264, in main
	ok = runtest(test, generate, verbose, quiet, testdir)
      File "../Lib/test/regrtest.py", line 394, in runtest
	the_package = __import__(abstest, globals(), locals(), [])
      File "/mnt/home/guido/projects/trunk/Lib/test/test_ossaudiodev.py", line 96, in ?
	test()
      File "/mnt/home/guido/projects/trunk/Lib/test/test_ossaudiodev.py", line 93, in test
	play_sound_file(data, rate, ssize, nchannels)
      File "/mnt/home/guido/projects/trunk/Lib/test/test_ossaudiodev.py", line 56, in play_sound_file
	a.write(data)

--Guido van Rossum (home page: http://www.python.org/~guido/)