示例#1
0
文件: battery.py 项目: rajcze/battery
            cui.show_bank(bank_desc, bank_nr)
            continue

        elif event == ord('r'): # start/stop recording new loop
            if LOOP_recording is False: #start new loop
                current_loop = LoopThread()
                current_loop.daemon = True
                LOOPS.append(current_loop)
            else:
                try:
                    dummy = current_loop.loop[-1]
                except IndexError:
                    del(LOOPS[-1])
                    LOOP_recording = not LOOP_recording
                    current_loop = None
                    cui.tray_msg("Recording: %s" % LOOP_recording)
                    continue

                # set the wait "before first sample" to time between last "sound" and "end recording"
                current_loop.loop[0][0] = t - t_prev

                current_loop.loop = itertools.cycle(current_loop.loop)
                current_loop.start()
            LOOP_recording = not LOOP_recording
            cui.tray_msg("Recording: %s" % LOOP_recording)

        elif event == ord('p'): # stop & delete last loop
            try:
                LOOPS[-1].stop()
                del(LOOPS[-1])
            except IndexError:
示例#2
0
            cui.show_bank(bank_desc, bank_nr)
            continue

        elif event == ord('r'): # start/stop recording new loop
            if loop_recording is False: #start new loop
                current_loop = LoopThread()
                current_loop.daemon = True
                loops.append(current_loop)
            else:
                try:
                    dummy = current_loop.loop[-1]
                except IndexError:
                    del(loops[-1])
                    loop_recording = not loop_recording
                    current_loop = None
                    cui.tray_msg('recording: %s' % ('on' if loop_recording else 'off'), style=curses.A_BOLD)
                    continue

                # set the wait "before first sample" to time between last "sound" and "end recording"
                current_loop.loop[0][0] = t - t_prev

                current_loop.loop = itertools.cycle(current_loop.loop)
                current_loop.start()
            loop_recording = not loop_recording
            cui.tray_msg('recording: %s' % ('on' if loop_recording else 'off'), style=curses.A_BOLD)

        elif event == ord('p'): # stop & delete last loop
            try:
                loops[-1].stop()
                del(loops[-1])
                cui.tray_msg('last loop stopped & deleted', style=curses.A_BOLD)
示例#3
0
文件: battery.py 项目: rajcze/battery
            cui.show_bank(bank_desc, bank_nr)
            continue

        elif event == ord("r"):  # start/stop recording new loop
            if LOOP_recording is False:  # start new loop
                current_loop = LoopThread()
                current_loop.daemon = True
                LOOPS.append(current_loop)
            else:
                try:
                    dummy = current_loop.loop[-1]
                except IndexError:
                    del (LOOPS[-1])
                    LOOP_recording = not LOOP_recording
                    current_loop = None
                    cui.tray_msg("Recording: %s" % LOOP_recording)
                    continue

                # set the wait "before first sample" to time between last "sound" and "end recording"
                current_loop.loop[0][0] = t - t_prev

                current_loop.loop = itertools.cycle(current_loop.loop)
                current_loop.start()
            LOOP_recording = not LOOP_recording
            cui.tray_msg("Recording: %s" % LOOP_recording)

        elif event == ord("p"):  # stop & delete last loop
            try:
                LOOPS[-1].stop()
                del (LOOPS[-1])
            except IndexError: