Richard Aplin <drt...@gmail.com> added the comment:

Hi there yes this is very much an issue on Arm linux (e.g. Armbian). Calling 
any function that triggers a call to _ssize(..) - a function which is clearly 
intended to have no side-effects - instead resets the number of channels (and 
sample format?) by calling IOCTLs "SNDCTL_DSP_SETFMT" and "SNDCTL_DSP_CHANNELS" 
with arguments of zero as a way to query the current values. 

This doesn't work on many drivers; e.g. they take '0' as meaning 'mono' and 
switch to one channel. 

To repro:
        import ossaudiodev
        self.dsp=ossaudiodev.open("/dev/dsp1","w")
        self.dsp.setfmt(ossaudiodev.AFMT_S16_LE)
        self.dsp.channels(2)  #<<Set to stereo
        self.dsp.speed(96000)
        ...
        self.bufSize=self.dsp.bufsize()
        ...

        #This will output audio in the wrong format (mono)! Remove the innocent 
looking "bufsize" test above and it will correctly output stereo
        self.dsp.write(someData)


Frustrating bug! ;-)

----------
nosy: +richaplin

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue1566331>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to