commit 8aa3c64ed17e24d619a49e5003298899f4366879
parent 993ed9488bdce46c06b0f3bc39b0b3f1c7f58215
Author: rbckman <rob@tarina.org>
Date: Wed, 24 Mar 2021 11:03:22 +0000
flushing keyboard input
Diffstat:
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/tarina.py b/tarina.py
@@ -174,6 +174,12 @@ def main():
#--------------MAIN LOOP---------------#
while True:
pressed, buttonpressed, buttontime, holdbutton, event, keydelay = getbutton(pressed, buttonpressed, buttontime, holdbutton)
+ if buttonpressed == True:
+ buttonflush = True
+ else:
+ buttonflush = False
+ if buttonflush == True:
+ flushbutton()
#event = screen.getch()
if recording == False:
#SHUTDOWN
@@ -2275,7 +2281,8 @@ def playdub(filename, headphoneslevel, player_menu):
p+=1
if video == True:
player.play()
- run_command('aplay -D plughw:0 ' + filename + '.wav &')
+ #run_command('aplay -D plughw:0 ' + filename + '.wav &')
+ run_command('mplayer ' + filename + '.wav &')
if player_menu == 'dub':
run_command(tarinafolder + '/alsa-utils-1.1.3/aplay/arecord -D hw:0 -f S16_LE -c 1 -r44100 -vv /dev/shm/dub.wav &')
except:
@@ -2283,7 +2290,7 @@ def playdub(filename, headphoneslevel, player_menu):
#logger.warning(e)
return
starttime = time.time()
- selected = 0
+ selected = 1
while True:
if trim == True:
menu = 'CANCEL', 'FROM BEGINNING', 'FROM END'
@@ -2745,6 +2752,14 @@ def middlebutton():
return True
return False
+def flushbutton():
+ with term.cbreak():
+ while True:
+ inp = term.inkey(timeout=0)
+ print('flushing ' + repr(inp))
+ if inp == '':
+ break
+
def getbutton(lastbutton, buttonpressed, buttontime, holdbutton):
with term.cbreak():
val = term.inkey(timeout=0)