Exemplo n.º 1
0
while True:
    try:
        sleep(0.5)

        now = time.time()
        if record_started > 0:
            if (now - record_started) > recording_duration:
                stopPlayback()
                # play auflegen_wav
                # subprocess.call(["aplay", auflegen_wav], shell=False);
                sleep(0.5)
                stopRecord()
        else:
            if not mx.isMuxing:
                # start muxing
                mx.start()


    except KeyboardInterrupt:
        break
    except Exception,e:
        # pass any other exceptions
        print "exception in main loop: ", e
        pass

# cleanup
stopRecord()

GPIO.remove_event_detect(phonePinNum)
GPIO.remove_event_detect(buttonPinNum)
GPIO.cleanup()
Exemplo n.º 2
0
while True:
    try:
        sleep(0.5)

        now = time.time()
        if record_started > 0:
            if (now - record_started) > recording_duration:
                stopPlayback()
                # play auflegen_wav
                # subprocess.call(["aplay", auflegen_wav], shell=False);
                sleep(0.5)
                stopRecord()
        else:
            if not mx.isMuxing:
                # start muxing
                mx.start()

    except KeyboardInterrupt:
        break
    except Exception, e:
        # pass any other exceptions
        print "exception in main loop: ", e
        pass

# cleanup
stopRecord()

GPIO.remove_event_detect(phonePinNum)
GPIO.remove_event_detect(buttonPinNum)
GPIO.cleanup()