Fixed TTS using StreamElements. Fixed several issues.

This commit is contained in:
Tom
2026-01-03 05:19:33 +00:00
parent fb04f4003f
commit aa89578297
16 changed files with 275 additions and 135 deletions

View File

@@ -82,35 +82,36 @@ namespace TwitchChatTTS.Hermes.Socket
public override async Task Connect()
{
_rwls.EnterWriteLock();
_rwls.EnterReadLock();
try
{
if (Connected)
return;
_logger.Debug($"Attempting to connect to {URL}");
await ConnectAsync(URL);
}
finally
{
_rwls.ExitWriteLock();
_rwls.ExitReadLock();
}
_logger.Debug($"Attempting to connect to {URL}");
await ConnectAsync(URL);
}
private async Task Disconnect()
{
_rwls.EnterWriteLock();
_rwls.EnterReadLock();
try
{
if (!Connected)
return;
await DisconnectAsync(new SocketDisconnectionEventArgs("Normal disconnection", "Disconnection was executed"));
}
finally
{
_rwls.ExitWriteLock();
_rwls.ExitReadLock();
}
await DisconnectAsync(new SocketDisconnectionEventArgs("Normal disconnection", "Disconnection was executed"));
}
public async Task CreateTTSVoice(string voiceName)
@@ -437,13 +438,13 @@ namespace TwitchChatTTS.Hermes.Socket
_logger.Warning("Tom to Speech websocket client is not connected. Not sending a message.");
return;
}
await base.Send(opcode, message);
}
finally
{
_rwls.ExitReadLock();
}
await base.Send(opcode, message);
}
}
}