Skip to content

Commit

Permalink
Possible TTS fix 2 (#51)
Browse files Browse the repository at this point in the history
* Possible TTS fix 2

* Fix
  • Loading branch information
FireNameFN authored Nov 25, 2024
1 parent 5a5650e commit dd0017f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Content.Client/Corvax/TTS/TTSSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ public sealed class TTSSystem : EntitySystem
[Dependency] private readonly AudioSystem _audio = default!;

private ISawmill _sawmill = default!;
private MemoryContentRoot _contentRoot = default!;
private static MemoryContentRoot _contentRoot = new();
private static readonly ResPath Prefix = ResPath.Root / "TTS";

private static bool _contentRootAdded;

/// <summary>
/// Reducing the volume of the TTS when whispering. Will be converted to logarithm.
/// </summary>
Expand All @@ -40,9 +42,13 @@ public sealed class TTSSystem : EntitySystem

public override void Initialize()
{
_contentRoot = new();
if (!_contentRootAdded)
{
_contentRootAdded = true;
_res.AddRoot(Prefix, _contentRoot);
}

_sawmill = Logger.GetSawmill("tts");
_res.AddRoot(Prefix, _contentRoot);
_cfg.OnValueChanged(CCCVars.TTSVolume, OnTtsVolumeChanged, true);
SubscribeNetworkEvent<PlayTTSEvent>(OnPlayTTS);
}
Expand All @@ -51,7 +57,6 @@ public override void Shutdown()
{
base.Shutdown();
_cfg.UnsubValueChanged(CCCVars.TTSVolume, OnTtsVolumeChanged);
_contentRoot.Dispose();
}

public void RequestPreviewTTS(string voiceId)
Expand Down

0 comments on commit dd0017f

Please sign in to comment.