From 52ca7435f788e9bf981c7786046d5ca093e9688d Mon Sep 17 00:00:00 2001 From: yum Date: Fri, 11 Aug 2023 11:03:01 -0700 Subject: Deprecate old parameters Deprecate the visual and auditory speech indicators, saving 4 bits across the board. Fixed overhead is now 21 bits. --- Scripts/generate_params.py | 14 -------------- Scripts/generate_utils.py | 9 --------- Scripts/libtastt.py | 32 -------------------------------- Scripts/osc_ctrl.py | 17 ----------------- Scripts/transcribe.py | 10 ---------- 5 files changed, 82 deletions(-) diff --git a/Scripts/generate_params.py b/Scripts/generate_params.py index 317a4d5..b88a698 100644 --- a/Scripts/generate_params.py +++ b/Scripts/generate_params.py @@ -58,12 +58,6 @@ def generate(): params["PARAM_NAME"] = generate_utils.getEnableParam() result += generate_utils.replaceMacros(BOOL_PARAM, params) - params["PARAM_NAME"] = generate_utils.getIndicator0Param() - result += generate_utils.replaceMacros(BOOL_PARAM, params) - - params["PARAM_NAME"] = generate_utils.getIndicator1Param() - result += generate_utils.replaceMacros(BOOL_PARAM, params) - params["PARAM_NAME"] = generate_utils.getScaleParam() params["DEFAULT_FLOAT"] = "0.05" result += generate_utils.replaceMacros(FLOAT_PARAM, params) @@ -72,14 +66,6 @@ def generate(): params["PARAM_NAME"] = generate_utils.getToggleParam() result += generate_utils.replaceMacros(BOOL_PARAM, params) - params["PARAM_NAME"] = generate_utils.getSpeechNoiseToggleParam() - result += generate_utils.replaceMacros(BOOL_PARAM, params) - - params["PARAM_NAME"] = generate_utils.getSpeechNoiseEnableParam() - params["SAVED"] = "1" - result += generate_utils.replaceMacros(BOOL_PARAM, params) - params["SAVED"] = "0" - params["PARAM_NAME"] = generate_utils.getLockWorldParam() result += generate_utils.replaceMacros(BOOL_PARAM, params) diff --git a/Scripts/generate_utils.py b/Scripts/generate_utils.py index 349988d..cbb8354 100644 --- a/Scripts/generate_utils.py +++ b/Scripts/generate_utils.py @@ -42,15 +42,6 @@ def getToggleParam(): def getScaleParam(): return "TaSTT_Scale" -# When this is set to true, the board will emit a soft beep sound. It's used to -# grab attention when speaking. -def getSpeechNoiseToggleParam(): - return "TaSTT_Speech_Noise_Toggle" - -# This is used to disable speaking noises. -def getSpeechNoiseEnableParam(): - return "TaSTT_Speech_Noise_Enable" - # When this is set to true, the board clears. def getClearBoardParam(): return "TaSTT_Clear_Board" diff --git a/Scripts/libtastt.py b/Scripts/libtastt.py index 1b5ed77..e251015 100644 --- a/Scripts/libtastt.py +++ b/Scripts/libtastt.py @@ -482,9 +482,6 @@ def generateScaleAnimation(anim_name: str, anim_dir: str, def generateAnimations(anim_dir, guid_map): generateClearAnimation(anim_dir, guid_map) - generateToggleAnimations(anim_dir, generate_utils.getIndicator0Param(), guid_map) - generateToggleAnimations(anim_dir, generate_utils.getIndicator1Param(), guid_map) - print("Generating letter animations", file=sys.stderr) parser = libunity.UnityParser() @@ -544,10 +541,7 @@ def generateFXController(anim: libunity.UnityAnimator) -> typing.Dict[int, libun anim.addParameter(generate_utils.getHipToggleParam(), bool) anim.addParameter(generate_utils.getHandToggleParam(), bool) anim.addParameter(generate_utils.getToggleParam(), bool) - anim.addParameter(generate_utils.getSpeechNoiseEnableParam(), bool) anim.addParameter(generate_utils.getClearBoardParam(), bool) - anim.addParameter(generate_utils.getIndicator0Param(), bool) - anim.addParameter(generate_utils.getIndicator1Param(), bool) anim.addParameter(generate_utils.getScaleParam(), float) layers = {} @@ -699,20 +693,6 @@ def generateFX(guid_map, gen_anim_dir): print("Generating layer {}/{}".format(which_layer, len(layers[byte].items())), file=sys.stderr) generateFXLayer(which_layer, anim, layer, gen_anim_dir, byte) - states = generateToggle( - generate_utils.getSpeechNoiseToggleParam(), - generate_utils.getSpeechNoiseToggleParam(), - gen_anim_dir, - "TaSTT_Speech_Noise_Off.anim", - "TaSTT_Speech_Noise_On.anim", - anim, guid_map) - # Enable beeping only if user has turned it on. - anim.addTransitionBooleanCondition(states["off"], - states["off_to_on"], generate_utils.getSpeechNoiseEnableParam(), True) - # Enable beeping only if board is out. - anim.addTransitionBooleanCondition(states["off"], - states["off_to_on"], generate_utils.getToggleParam(), True) - generateToggle(generate_utils.getToggleParam(), generate_utils.getToggleParam(), gen_anim_dir, @@ -732,18 +712,6 @@ def generateFX(guid_map, gen_anim_dir): None, # No animation in the `off` state. generate_utils.getClearAnimationName() + ".anim", anim, guid_map) - generateToggle(generate_utils.getIndicator0Param(), - generate_utils.getIndicator0Param(), - gen_anim_dir, - generate_utils.getIndicator0Param() + "_Off.anim", - generate_utils.getIndicator0Param() + "_On.anim", - anim, guid_map) - generateToggle(generate_utils.getIndicator1Param(), - generate_utils.getIndicator1Param(), - gen_anim_dir, - generate_utils.getIndicator1Param() + "_Off.anim", - generate_utils.getIndicator1Param() + "_On.anim", - anim, guid_map) generateToggle("TaSTT_Expand", generate_utils.getToggleParam(), gen_anim_dir, diff --git a/Scripts/osc_ctrl.py b/Scripts/osc_ctrl.py index 3ff56ca..e7f422b 100644 --- a/Scripts/osc_ctrl.py +++ b/Scripts/osc_ctrl.py @@ -51,14 +51,6 @@ def toggleBoard(client, show: bool): addr = "/avatar/parameters/" + generate_utils.getToggleParam() client.send_message(addr, show) -def indicateSpeech(client, is_speaking: bool): - addr = "/avatar/parameters/" + generate_utils.getIndicator0Param() - client.send_message(addr, is_speaking) - -def indicatePaging(client, is_paging: bool): - addr = "/avatar/parameters/" + generate_utils.getIndicator1Param() - client.send_message(addr, is_paging) - def enable(client): addr="/avatar/parameters/" + generate_utils.getEnableParam() client.send_message(addr, True) @@ -98,11 +90,6 @@ def pageMessage(osc_state: OscState, msg: str, estate: EmotesState) -> bool: #print("sending page {}: {} ({})".format(slice_idx, msg_slice, # len(msg_slice))) - empty_slice = " " * len(msg_slice) - if msg_slice != empty_slice: - addr="/avatar/parameters/" + generate_utils.getSpeechNoiseToggleParam() - osc_state.client.send_message(addr, True) - # Really long messages just wrap back around. which_region = (slice_idx % generate_utils.config.numRegions(0)) @@ -138,10 +125,6 @@ def pageMessage(osc_state: OscState, msg: str, estate: EmotesState) -> bool: # Wait for parameter sync. time.sleep(SYNC_DELAY_S) - if msg_slice != empty_slice: - addr="/avatar/parameters/" + generate_utils.getSpeechNoiseToggleParam() - osc_state.client.send_message(addr, False) - # Like `pageMessage` but uses the built-in chatbox. The built-in chatbox # truncates data at about 150 chars, so just send the suffix of the message for # now. diff --git a/Scripts/transcribe.py b/Scripts/transcribe.py index a50eab8..c86d1db 100644 --- a/Scripts/transcribe.py +++ b/Scripts/transcribe.py @@ -471,7 +471,6 @@ def sendAudio(audio_state, use_builtin: bool, estate: EmotesState): else: ret = osc_ctrl.pageMessage(audio_state.osc_state, text, estate) is_paging = (ret == False) - osc_ctrl.indicatePaging(audio_state.osc_state.client, is_paging) # Pace this out time.sleep(0.01) @@ -508,7 +507,6 @@ def readKeyboardInput(audio_state, enable_local_beep: bool, if event == EVENT_DOUBLE_PRESS: state = PAUSE_STATE if not use_builtin: - osc_ctrl.indicateSpeech(audio_state.osc_state.client, False) osc_ctrl.toggleBoard(audio_state.osc_state.client, False) if audio_state.reset_on_toggle: @@ -528,7 +526,6 @@ def readKeyboardInput(audio_state, enable_local_beep: bool, if state == RECORD_STATE: state = PAUSE_STATE if not use_builtin: - osc_ctrl.indicateSpeech(audio_state.osc_state.client, False) osc_ctrl.lockWorld(audio_state.osc_state.client, True) audio_state.transcribe_sleep_duration = audio_state.transcribe_sleep_duration_min_s @@ -540,7 +537,6 @@ def readKeyboardInput(audio_state, enable_local_beep: bool, elif state == PAUSE_STATE: state = RECORD_STATE if not use_builtin: - osc_ctrl.indicateSpeech(audio_state.osc_state.client, True) osc_ctrl.toggleBoard(audio_state.osc_state.client, True) osc_ctrl.lockWorld(audio_state.osc_state.client, False) if audio_state.reset_on_toggle: @@ -576,8 +572,6 @@ def readControllerInput(audio_state, enable_local_beep: bool, RECORD_STATE = 0 PAUSE_STATE = 1 state = PAUSE_STATE - osc_ctrl.indicateSpeech(audio_state.osc_state.client, False) - osc_ctrl.indicatePaging(audio_state.osc_state.client, False) hand_id = steamvr.hands[button.split()[0]] button_id = steamvr.buttons[button.split()[1]] @@ -611,7 +605,6 @@ def readControllerInput(audio_state, enable_local_beep: bool, # Long press: treat as the end of transcription. state = PAUSE_STATE if not use_builtin: - osc_ctrl.indicateSpeech(audio_state.osc_state.client, False) osc_ctrl.lockWorld(audio_state.osc_state.client, True) audio_state.transcribe_sleep_duration = audio_state.transcribe_sleep_duration_min_s audio_state.audio_paused = True @@ -637,7 +630,6 @@ def readControllerInput(audio_state, enable_local_beep: bool, block=False) if not use_builtin: - osc_ctrl.indicateSpeech(audio_state.osc_state.client, False) osc_ctrl.toggleBoard(audio_state.osc_state.client, False) resetAudioLocked(audio_state) @@ -649,7 +641,6 @@ def readControllerInput(audio_state, enable_local_beep: bool, if state == RECORD_STATE: state = PAUSE_STATE if not use_builtin: - osc_ctrl.indicateSpeech(audio_state.osc_state.client, False) osc_ctrl.lockWorld(audio_state.osc_state.client, True) audio_state.transcribe_sleep_duration = audio_state.transcribe_sleep_duration_min_s @@ -661,7 +652,6 @@ def readControllerInput(audio_state, enable_local_beep: bool, elif state == PAUSE_STATE: state = RECORD_STATE if not use_builtin: - osc_ctrl.indicateSpeech(audio_state.osc_state.client, True) osc_ctrl.toggleBoard(audio_state.osc_state.client, True) osc_ctrl.lockWorld(audio_state.osc_state.client, False) if audio_state.reset_on_toggle: -- cgit v1.2.3