1
0
forked from cgvr/DeltaVR

improve text recognition reliability, unsubscribe from Whisper events when not wanted anymore

This commit is contained in:
2026-01-28 16:14:27 +02:00
parent e0d68454c7
commit 876306a2af
4 changed files with 37 additions and 9 deletions

View File

@@ -14,8 +14,6 @@ public class MicrophoneStand : MonoBehaviour
// Start is called before the first frame update
void Start()
{
fmodWhisperBridge.OnWhisperResultProcessed += OnWhisperResult;
microphoneOffStatus.SetActive(true);
microphoneOnStatus.SetActive(false);
}
@@ -33,6 +31,9 @@ public class MicrophoneStand : MonoBehaviour
if (controller != null || other.gameObject.tag == "Player Head")
{
fmodWhisperBridge.OnWhisperSegmentUpdated += OnWhisperResult;
fmodWhisperBridge.OnWhisperSegmentFinished += OnWhisperResult;
microphoneOffStatus.SetActive(false);
microphoneOnStatus.SetActive(true);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.RadioButton, gameObject);
@@ -49,6 +50,9 @@ public class MicrophoneStand : MonoBehaviour
KbmController controller = other.GetComponent<KbmController>();
if (controller != null | other.gameObject.tag == "Player Head")
{
fmodWhisperBridge.OnWhisperSegmentUpdated -= OnWhisperResult;
fmodWhisperBridge.OnWhisperSegmentFinished -= OnWhisperResult;
microphoneOffStatus.SetActive(true);
microphoneOnStatus.SetActive(false);
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.RadioButton, gameObject);
@@ -62,6 +66,10 @@ public class MicrophoneStand : MonoBehaviour
private void OnWhisperResult(string result)
{
if (string.IsNullOrEmpty(result) || result.Equals("BLANK_AUDIO"))
{
return;
}
outputText.text = result;
}