@@ -19,11 +19,36 @@ public class SettingsViewModel : PageViewModelBase {
19
19
/// </summary>
20
20
private readonly IConfiguration _configuration ;
21
21
22
+ /// <summary>
23
+ /// Don't use anti-alias filtering (gain speed, lose quality)
24
+ /// </summary>
25
+ private bool _antiAliasingOff ;
26
+
27
+ /// <summary>
28
+ /// Detect the BPM rate of sound and adjust tempo to meet 'n' BPMs. If value not specified, just detects the BPM rate.
29
+ /// </summary>
30
+ private int _bpm ;
31
+
22
32
/// <summary>
23
33
/// The list of possible output devices that exist on the machine.
24
34
/// </summary>
25
35
private ObservableCollection < string > _outputDevices ;
26
36
37
+ /// <summary>
38
+ /// Change sound pitch by n semitones (-60 to +60 semitones)
39
+ /// </summary>
40
+ private int _pitch ;
41
+
42
+ /// <summary>
43
+ /// Use quicker tempo change algorithm (gain speed, lose quality)
44
+ /// </summary>
45
+ private bool _quick ;
46
+
47
+ /// <summary>
48
+ /// Change sound rate by n percents (-95 to +5000 %)
49
+ /// </summary>
50
+ private int _rate ;
51
+
27
52
/// <summary>
28
53
/// The selected output device to send TTS to.
29
54
/// </summary>
@@ -34,6 +59,11 @@ public class SettingsViewModel : PageViewModelBase {
34
59
/// </summary>
35
60
private string ? _selectedTtsVoice ;
36
61
62
+ /// <summary>
63
+ /// Change sound tempo by n percents (-95 to +5000 %)
64
+ /// </summary>
65
+ private int _tempo ;
66
+
37
67
/// <summary>
38
68
/// The view model for the phonetic words list.
39
69
/// </summary>
@@ -55,13 +85,19 @@ public class SettingsViewModel : PageViewModelBase {
55
85
/// <remarks>0 is silent, 100 is full volume.</remarks>
56
86
private uint _ttsVolume ;
57
87
88
+ /// <summary>
89
+ /// Tune algorithm for speech processing (default is for music)
90
+ /// </summary>
91
+ private bool _turnOnSpeech ;
92
+
58
93
/// <summary>
59
94
/// Initializes a new instance of the <see cref="SettingsViewModel" /> class.
60
95
/// </summary>
61
96
public SettingsViewModel ( IConfiguration configuration , TtsPhoneticWordsViewModel ttsPhoneticWordsViewModel , TtsSkipUsernamesViewModel ttsSkipUsernamesViewModel ) {
62
97
_configuration = configuration ;
63
98
_ttsPhoneticWordsViewModel = ttsPhoneticWordsViewModel ;
64
99
_ttsSkipUsernamesViewModel = ttsSkipUsernamesViewModel ;
100
+ _configuration . SoundStretchArgs ??= new SoundStretchArgs ( ) ;
65
101
66
102
// Get the list of output devices and set the default to either what we have in the configuration or the system
67
103
// default whichever is more appropriate.
@@ -171,4 +207,102 @@ public TtsSkipUsernamesViewModel TtsSkipUsernamesViewModel {
171
207
get => _ttsSkipUsernamesViewModel ;
172
208
set => this . RaiseAndSetIfChanged ( ref _ttsSkipUsernamesViewModel , value ) ;
173
209
}
210
+
211
+ /// <summary>
212
+ /// Change sound tempo by n percents (-95 to +5000 %)
213
+ /// </summary>
214
+ public int Tempo {
215
+ get => _tempo ;
216
+ set {
217
+ this . RaiseAndSetIfChanged ( ref _tempo , value ) ;
218
+ if ( _configuration . SoundStretchArgs != null ) {
219
+ _configuration . SoundStretchArgs . Tempo = value ;
220
+ _configuration . WriteConfiguration ( ) ;
221
+ }
222
+ }
223
+ }
224
+
225
+ /// <summary>
226
+ /// Change sound pitch by n semitones (-60 to +60 semitones)
227
+ /// </summary>
228
+ public int Pitch {
229
+ get => _pitch ;
230
+ set {
231
+ this . RaiseAndSetIfChanged ( ref _pitch , value ) ;
232
+ if ( _configuration . SoundStretchArgs != null ) {
233
+ _configuration . SoundStretchArgs . Pitch = value ;
234
+ _configuration . WriteConfiguration ( ) ;
235
+ }
236
+ }
237
+ }
238
+
239
+ /// <summary>
240
+ /// Change sound rate by n percents (-95 to +5000 %)
241
+ /// </summary>
242
+ public int Rate {
243
+ get => _rate ;
244
+ set {
245
+ this . RaiseAndSetIfChanged ( ref _rate , value ) ;
246
+ if ( _configuration . SoundStretchArgs != null ) {
247
+ _configuration . SoundStretchArgs . Rate = value ;
248
+ _configuration . WriteConfiguration ( ) ;
249
+ }
250
+ }
251
+ }
252
+
253
+ /// <summary>
254
+ /// Detect the BPM rate of sound and adjust tempo to meet 'n' BPMs. If value not specified, just detects the BPM rate.
255
+ /// </summary>
256
+ public int Bpm {
257
+ get => _bpm ;
258
+ set {
259
+ this . RaiseAndSetIfChanged ( ref _bpm , value ) ;
260
+ if ( _configuration . SoundStretchArgs != null ) {
261
+ _configuration . SoundStretchArgs . Bpm = value ;
262
+ _configuration . WriteConfiguration ( ) ;
263
+ }
264
+ }
265
+ }
266
+
267
+ /// <summary>
268
+ /// Use quicker tempo change algorithm (gain speed, lose quality)
269
+ /// </summary>
270
+ public bool Quick {
271
+ get => _quick ;
272
+ set {
273
+ this . RaiseAndSetIfChanged ( ref _quick , value ) ;
274
+ if ( _configuration . SoundStretchArgs != null ) {
275
+ _configuration . SoundStretchArgs . Quick = value ;
276
+ _configuration . WriteConfiguration ( ) ;
277
+ }
278
+ }
279
+ }
280
+
281
+ /// <summary>
282
+ /// Don't use anti-alias filtering (gain speed, lose quality)
283
+ /// </summary>
284
+ public bool AntiAliasingOff {
285
+ get => _antiAliasingOff ;
286
+ set {
287
+ this . RaiseAndSetIfChanged ( ref _antiAliasingOff , value ) ;
288
+ if ( _configuration . SoundStretchArgs != null ) {
289
+ _configuration . SoundStretchArgs . AntiAliasingOff = value ;
290
+ _configuration . WriteConfiguration ( ) ;
291
+ }
292
+ }
293
+ }
294
+
295
+ /// <summary>
296
+ /// Tune algorithm for speech processing (default is for music)
297
+ /// </summary>
298
+ public bool TurnOnSpeech {
299
+ get => _turnOnSpeech ;
300
+ set {
301
+ this . RaiseAndSetIfChanged ( ref _turnOnSpeech , value ) ;
302
+ if ( _configuration . SoundStretchArgs != null ) {
303
+ _configuration . SoundStretchArgs . TurnOnSpeech = value ;
304
+ _configuration . WriteConfiguration ( ) ;
305
+ }
306
+ }
307
+ }
174
308
}
0 commit comments