diff options
Diffstat (limited to 'Demo/sgi/al/alwatch.py')
-rwxr-xr-x | Demo/sgi/al/alwatch.py | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/Demo/sgi/al/alwatch.py b/Demo/sgi/al/alwatch.py index 5af0935..2b8acdd 100755 --- a/Demo/sgi/al/alwatch.py +++ b/Demo/sgi/al/alwatch.py @@ -1,19 +1,40 @@ import time -import al -dev = 1 -name = ['input source', 'left input atten', 'right input atten', \ +import al, AL +import string + +dev = AL.DEFAULT_DEVICE + +parameter_name = [ \ + 'input source', 'left input atten', 'right input atten', \ 'input rate', 'output rate', \ 'left speaker gain', 'right speaker gain', \ 'input count', 'output count', 'unused count', \ 'sync input to aes', 'sync output to aes', \ ] -x = al.queryparams(dev) -al.getparams(dev, x) +source_name = ['line', 'microphone', 'digital'] + +params = al.queryparams(dev) +for i in range(1, len(params), 2): + params[i] = -1 while 1: time.millisleep(100) - y = x[:] - al.getparams(dev, x) - if x <> y: - for i in range(0, len(x), 2): - if x[i+1] <> y[i+1]: - print name[x[i]], ':', y[i+1], '-->', x[i+1] + old = params[:] + al.getparams(dev, params) + if params <> old: + for i in range(0, len(params), 2): + if params[i+1] <> old[i+1]: + name = parameter_name[params[i]] + if params[i] = AL.INPUT_SOURCE: + 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]` + print string.ljust(name, 20), + print '(' + string.rjust(oldval, 10) + ')', + print '-->', + print string.rjust(newval, 10) + print |