Skip to content

Commit

Permalink
Changes in behavior of whisper in radio TTS events. (#82)
Browse files Browse the repository at this point in the history
Co-authored-by: Титов Вячеслав Витальевич <[email protected]>
  • Loading branch information
rincew1nd and Титов Вячеслав Витальевич authored Jun 21, 2023
1 parent 0727584 commit c265220
Showing 1 changed file with 6 additions and 4 deletions.
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

0 comments on commit c265220

Please sign in to comment.