File tree Expand file tree Collapse file tree 7 files changed +235
-195
lines changed
ViewModels/Pages/SettingsView Expand file tree Collapse file tree 7 files changed +235
-195
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ public static Configuration Instance {
83
83
/// </summary>
84
84
public SoundStretchArgs ? SoundStretchArgs { get ; set ; }
85
85
86
+ /// <inheritdoc />
87
+ public bool SayUsernameWithMessage { get ; set ; }
88
+
86
89
/// <summary>
87
90
/// Writes the configuration file to disk.
88
91
/// </summary>
Original file line number Diff line number Diff line change @@ -45,6 +45,11 @@ public interface IConfiguration {
45
45
/// </summary>
46
46
SoundStretchArgs ? SoundStretchArgs { get ; set ; }
47
47
48
+ /// <summary>
49
+ /// True if "username says message" should be used as the template for TTS messages, false to read just the message.
50
+ /// </summary>
51
+ bool SayUsernameWithMessage { get ; set ; }
52
+
48
53
/// <summary>
49
54
/// Writes the configuration file to disk.
50
55
/// </summary>
Original file line number Diff line number Diff line change @@ -220,8 +220,10 @@ private void PlaySoundsThread() {
220
220
continue ;
221
221
}
222
222
223
- // todo: #51 make this a configuration option and a filter.
224
- string chatMessage = $ "{ convertedChatEvent . Item1 } says { convertedChatEvent . Item2 } ";
223
+ string chatMessage = convertedChatEvent . Item2 ;
224
+ if ( _configuration . SayUsernameWithMessage ) {
225
+ chatMessage = $ "{ convertedChatEvent . Item1 } says { convertedChatEvent . Item2 } ";
226
+ }
225
227
226
228
// Converts the text to an audio stream and plays it.
227
229
InitializeAndPlayTts ( e . ChatMessage . Username , chatMessage ) ;
Original file line number Diff line number Diff line change @@ -51,6 +51,11 @@ public class SettingsViewModel : PageViewModelBase {
51
51
/// </summary>
52
52
private int _rate ;
53
53
54
+ /// <summary>
55
+ /// True if "username says message" should be used as the template for TTS messages, false to read just the message.
56
+ /// </summary>
57
+ private bool _sayUsernameWithMessage ;
58
+
54
59
/// <summary>
55
60
/// The selected output device to send TTS to.
56
61
/// </summary>
@@ -359,4 +364,17 @@ public double Speed {
359
364
_configuration . WriteConfiguration ( ) ;
360
365
}
361
366
}
367
+
368
+ /// <summary>
369
+ /// True if "username says message" should be used as the template for TTS messages, false to read just the message.
370
+ /// </summary>
371
+ public bool SayUsernameWithMessage {
372
+ get => _sayUsernameWithMessage ;
373
+ set {
374
+ this . RaiseAndSetIfChanged ( ref _sayUsernameWithMessage , value ) ;
375
+
376
+ _configuration . SayUsernameWithMessage = true ;
377
+ _configuration . WriteConfiguration ( ) ;
378
+ }
379
+ }
362
380
}
Original file line number Diff line number Diff line change 1
- using System ;
2
- using System . Linq ;
3
- using System . Threading . Tasks ;
4
-
5
- using Avalonia . Controls ;
6
-
7
- using Nullinside . Api . Common . Desktop ;
8
1
#if ! DEBUG
9
2
using Microsoft . Extensions . DependencyInjection ;
10
3
11
4
using Avalonia . Threading ;
12
5
13
6
using TwitchStreamingTools . ViewModels ;
14
-
15
7
#else
16
8
using Avalonia ;
17
9
#endif
10
+ using System ;
11
+ using System . Linq ;
12
+ using System . Threading . Tasks ;
13
+
14
+ using Avalonia . Controls ;
15
+
16
+ using Nullinside . Api . Common . Desktop ;
18
17
19
18
namespace TwitchStreamingTools . Views ;
20
19
You can’t perform that action at this time.
0 commit comments