Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in behavior of whisper in radio TTS events. #82

Merged
merged 1 commit into from
Jun 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Content.Server/Corvax/TTS/TTSSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ private async void OnEntitySpoke(EntityUid uid, TTSComponent component, EntitySp
if (!_prototypeManager.TryIndex<TTSVoicePrototype>(voiceId, out var protoVoice))
return;

if (args.ObfuscatedMessage != null && !args.IsRadio)
if (args.ObfuscatedMessage != null)
{
HandleWhisper(uid, args.Message, args.ObfuscatedMessage, protoVoice.Speaker);
HandleWhisper(uid, args.Message, protoVoice.Speaker, args.IsRadio);
return;
}

Expand All @@ -129,9 +129,11 @@ private async void HandleSay(EntityUid uid, string message, string speaker)
RaiseNetworkEvent(new PlayTTSEvent(uid, soundData, false), Filter.Pvs(uid));
}

private async void HandleWhisper(EntityUid uid, string message, string obfMessage, string speaker)
private async void HandleWhisper(EntityUid uid, string message, string speaker, bool isRadio)
{
var soundData = await GenerateTTS(message, speaker, true);
// If it's a whisper into a radio, generate speech without whisper
// attributes to prevent an additional speech synthesis event
var soundData = await GenerateTTS(message, speaker, isWhisper: !isRadio);
if (soundData is null)
return;

Expand Down