diff options
author | Guido van Rossum <guido@python.org> | 1994-09-16 10:55:53 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-09-16 10:55:53 (GMT) |
commit | e174c1500f9a9560a7c162eb3b15517c51c1582a (patch) | |
tree | 8669bec1a1f9bc3fe47a1fd08dac3b492c84541e /Lib/audiodev.py | |
parent | 2d16703d654e773b09fd73e66ef663a2d5256768 (diff) | |
download | cpython-e174c1500f9a9560a7c162eb3b15517c51c1582a.zip cpython-e174c1500f9a9560a7c162eb3b15517c51c1582a.tar.gz cpython-e174c1500f9a9560a7c162eb3b15517c51c1582a.tar.bz2 |
audiodev.py: Mac port.
Audio_mac.py: Mac specific class for audiodev.py.
aifc.py: open files for reading/writing in binary mode ('rb', 'wb').
Diffstat (limited to 'Lib/audiodev.py')
-rw-r--r-- | Lib/audiodev.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/Lib/audiodev.py b/Lib/audiodev.py index 02d63f7..adfeb96 100644 --- a/Lib/audiodev.py +++ b/Lib/audiodev.py @@ -215,4 +215,27 @@ def AudioDev(): import sunaudiodev return Play_Audio_sun() except ImportError: - raise error, 'no audio device' + try: + import Audio_mac + return Audio_mac.Play_Audio_mac() + except ImportError: + raise error, 'no audio device' + +def test(fn = 'f:just samples:just.aif'): + import aifc + af = aifc.open(fn, 'r') + print fn, af.getparams() + p = AudioDev() + p.setoutrate(af.getframerate()) + p.setsampwidth(af.getsampwidth()) + p.setnchannels(af.getnchannels()) + BUFSIZ = af.getframerate()/af.getsampwidth()/af.getnchannels() + while 1: + data = af.readframes(BUFSIZ) + if not data: break + print len(data) + p.writeframes(data) + p.wait() + +if __name__ == '__main__': + test() |