forked from electrocoder/python-kod-bankasi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalwatch.py
41 lines (38 loc) · 978 Bytes
/
alwatch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8-*-
# Projenin Adi : alwatch
# Tarih : 05-02-2011
# Yazar : pythontr.org ekibi
# Kontak : [email protected]
# Web : http://www.pythontr.org
# Python Versiyonu : 2.x-3.x
# Amaci :
import time
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
while 1:
time.sleep(0.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 = al.getname(dev, 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, 25),
print '(' + string.rjust(oldval, 10) + ')',
print '-->',
print string.rjust(newval, 10)
print