diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-07-18 19:30:22 +0000 |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-07-18 19:30:22 +0000 |
commit | 1e8fba729e218bc4b2e1ed3104f8cdbd88fdb21a (patch) | |
tree | d32c0ecfc04547cc703f981e60b106b28e8059bb /Lib/test/test_ossaudiodev.py | |
parent | 56af5fcab7e2ad370a1ac8985769108d281b8658 (diff) | |
download | cpython-git-1e8fba729e218bc4b2e1ed3104f8cdbd88fdb21a.tar.gz |
Deprecate the sunaudio module for removal in Python 3.0. The sunau module can provide similar functionality.
Diffstat (limited to 'Lib/test/test_ossaudiodev.py')
-rw-r--r-- | Lib/test/test_ossaudiodev.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Lib/test/test_ossaudiodev.py b/Lib/test/test_ossaudiodev.py index f2ce67bad7..eb4dd02890 100644 --- a/Lib/test/test_ossaudiodev.py +++ b/Lib/test/test_ossaudiodev.py @@ -6,7 +6,7 @@ from test.test_support import findfile, TestSkipped import errno import ossaudiodev import sys -import sunaudio +import sunau import time import audioop import unittest @@ -22,15 +22,16 @@ except ImportError: AFMT_S16_NE = ossaudiodev.AFMT_S16_BE -SND_FORMAT_MULAW_8 = 1 - def read_sound_file(path): - fp = open(path, 'rb') - size, enc, rate, nchannels, extra = sunaudio.gethdr(fp) - data = fp.read() - fp.close() - - if enc != SND_FORMAT_MULAW_8: + with open(path, 'rb') as fp: + au = sunau.open(fp) + rate = au.getframerate() + nchannels = au.getnchannels() + encoding = au._encoding + fp.seek(0) + data = fp.read() + + if encoding != sunau.AUDIO_FILE_ENCODING_MULAW_8: raise RuntimeError("Expect .au file with 8-bit mu-law samples") # Convert the data to 16-bit signed. |