def handle_1(self): # queryparams dev = self.unpacker.unpack_int() self.turn_around() ## print 'queryparams:', dev params = al.queryparams(dev) ## print 'queryparams ->', params self.packer.pack_params(params)
def ioloop(s, otheraddr): # dev = AL.DEFAULT_DEVICE params = al.queryparams(dev) al.getparams(dev, params) time.sleep(1) saveparams = params[:] for i in range(0, len(params), 2): if params[i] in (AL.INPUT_RATE, AL.OUTPUT_RATE): params[i + 1] = AL.RATE_16000 elif params[i] == AL.INPUT_SOURCE: params[i + 1] = AL.INPUT_MIC try: al.setparams(dev, params) ioloop1(s, otheraddr) finally: al.setparams(dev, saveparams)
def ioloop(s, otheraddr): # dev = AL.DEFAULT_DEVICE params = al.queryparams(dev) al.getparams(dev, params) time.sleep(1) saveparams = params[:] for i in range(0, len(params), 2): if params[i] in (AL.INPUT_RATE, AL.OUTPUT_RATE): params[i+1] = AL.RATE_16000 elif params[i] == AL.INPUT_SOURCE: params[i+1] = AL.INPUT_MIC try: al.setparams(dev, params) ioloop1(s, otheraddr) finally: al.setparams(dev, saveparams)
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
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.millisleep(100) 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 '-->',
# intercom -- use mike and headset to *talk* to a person on another host.