[Python-checkins] CVS: python/dist/src/Lib/test test_linuxaudiodev.py,1.5,1.6

Guido van Rossum python-dev@python.org
Sat, 7 Oct 2000 17:20:24 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv5835

Modified Files:
	test_linuxaudiodev.py 
Log Message:
It seems our sound cards can't play mulaw data.  Use native-format
16-bit signed data instead.  Hope this works for you; it works for me.


Index: test_linuxaudiodev.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_linuxaudiodev.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_linuxaudiodev.py	2000/10/06 19:39:55	1.5
--- test_linuxaudiodev.py	2000/10/08 00:20:20	1.6
***************
*** 5,11 ****
--- 5,13 ----
  import linuxaudiodev
  import os
+ import sys
  import select
  import sunaudio
  import time
+ import audioop
  
  SND_FORMAT_MULAW_8 = 1
***************
*** 28,31 ****
--- 30,42 ----
          raise TestFailed, msg
  
+     # convert the data to 16-bit signed
+     data = audioop.ulaw2lin(data, 2)
+ 
+     # set the data format
+     if sys.byteorder == 'little':
+         fmt = linuxaudiodev.AFMT_S16_LE
+     else:
+         fmt = linuxaudiodev.AFMT_S16_BE
+ 
      # at least check that these methods can be invoked
      a.bufsize()
***************
*** 36,40 ****
  
      # set parameters based on .au file headers
!     a.setparameters(rate, 8, nchannels, linuxaudiodev.AFMT_MU_LAW, 1)
      a.write(data)
      a.flush()
--- 47,51 ----
  
      # set parameters based on .au file headers
!     a.setparameters(rate, 16, nchannels, fmt)
      a.write(data)
      a.flush()