[Python-checkins] python/dist/src/Lib/test test_ossaudiodev.py,1.6,1.7

gward@users.sourceforge.net gward@users.sourceforge.net
Mon, 02 Jun 2003 17:32:46 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv4484

Modified Files:
	test_ossaudiodev.py 
Log Message:
Factor endian-ness check out of play_sound_file(), and fix
test_setparameters() to use it -- don't assume AFMT_S16_NE is always
defined!


Index: test_ossaudiodev.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ossaudiodev.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** test_ossaudiodev.py	29 May 2003 01:27:39 -0000	1.6
--- test_ossaudiodev.py	3 Jun 2003 00:32:44 -0000	1.7
***************
*** 14,17 ****
--- 14,28 ----
  import audioop
  
+ # Arggh, AFMT_S16_NE not defined on all platforms -- seems to be a
+ # fairly recent addition to OSS.
+ try:
+     from ossaudiodev import AFMT_S16_NE
+ except ImportError:
+     if sys.byteorder == "little":
+         AFMT_S16_NE = ossaudiodev.AFMT_S16_LE
+     else:
+         AFMT_S16_NE = ossaudiodev.AFMT_S16_BE
+ 
+ 
  SND_FORMAT_MULAW_8 = 1
  
***************
*** 39,48 ****
          raise TestFailed, msg
  
-     # set the data format
-     if sys.byteorder == 'little':
-         fmt = ossaudiodev.AFMT_S16_LE
-     else:
-         fmt = ossaudiodev.AFMT_S16_BE
- 
      # at least check that these methods can be invoked
      dsp.bufsize()
--- 50,53 ----
***************
*** 53,57 ****
  
      # set parameters based on .au file headers
!     dsp.setparameters(fmt, nchannels, rate)
      t1 = time.time()
      print "playing test sound file..."
--- 58,62 ----
  
      # set parameters based on .au file headers
!     dsp.setparameters(AFMT_S16_NE, nchannels, rate)
      t1 = time.time()
      print "playing test sound file..."