Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_ossaudiodev Namespace Reference

Classes

class  OSSAudioDevTests

Functions

def read_sound_file
def test_main

Variables

tuple ossaudiodev = support.import_module('ossaudiodev')
 AFMT_S16_NE = ossaudiodev.AFMT_S16_LE

Function Documentation

Definition at line 26 of file test_ossaudiodev.py.

00026 
00027 def read_sound_file(path):
00028     with open(path, 'rb') as fp:
00029         au = sunau.open(fp)
00030         rate = au.getframerate()
00031         nchannels = au.getnchannels()
00032         encoding = au._encoding
00033         fp.seek(0)
00034         data = fp.read()
00035 
00036     if encoding != sunau.AUDIO_FILE_ENCODING_MULAW_8:
00037         raise RuntimeError("Expect .au file with 8-bit mu-law samples")
00038 
00039     # Convert the data to 16-bit signed.
00040     data = audioop.ulaw2lin(data, 2)
00041     return (data, rate, 16, nchannels)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 174 of file test_ossaudiodev.py.

00174 
00175 def test_main():
00176     try:
00177         dsp = ossaudiodev.open('w')
00178     except (ossaudiodev.error, IOError) as msg:
00179         if msg.args[0] in (errno.EACCES, errno.ENOENT,
00180                            errno.ENODEV, errno.EBUSY):
00181             raise unittest.SkipTest(msg)
00182         raise
00183     dsp.close()
00184     support.run_unittest(__name__)


Variable Documentation

test.test_ossaudiodev.AFMT_S16_NE = ossaudiodev.AFMT_S16_LE

Definition at line 21 of file test_ossaudiodev.py.

Definition at line 6 of file test_ossaudiodev.py.