diff options
author | Guido van Rossum <guido@python.org> | 2002-09-17 20:36:40 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-09-17 20:36:40 (GMT) |
commit | 16aac45fc269ad355f069d5f76a0f4cafd06063f (patch) | |
tree | 1941156fe4df24b0c5a34d25174e3c1473c6e8d7 /Demo/sgi/cd | |
parent | d679e09970465d1b914b7d3dc11eaddbbcd6d289 (diff) | |
download | cpython-16aac45fc269ad355f069d5f76a0f4cafd06063f.zip cpython-16aac45fc269ad355f069d5f76a0f4cafd06063f.tar.gz cpython-16aac45fc269ad355f069d5f76a0f4cafd06063f.tar.bz2 |
Remove the SGI demos. These were all ancient and nobody cared enough.
Diffstat (limited to 'Demo/sgi/cd')
-rwxr-xr-x | Demo/sgi/cd/CD.doc | 46 | ||||
-rw-r--r-- | Demo/sgi/cd/README | 28 | ||||
-rwxr-xr-x | Demo/sgi/cd/cdaiff.py | 33 | ||||
-rwxr-xr-x | Demo/sgi/cd/listcd.py | 24 | ||||
-rwxr-xr-x | Demo/sgi/cd/playcd.py | 102 | ||||
-rwxr-xr-x | Demo/sgi/cd/recvcd.py | 36 | ||||
-rwxr-xr-x | Demo/sgi/cd/sendcd.py | 154 |
7 files changed, 0 insertions, 423 deletions
diff --git a/Demo/sgi/cd/CD.doc b/Demo/sgi/cd/CD.doc deleted file mode 100755 index 67f6a02..0000000 --- a/Demo/sgi/cd/CD.doc +++ /dev/null @@ -1,46 +0,0 @@ -Introduction. - -A number of programs have been written which access the Silicon -Graphics CD-ROM player. These programs all use the interface defined -in readcd.py (see readcd.doc for documentation). - -Specifying music stretches. - -The programs that are capable of reading music CD's all use the same -syntax to describe which part of the CD is to be read. The syntax -closely corresponds to the available methods in readcd.py. - -The music to be read is divided into stretches of music. Each stretch -must be specified as a separate argument on the command line. A -stretch can be a whole CD track, specified as a single number; or it -can be a start time and a end time. The start and end times must be -specified as a tuple, thus: ``(starttime, endtime)''. Don't forget to -quote the parenthesis to the shell. Both starttime and endtime can be -``None'', a simple number which refers to a CD track, or a tuple -consisting of either 3 or 4 elements. A starttime of ``None'' refers -to the start of the CD, an endtime of ``None'' refers to the end of -the CD. A tuple of 3 elements is an absolute time on the CD. The -three elements are (minutes, seconds, frames). A tuple of 4 elements -is a track-relative time. The four elements are (track, minutes, -seconds, frames). - -When one stretch ends at the end of a track and the following stretch -starts at the next track, there is the option of either playing or not -playing the pause between the two tracks. When either the end time of -the first stretch or the start time of the second stretch is specified -using absolute or track-relative times, the pause will not be played. -When both times are specified as simple track numbers, the pause will -be played. - -If no stretches are specified, the whole CD will be played. - -The programs. - -Currently, the following programs exist. -playcd [ stretch specification ] - Play (part of) a CD through the system loadspeaker or - headphone set. -cdaiff [ file [ stretch specification ] ] - Copy (part of) a CD to a file. The file will be written in - AIFF format. If no file is specified, cdaiff will write to - the file ``@'' in the current directory. diff --git a/Demo/sgi/cd/README b/Demo/sgi/cd/README deleted file mode 100644 index 016e4d1..0000000 --- a/Demo/sgi/cd/README +++ /dev/null @@ -1,28 +0,0 @@ -These are some programs to work with the SCSI CD-ROM player's audio -interface (see cdaudio(3) in IRIX 4.0 or higher; tested only on 4.0.2). - -See also the SGI-specific standard module 'readcd', documented as -"readcd.lib" in the library. - -cdwin.py A trivial window interface to play a CD over the CD - player's audio jack. More functionality is left as an - excersice to the reader. Needs module stdwin. - -listcd.py List the table-of-contents of a CD (data CDs will - appear as a single track). - -playcd.py Read audio data from the CD and play it over the - Indigo's built-in speker or audio jack. Needs module al. - -sendcd.py Read audio data from the CD and send it as UDP packets - over the network (to recvcd.py). - -recvcd.py Receive UDP packets containing CD audio data (from - sendcd.py) and play them over the Indigo's built-in - speaker or audio jack. Needs module al. (Doesn't - actually use module cd.) - -cdaiff.py Dump CD audio to disk in AIFF format. - -Note that to read *data* CD-ROMs you must open /dev/rdsk/dks0d4s7 or -some such special file... diff --git a/Demo/sgi/cd/cdaiff.py b/Demo/sgi/cd/cdaiff.py deleted file mode 100755 index a1b490f..0000000 --- a/Demo/sgi/cd/cdaiff.py +++ /dev/null @@ -1,33 +0,0 @@ -import sys -import readcd -import aifc -import AL -import cd - -Error = 'cdaiff.Error' - -def writeaudio(a, type, data): - a.writeframesraw(data) - -def main(): - if len(sys.argv) > 1: - a = aifc.open(sys.argv[1], 'w') - else: - a = aifc.open('@', 'w') - a.setsampwidth(AL.SAMPLE_16) - a.setnchannels(AL.STEREO) - a.setframerate(AL.RATE_44100) - r = readcd.Readcd() - for arg in sys.argv[2:]: - x = eval(arg) - try: - 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.play() - a.close() - -main() diff --git a/Demo/sgi/cd/listcd.py b/Demo/sgi/cd/listcd.py deleted file mode 100755 index 2cfadb6..0000000 --- a/Demo/sgi/cd/listcd.py +++ /dev/null @@ -1,24 +0,0 @@ -# List track info from CD player. - -import cd - -def main(): - c = cd.open() - info = [] - while 1: - try: - info.append(c.gettrackinfo(len(info) + 1)) - except RuntimeError: - break - for i in range(len(info)): - start, total = info[i] - print 'Track', zfill(i+1), triple(start), triple(total) - -def triple((a, b, c)): - return zfill(a) + ':' + zfill(b) + ':' + zfill(c) - -def zfill(n): - s = `n` - return '0' * (2 - len(s)) + s - -main() diff --git a/Demo/sgi/cd/playcd.py b/Demo/sgi/cd/playcd.py deleted file mode 100755 index 44fa5a0..0000000 --- a/Demo/sgi/cd/playcd.py +++ /dev/null @@ -1,102 +0,0 @@ -# Play CD audio on speaker or headphones. - -callbacktypes = ['audio','pnum','index','ptime','atime','catalog','ident','control'] - -def playaudio(port, type, audio): - port.writesamps(audio) - -def prtrack(cdinfo, type, pnum): - if cdinfo.track[pnum] <> '': - print 'playing "' + cdinfo.track[pnum] + '"' - else: - print callbacktypes[type]+': '+`pnum` - -def callback(arg, type, data): - print callbacktypes[type]+': '+`data` - -def tcallback(arg, type, data): - print callbacktypes[type]+': '+triple(data) - -def triple((a, b, c)): - return zfill(a) + ':' + zfill(b) + ':' + zfill(c) - -def zfill(n): - s = `n` - return '0' * (2 - len(s)) + s - -def prtrackinfo(info): - for i in range(len(info)): - start, total = info[i] - print 'Track', zfill(i+1), triple(start), triple(total) - -statedict = ['ERROR', 'NODISK', 'READY', 'PLAYING', 'PAUSED', 'STILL'] - -def prstatus(status): - state, track, curtime, abstime, totaltime, first, last, \ - scsi_audio, cur_block, dummy = status - print 'Status:', - if 0 <= state < len(statedict): - print statedict[state] - else: - print state - print 'Track: ', track - print 'Time: ', triple(curtime) - print 'Abs: ', triple(abstime) - print 'Total: ', triple(totaltime) - print 'First: ', first - print 'Last: ', last - print 'SCSI: ', scsi_audio - print 'Block: ', cur_block - print 'Future:', dummy - -def main(): - import sys, readcd, al, AL, cd, cdplayer - verbose = 0 - r = readcd.Readcd() - prstatus(r.getstatus()) - prtrackinfo(r.gettrackinfo()) - cdinfo = cdplayer.Cdplayer(r.gettrackinfo()) - if cdinfo.title <> '': - print 'Title: "' + cdinfo.title + '"' - if cdinfo.artist <> '': - print 'Artist: ' + cdinfo.artist - for arg in sys.argv[1:]: - if arg == '-v': - verbose = 1 - continue - x = eval(arg) - try: - l = len(x) - r.appendstretch(x[0], x[1]) - except TypeError: - r.appendtrack(x) - try: - oldparams = [AL.OUTPUT_RATE, 0] - params = oldparams[:] - al.getparams(AL.DEFAULT_DEVICE, oldparams) - params[1] = AL.RATE_44100 - al.setparams(AL.DEFAULT_DEVICE, params) - config = al.newconfig() - config.setwidth(AL.SAMPLE_16) - config.setchannels(AL.STEREO) - port = al.openport('CD Player', 'w', config) - - for i in range(8): - r.setcallback(i, callback, None) - if verbose: - r.setcallback(cd.ptime, tcallback, None) - r.setcallback(cd.atime, tcallback, None) - else: - r.removecallback(cd.ptime) - r.removecallback(cd.atime) - r.setcallback(cd.pnum, prtrack, cdinfo) - r.setcallback(cd.audio, playaudio, port) - - data = r.play() - except KeyboardInterrupt: - status = r.getstatus() - print 'Interrupted at '+triple(status[2])+' into track '+ \ - `status[1]`+' (absolute time '+triple(status[3])+')' - al.setparams(AL.DEFAULT_DEVICE, oldparams) - -main() diff --git a/Demo/sgi/cd/recvcd.py b/Demo/sgi/cd/recvcd.py deleted file mode 100755 index e7496d1..0000000 --- a/Demo/sgi/cd/recvcd.py +++ /dev/null @@ -1,36 +0,0 @@ -# Receive UDP packets from sendcd.py and play them on the speaker or -# audio jack. - -import al, AL -from socket import * -from cd import DATASIZE - -PORT = 50505 # Must match the port in sendcd.py - -def main(): - s = socket(AF_INET, SOCK_DGRAM) - s.bind('', PORT) - - oldparams = [AL.OUTPUT_RATE, 0] - params = oldparams[:] - al.getparams(AL.DEFAULT_DEVICE, oldparams) - params[1] = AL.RATE_44100 - try: - al.setparams(AL.DEFAULT_DEVICE, params) - config = al.newconfig() - config.setwidth(AL.SAMPLE_16) - config.setchannels(AL.STEREO) - port = al.openport('CD Player', 'w', config) - - while 1: - data = s.recv(DATASIZE) - if not data: - print 'EOF' - break - port.writesamps(data) - except KeyboardInterrupt: - pass - - al.setparams(AL.DEFAULT_DEVICE, oldparams) - -main() diff --git a/Demo/sgi/cd/sendcd.py b/Demo/sgi/cd/sendcd.py deleted file mode 100755 index a6cf8e7..0000000 --- a/Demo/sgi/cd/sendcd.py +++ /dev/null @@ -1,154 +0,0 @@ -# Read CD audio data from the SCSI CD player and send it as UDP -# packets to "recvcd.py" on another host. -# -# Usage: python sendcd.py [options] host [track | minutes seconds [frames]] -# -# Options: -# "-l" list track info and quit. -# "-s" display status and quit. -# -# Arguments: -# host host to send the audio data to (required unless -l or -s). -# track track number where to start; alternatively, -# min sec [frames] absolute address where to start; -# default is continue at current point according to status. - -import cd -import sys -from socket import * -import getopt - -PORT = 50505 # Must match the port in readcd.py - -def main(): - try: - optlist, args = getopt.getopt(sys.argv[1:], 'ls') - except getopt.error, msg: - sys.stderr.write(msg + '\n') - sys.exit(2) - - player = cd.open() - prstatus(player) - size = player.bestreadsize() - - if optlist: - for opt, arg in optlist: - if opt == '-l': - prtrackinfo(player) - elif opt == '-s': - prstatus(player) - return - - if not args: - sys.stderr.write('usage: ' + sys.argv[0] + ' host [track]\n') - sys.exit(2) - host, args = args[0], args[1:] - - sys.stdout.write('waiting for socket... ') - sys.stdout.flush() - port = socket(AF_INET, SOCK_DGRAM) - port.connect(host, PORT) - print 'socket connected' - - parser = cd.createparser() - parser.setcallback(cd.audio, audiocallback, port) - parser.setcallback(cd.pnum, pnumcallback, player) - parser.setcallback(cd.index, indexcallback, None) - ## cd.ptime: too many calls - ## cd.atime: too many calls - parser.setcallback(cd.catalog, catalogcallback, None) - parser.setcallback(cd.ident, identcallback, None) - parser.setcallback(cd.control, controlcallback, None) - - if len(args) >= 2: - if len(args) >= 3: - [min, sec, frame] = args[:3] - else: - [min, sec] = args - frame = '0' - min, sec, frame = eval(min), eval(sec), eval(frame) - print 'Seek to', triple(min, sec, frame) - dummy = player.seek(min, sec, frame) - elif len(args) == 1: - track = eval(args[0]) - print 'Seek to track', track - dummy = player.seektrack(track) - else: - min, sec, frame = player.getstatus()[3] - print 'Try to seek back to', triple(min, sec, frame) - try: - player.seek(min, sec, frame) - except RuntimeError: - print 'Seek failed' - - try: - while 1: - frames = player.readda(size) - if frames == '': - print 'END OF CD' - break - parser.parseframe(frames) - except KeyboardInterrupt: - print '[Interrupted]' - pass - -def prtrackinfo(player): - info = [] - while 1: - try: - info.append(player.gettrackinfo(len(info) + 1)) - except RuntimeError: - break - for i in range(len(info)): - start, total = info[i] - print 'Track', zfill(i+1), triple(start), triple(total) - -def audiocallback(port, type, data): -## sys.stdout.write('#') -## sys.stdout.flush() - port.send(data) - -def pnumcallback(player, type, data): - print 'pnum =', `data` - prstatus(player) - -def indexcallback(arg, type, data): - print 'index =', `data` - -def catalogcallback(arg, type, data): - print 'catalog =', `data` - -def identcallback(arg, type, data): - print 'ident =', `data` - -def controlcallback(arg, type, data): - print 'control =', `data` - -statedict = ['ERROR', 'NODISK', 'READY', 'PLAYING', 'PAUSED', 'STILL'] - -def prstatus(player): - state, track, curtime, abstime, totaltime, first, last, \ - scsi_audio, cur_block, dummy = player.getstatus() - print 'Status:', - if 0 <= state < len(statedict): - print statedict[state] - else: - print state - print 'Track: ', track - print 'Time: ', triple(curtime) - print 'Abs: ', triple(abstime) - print 'Total: ', triple(totaltime) - print 'First: ', first - print 'Last: ', last - print 'SCSI: ', scsi_audio - print 'Block: ', cur_block - print 'Future:', dummy - -def triple((a, b, c)): - return zfill(a) + ':' + zfill(b) + ':' + zfill(c) - -def zfill(n): - s = `n` - return '0' * (2 - len(s)) + s - -main() |