Skip to content

Commit 64f0e81

Browse files
chore: code clean up
more code clean up #52
1 parent f2a926f commit 64f0e81

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/TwitchStreamingTools/ServiceCollectionExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
using Nullinside.Api.Common.Twitch;
66

7+
using TwitchStreamingTools.Services;
78
using TwitchStreamingTools.ViewModels;
89
using TwitchStreamingTools.ViewModels.Pages;
910

10-
namespace TwitchStreamingTools.Services;
11+
namespace TwitchStreamingTools;
1112

1213
/// <summary>
1314
/// A wrapper that contains the registered services.

src/TwitchStreamingTools/Tts/TwitchChatTts.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private void PlaySoundsThread() {
203203
string chatMessage = $"{convertedChatEvent.Item1} says {convertedChatEvent.Item2}";
204204

205205
// Converts the text to an audio stream and plays it.
206-
InitializeAndPlayTts(chatMessage, e.ChatMessage.Username);
206+
InitializeAndPlayTts(e.ChatMessage.Username, chatMessage);
207207
}
208208
}
209209
catch (Exception ex) {
@@ -218,12 +218,12 @@ private void PlaySoundsThread() {
218218
/// <param name="sender">The twitch chat login of the user that sent the message.</param>
219219
/// <param name="chatMessage">The chat message to convert to TTS.</param>
220220
private void InitializeAndPlayTts(string sender, string chatMessage) {
221+
// Create a microsoft TTS object and a stream for outputting its audio file to.
222+
using var synth = new SpeechSynthesizer();
223+
using var stream = new MemoryStream();
224+
221225
WaveFileReader reader;
222226
try {
223-
// Create a microsoft TTS object and a stream for outputting its audio file to.
224-
using var synth = new SpeechSynthesizer();
225-
using var stream = new MemoryStream();
226-
227227
// Setup the microsoft TTS object according to the settings.
228228
synth.SetOutputToWaveStream(stream);
229229
synth.SelectVoice(ChatConfig?.TtsVoice);

src/TwitchStreamingTools/Views/Pages/PageViewBase.axaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public PageViewBase() {
1717
}
1818

1919
/// <summary>
20-
/// Handles passing the <see cref="UserControl.Loaded" /> event down to the view model.
20+
/// Handles passing the Loaded event down to the view model.
2121
/// </summary>
2222
/// <param name="sender">The invoker.</param>
2323
/// <param name="e">The event arguments.</param>
@@ -27,7 +27,7 @@ private void Control_OnLoaded(object? sender, RoutedEventArgs e) {
2727
}
2828

2929
/// <summary>
30-
/// Handles passing the <see cref="UserControl.Unloaded" /> event down to the view model.
30+
/// Handles passing the Unloaded event down to the view model.
3131
/// </summary>
3232
/// <param name="sender">The invoker.</param>
3333
/// <param name="e">The event arguments.</param>

0 commit comments

Comments
 (0)