forked from cgvr/DeltaVR
moved archery range model generation logic to npc script, added corresponding voicelines
This commit is contained in:
@@ -115,11 +115,17 @@ public class FMODWhisperBridge : MonoBehaviour
|
||||
};
|
||||
_stream.OnSegmentUpdated += (seg) =>
|
||||
{
|
||||
OnWhisperSegmentUpdated?.Invoke(seg.Result);
|
||||
if (IsSpeechMeaningful(seg.Result))
|
||||
{
|
||||
OnWhisperSegmentUpdated?.Invoke(seg.Result);
|
||||
}
|
||||
};
|
||||
_stream.OnSegmentFinished += (seg) =>
|
||||
{
|
||||
OnWhisperSegmentFinished?.Invoke(seg.Result);
|
||||
if (IsSpeechMeaningful(seg.Result))
|
||||
{
|
||||
OnWhisperSegmentFinished?.Invoke(seg.Result);
|
||||
}
|
||||
};
|
||||
|
||||
// If you want Whisper to respect VAD, enable in manager or set useVad (manager controls stream params).
|
||||
@@ -182,6 +188,11 @@ public class FMODWhisperBridge : MonoBehaviour
|
||||
isRecordingActivated = false;
|
||||
}
|
||||
|
||||
private bool IsSpeechMeaningful(string userText)
|
||||
{
|
||||
return !string.IsNullOrEmpty(userText) && !userText.Contains("BLANK_AUDIO") && !userText.Trim().Equals("[ Silence ]");
|
||||
}
|
||||
|
||||
private void CopyPcm16ToFloatAndFeed(IntPtr src, uint byteLen)
|
||||
{
|
||||
int samples = (int)(byteLen / 2); // 2 bytes per sample
|
||||
|
||||
Reference in New Issue
Block a user