summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-06-03 16:49:44 (GMT)
committerGuido van Rossum <guido@python.org>1992-06-03 16:49:44 (GMT)
commitb1ccc6afe0947d6becbcb2c34f7a205f04fd34e9 (patch)
treea85f6c162a92b207f104acd776a3ac1f599b8dec
parent6c6b6094fc05348240d34db86cf3dec3f3d8a0a4 (diff)
downloadcpython-b1ccc6afe0947d6becbcb2c34f7a205f04fd34e9.zip
cpython-b1ccc6afe0947d6becbcb2c34f7a205f04fd34e9.tar.gz
cpython-b1ccc6afe0947d6becbcb2c34f7a205f04fd34e9.tar.bz2
Improvements by Sjoerd
-rwxr-xr-xDemo/sgi/cd/cdaiff.py29
1 files changed, 9 insertions, 20 deletions
diff --git a/Demo/sgi/cd/cdaiff.py b/Demo/sgi/cd/cdaiff.py
index b3b9bb0..79a9328 100755
--- a/Demo/sgi/cd/cdaiff.py
+++ b/Demo/sgi/cd/cdaiff.py
@@ -1,44 +1,33 @@
-# Dump CD audio on disk (in AIFF format; stereo, 16 bit samples, 44.1 kHz).
-#
-# Each argument is either a track to play or a quoted 7-tuple:
-# '(track, min1, sec1, frame1, min2, sec2, frame2)'
-# to play the track from min1:sec1:frame1 to min2:sec2:frame2.
-# If track is zero, times are absolute instead.
-
import sys
-import string
import readcd
import aiff
import AL
import CD
+Error = 'cdaiff.Error'
+
def writeaudio(a, type, data):
a.writesampsraw(data)
-def ptimecallback(a, type, (min, sec, frame)):
- if frame == 0:
- print 'T =', min, ':', sec
-
def main():
- a = aiff.Aiff().init(sys.argv[1], 'w')
+ if len(sys.argv) > 1:
+ a = aiff.Aiff().init(sys.argv[1], 'w')
+ else:
+ a = aiff.Aiff().init('@', 'w')
a.sampwidth = AL.SAMPLE_16
a.nchannels = AL.STEREO
a.samprate = AL.RATE_44100
r = readcd.Readcd().init()
- l = []
for arg in sys.argv[2:]:
x = eval(arg)
try:
- l = len(x)
+ if len(x) <> 2:
+ raise Error, 'bad argument'
r.appendstretch(x[0], x[1])
except TypeError:
r.appendtrack(x)
r.setcallback(CD.AUDIO, writeaudio, a)
- r.setcallback(CD.PTIME, ptimecallback, None)
- try:
- r.play()
- except KeyboardInterrupt:
- pass
+ r.play()
a.destroy()
main()