#2545 Fix system tts pitch slider not working
| @@ -97,9 +97,9 @@ class SystemTtsProvider { | |||
| 97 | 97 | ||
| 98 | return `<p>Uses the voices provided by your operating system</p> | 98 | return `<p>Uses the voices provided by your operating system</p> |
| 99 | <label for="system_tts_rate">Rate: <span id="system_tts_rate_output"></span></label> | 99 | <label for="system_tts_rate">Rate: <span id="system_tts_rate_output"></span></label> |
| 100 | <input id="system_tts_rate" type="range" value="${this.defaultSettings.rate}" min="0.5" max="2" step="0.1" /> | 100 | <input id="system_tts_rate" type="range" value="${this.defaultSettings.rate}" min="0.1" max="2" step="0.01" /> |
| 101 | <label for="system_tts_pitch">Pitch: <span id="system_tts_pitch_output"></span></label> | 101 | <label for="system_tts_pitch">Pitch: <span id="system_tts_pitch_output"></span></label> |
| 102 | <input id="system_tts_pitch" type="range" value="${this.defaultSettings.pitch}" min="0" max="2" step="0.1" />`; | 102 | <input id="system_tts_pitch" type="range" value="${this.defaultSettings.pitch}" min="0" max="2" step="0.01" />`; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | onSettingsChange() { | 105 | onSettingsChange() { |
| @@ -147,7 +147,7 @@ class SystemTtsProvider { | |||
| 147 | 147 | ||
| 148 | // Trigger updates | 148 | // Trigger updates |
| 149 | $('#system_tts_rate').on('input', () => { this.onSettingsChange(); }); | 149 | $('#system_tts_rate').on('input', () => { this.onSettingsChange(); }); |
| 150 | $('#system_tts_rate').on('input', () => { this.onSettingsChange(); }); | 150 | $('#system_tts_pitch').on('input', () => { this.onSettingsChange(); }); |
| 151 | 151 | ||
| 152 | $('#system_tts_pitch_output').text(this.settings.pitch); | 152 | $('#system_tts_pitch_output').text(this.settings.pitch); |
| 153 | $('#system_tts_rate_output').text(this.settings.rate); | 153 | $('#system_tts_rate_output').text(this.settings.rate); |
| @@ -198,8 +198,8 @@ class SystemTtsProvider { | |||
| 198 | const text = getPreviewString(voice.lang); | 198 | const text = getPreviewString(voice.lang); |
| 199 | const utterance = new SpeechSynthesisUtterance(text); | 199 | const utterance = new SpeechSynthesisUtterance(text); |
| 200 | utterance.voice = voice; | 200 | utterance.voice = voice; |
| 201 | utterance.rate = 1; | 201 | utterance.rate = this.settings.rate || 1; |
| 202 | utterance.pitch = 1; | 202 | utterance.pitch = this.settings.pitch || 1; |
| 203 | speechSynthesis.speak(utterance); | 203 | speechSynthesis.speak(utterance); |
| 204 | } | 204 | } |
| 205 | 205 | ||