blob: aa85752e20bec6e1c5d5b8d2a057b3656dcaa531 [file] [log] [blame]
Barry Warsaw5bc697d1997-01-07 21:05:29 +00001from test_support import verbose, TestFailed
2import sunaudiodev
3import os
4
Barry Warsawb241c421997-01-13 20:34:44 +00005def findfile(file):
6 if os.path.isabs(file): return file
7 import sys
8 for dn in sys.path:
9 fn = os.path.join(dn, file)
10 if os.path.exists(fn): return fn
11 return file
Barry Warsaw5bc697d1997-01-07 21:05:29 +000012
13def play_sound_file(path):
14 fp = open(path, 'r')
15 data = fp.read()
16 fp.close()
Barry Warsaw3de721d1997-01-13 20:53:46 +000017 try:
18 a = sunaudiodev.open('w')
19 except sunaudiodev.error, msg:
20 raise TestFailed, msg
21 else:
22 a.write(data)
23 a.close()
Barry Warsaw5bc697d1997-01-07 21:05:29 +000024
25def test():
Barry Warsawb241c421997-01-13 20:34:44 +000026 play_sound_file(findfile('audiotest.au'))
Barry Warsaw5bc697d1997-01-07 21:05:29 +000027
28test()