1
0
forked from cgvr/DeltaVR

moved archery range model generation logic to npc script, added corresponding voicelines

This commit is contained in:
2026-02-08 12:28:59 +02:00
parent 53295a60ed
commit dc55e8d884
12 changed files with 323 additions and 145 deletions

View File

@@ -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