Ejemplo n.º 1
0
def samp(n):
       savegain = audio.getoutgain()
       try:
               audio.setoutgain(0)
               x = raw_input('Hit Enter to sample ' + `n` + ' seconds: ')
               return audio.read(n*RATE)
       finally:
               audio.setoutgain(savegain)
Ejemplo n.º 2
0
def main():
	G.synchronous = 0	# If set, use synchronous audio.write()
	G.debug = 0		# If set, print debug messages
	G.gain = 75		# Output gain
	G.rate = 3		# Sampling rate
	G.busy = 0		# Set while asynchronous playing is active
	G.windows = []		# List of open windows (except control)
	G.mode = 'mac'		# Macintosh mode
	G.tempprefix = '/usr/tmp/@j' + `rand.rand()` + '-'
	#
	optlist, args = getopt.getopt(sys.argv[1:], 'dg:r:sSa')
	for optname, optarg in optlist:
		if   optname == '-d':
			G.debug = 1
		elif optname == '-g':
			G.gain = string.atoi(optarg)
			if not (0 < G.gain < 256):
				raise optarg.error, '-g gain out of range'
		elif optname == '-r':
			G.rate = string.atoi(optarg)
			if not (1 <= G.rate <= 3):
				raise optarg.error, '-r rate out of range'
		elif optname == '-s':
			G.synchronous = 1
		elif optname == '-S':
			G.mode = 'sgi'
		elif optname == '-a':
			G.mode = 'sun'
	#
	if not args:
		args = [DEF_DB]
	#
	G.cw = opencontrolwindow()
	for dirname in args:
		G.windows.append(openlistwindow(dirname))
	#
	#
	savegain = audio.getoutgain()
	try:
		# Initialize stdaudio
		audio.setoutgain(0)
		audio.start_playing('')
		dummy = audio.wait_playing()
		audio.setoutgain(0)
		maineventloop()
	finally:
		audio.setoutgain(savegain)
		audio.done()
		clearcache()
Ejemplo n.º 3
0
		elif optname = '-s':
			G.synchronous = 1
		elif optname = '-S':
			G.mode = 'sgi'
		elif optname = '-a':
			G.mode = 'sun'
	#
	if not args:
		args = [DEF_DB]
	#
	G.cw = opencontrolwindow()
	for dirname in args:
		G.windows.append(openlistwindow(dirname))
	#
	#
	savegain = audio.getoutgain()
	try:
		# Initialize stdaudio
		audio.setoutgain(0)
		audio.start_playing('')
		dummy = audio.wait_playing()
		audio.setoutgain(0)
		maineventloop()
	finally:
		audio.setoutgain(savegain)
		audio.done()
		clearcache()

def maineventloop():
	mouse_events = WE_MOUSE_DOWN, WE_MOUSE_MOVE, WE_MOUSE_UP
	while G.windows:
Ejemplo n.º 4
0
               elif optname = '-s':
                       G.synchronous = 1
               elif optname = '-S':
                       G.mode = 'sgi'
               elif optname = '-a':
                       G.mode = 'sun'
       #
       if not args:
               args = [DEF_DB]
       #
       G.cw = opencontrolwindow()
       for dirname in args:
               G.windows.append(openlistwindow(dirname))
       #
       #
       savegain = audio.getoutgain()
       try:
               # Initialize stdaudio
               audio.setoutgain(0)
               audio.start_playing('')
               dummy = audio.wait_playing()
               audio.setoutgain(0)
               maineventloop()
       finally:
               audio.setoutgain(savegain)
               audio.done()
               clearcache()

def maineventloop():
       mouse_events = WE_MOUSE_DOWN, WE_MOUSE_MOVE, WE_MOUSE_UP
       while G.windows: