[C++-sig] ossaudiodev behaves weird on Linux

Dmitry Borisov bors_1 at hotmail.com
Fri Nov 14 08:46:38 CET 2003


Hi,
I've got Python 2.3.2 installed on my Linux Red Hat 8( 2.4.18-2 ) and tried to use ossaudiodev module.
The following code works fine.

import ossaudiodev
snd= ossaudiodev.open( 'w' )
f= open( 'test.pcm', 'rb' )
s= f.read( 400000 )
snd.setparameters( 0x10, 2, 44100 )
snd.write( s )

Then I relaunch Python and try this one.

import ossaudiodev
snd= ossaudiodev.open( 'w' )
f= open( 'test.pcm', 'rb' )
s= f.read( 400000 )
snd.setparameters( 0x10, 2, 44100 )
snd.writeall( s )

Nope. It stucks on writeall(). Interestingly it stucks on select inside that function.
After patching writeall in source like this:

    /* use select to wait for audio device to be available */
    FD_ZERO(&write_set_fds);
    FD_SET(self->fd, &write_set_fds);

    // BEGIN CHANGE 
    write(self->fd, "", 0);
    // END CHANGE 

    while (size > 0) {
        Py_BEGIN_ALLOW_THREADS
        select_rv = select(self->fd+1, NULL, &write_set_fds, NULL, NULL);

Everything works fine after all.
I have Via EPIA- 500, all default sound drivers from Red Hat 8, including oss.
If the group is wrong, please direct as needed.

Regards,
Dmitry/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20031113/a93f264c/attachment.htm>


More information about the Cplusplus-sig mailing list