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()
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: type, w, detail = event = stdwin.getevent() if w = G.cw.win: if type = WE_CLOSE: return G.cw.dispatch(event)
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: type, w, detail = event = stdwin.getevent() if w = G.cw.win: if type = WE_CLOSE: return G.cw.dispatch(event)