forked from cgvr/DeltaVR
improve text recognition reliability, unsubscribe from Whisper events when not wanted anymore
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user