cpython/Demo/sgi/al/alwatch.py

34 lines
779 B
Python
Raw Normal View History

1991-09-15 18:05:15 -03:00
import time
1991-12-24 09:55:16 -04:00
import al, AL
import string
dev = AL.DEFAULT_DEVICE
source_name = ['line', 'microphone', 'digital']
params = al.queryparams(dev)
for i in range(1, len(params), 2):
params[i] = -1
1991-09-15 18:05:15 -03:00
while 1:
1994-10-07 07:23:49 -03:00
time.sleep(0.1)
1991-12-24 09:55:16 -04:00
old = params[:]
al.getparams(dev, params)
if params <> old:
for i in range(0, len(params), 2):
if params[i+1] <> old[i+1]:
1992-12-14 11:06:05 -04:00
name = al.getname(dev, params[i])
1992-03-30 09:30:03 -04:00
if params[i] == AL.INPUT_SOURCE:
1991-12-24 09:55:16 -04:00
if 0 <= old[i+1] < len(source_name):
oldval = source_name[old[i+1]]
else:
oldval = ''
newval = source_name[params[i+1]]
else:
oldval = `old[i+1]`
newval = `params[i+1]`
1992-12-14 11:06:05 -04:00
print string.ljust(name, 25),
1991-12-24 09:55:16 -04:00
print '(' + string.rjust(oldval, 10) + ')',
print '-->',
print string.rjust(newval, 10)
print