diff options
| author | yum <yum.food.vr@gmail.com> | 2023-08-25 08:21:56 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2023-08-25 12:08:07 -0700 |
| commit | 9e43487c1bf62402e96cb6139b24cd8446515673 (patch) | |
| tree | a61d751a96b79d7f9d0aefee42674b5bb9afd497 /Scripts/transcribe.py | |
| parent | 323eeba6118073547508b04950425c1a81650024 (diff) | |
Finish pyopenvr -> pyopenxr migration
pyopenvr is both deprecated and buggy, so switch to pyopenxr.
Diffstat (limited to 'Scripts/transcribe.py')
| -rw-r--r-- | Scripts/transcribe.py | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/Scripts/transcribe.py b/Scripts/transcribe.py index 8a10783..e9873e9 100644 --- a/Scripts/transcribe.py +++ b/Scripts/transcribe.py @@ -559,23 +559,12 @@ def readKeyboardInput(audio_state, enable_local_beep: bool, def readControllerInput(audio_state, enable_local_beep: bool, use_builtin: bool, button: str): - session = None - first = True - while session == None and audio_state.run_app == True: - try: - session = steamvr.SessionState() - except: - if audio_state.enable_debug_mode: - print("steamvr is off, no controller input") - session = None - time.sleep(5) - RECORD_STATE = 0 PAUSE_STATE = 1 state = PAUSE_STATE - hand_id = steamvr.hands[button.split()[0]] - button_id = steamvr.buttons[button.split()[1]] + hand_id = button.split()[0] + button_id = button.split()[1] # Rough description of state machine: # Single short press: toggle transcription @@ -585,11 +574,12 @@ def readControllerInput(audio_state, enable_local_beep: bool, last_rising = time.time() last_medium_press_end = 0 + + button_generator = steamvr.pollButtonPress(hand=hand_id, button=button_id) while audio_state.run_app == True: - time.sleep(0.05) + time.sleep(0.01) - event = steamvr.pollButtonPress(session, hand_id=hand_id, - button_id=button_id) + event = next(button_generator) if event == steamvr.EVENT_RISING_EDGE: last_rising = time.time() |
