diff options
author | Guido van Rossum <guido@python.org> | 1995-08-09 02:33:38 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-08-09 02:33:38 (GMT) |
commit | 9d8fe6483d3dcb74b8b9250e6f01ce263111ac41 (patch) | |
tree | 7c87a6a53f62c508574829130ce26df4674648ab | |
parent | 6a0691aee4ae8209abec37512331137840f7dc10 (diff) | |
download | cpython-9d8fe6483d3dcb74b8b9250e6f01ce263111ac41.zip cpython-9d8fe6483d3dcb74b8b9250e6f01ce263111ac41.tar.gz cpython-9d8fe6483d3dcb74b8b9250e6f01ce263111ac41.tar.bz2 |
rather ugly temporary hacks to make it work in grail & restricted mode
-rw-r--r-- | Lib/audiodev.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Lib/audiodev.py b/Lib/audiodev.py index adfeb96..fcfae16 100644 --- a/Lib/audiodev.py +++ b/Lib/audiodev.py @@ -2,7 +2,7 @@ error = 'audiodev.error' class Play_Audio_sgi: # Private instance variables - access frameratelist, nchannelslist, sampwidthlist, oldparams, \ + if 0: access frameratelist, nchannelslist, sampwidthlist, oldparams, \ params, config, inited_outrate, inited_width, \ inited_nchannels, port, converter, classinited: private @@ -11,7 +11,7 @@ class Play_Audio_sgi: def initclass(self): import AL - Play_Audio_sgi.frameratelist = [ + self.frameratelist = [ (48000, AL.RATE_48000), (44100, AL.RATE_44100), (32000, AL.RATE_32000), @@ -20,16 +20,16 @@ class Play_Audio_sgi: (11025, AL.RATE_11025), ( 8000, AL.RATE_8000), ] - Play_Audio_sgi.nchannelslist = [ + self.nchannelslist = [ (1, AL.MONO), (2, AL.STEREO), ] - Play_Audio_sgi.sampwidthlist = [ + self.sampwidthlist = [ (1, AL.SAMPLE_8), (2, AL.SAMPLE_16), (3, AL.SAMPLE_24), ] - Play_Audio_sgi.classinited = 1 + self.classinited = 1 def __init__(self): import al, AL @@ -129,14 +129,14 @@ class Play_Audio_sgi: return self.config.getqueuesize() # private methods - access *: private + if 0: access *: private def ulaw2lin(self, data): import audioop return audioop.ulaw2lin(data, 2) class Play_Audio_sun: - access outrate, sampwidth, nchannels, inited_outrate, inited_width, \ + if 0: access outrate, sampwidth, nchannels, inited_outrate, inited_width, \ inited_nchannels, converter: private def __init__(self): @@ -176,11 +176,12 @@ class Play_Audio_sun: info.o_channels = self.nchannels if self.sampwidth == 0: info.o_precision = 8 - self.o_encoding = ENCODING_ULAW + self.o_encoding = SUNAUDIODEV.ENCODING_ULAW + # XXX Hack, hack -- leave defaults else: info.o_precision = 8 * self.sampwidth info.o_encoding = SUNAUDIODEV.ENCODING_LINEAR - self.port.setinfo(info) + self.port.setinfo(info) if self.converter: data = self.converter(data) self.port.write(data) @@ -209,7 +210,6 @@ class Play_Audio_sun: def AudioDev(): try: import al - return Play_Audio_sgi() except ImportError: try: import sunaudiodev @@ -217,9 +217,12 @@ def AudioDev(): except ImportError: try: import Audio_mac - return Audio_mac.Play_Audio_mac() except ImportError: raise error, 'no audio device' + else: + return Audio_mac.Play_Audio_mac() + else: + return Play_Audio_sgi() def test(fn = 'f:just samples:just.aif'): import aifc |