diff --git a/public/scripts/extensions/tts/edge.js b/public/scripts/extensions/tts/edge.js
index f14bc6874..4aeb935a8 100644
--- a/public/scripts/extensions/tts/edge.js
+++ b/public/scripts/extensions/tts/edge.js
@@ -6,6 +6,11 @@ import { saveTtsProviderSettings } from './index.js';
export { EdgeTtsProvider };
+const EDGE_TTS_PROVIDER = {
+ extras: 'extras',
+ plugin: 'plugin',
+};
+
class EdgeTtsProvider {
//########//
// Config //
@@ -19,18 +24,26 @@ class EdgeTtsProvider {
defaultSettings = {
voiceMap: {},
rate: 0,
+ provider: EDGE_TTS_PROVIDER.extras,
};
get settingsHtml() {
- let html = `Microsoft Edge TTS Provider
+ let html = `Microsoft Edge TTS
+
+
- `;
+
+ `;
return html;
}
onSettingsChange() {
this.settings.rate = Number($('#edge_tts_rate').val());
$('#edge_tts_rate_output').text(this.settings.rate);
+ this.settings.provider = String($('#edge_tts_provider').val());
saveTtsProviderSettings();
}
@@ -53,16 +66,19 @@ class EdgeTtsProvider {
$('#edge_tts_rate').val(this.settings.rate || 0);
$('#edge_tts_rate_output').text(this.settings.rate || 0);
- $('#edge_tts_rate').on('input', () => {this.onSettingsChange();});
+ $('#edge_tts_rate').on('input', () => { this.onSettingsChange(); });
+ $('#edge_tts_provider').val(this.settings.provider || EDGE_TTS_PROVIDER.extras);
+ $('#edge_tts_provider').on('change', () => { this.onSettingsChange(); });
await this.checkReady();
console.debug('EdgeTTS: Settings loaded');
}
-
- // Perform a simple readiness check by trying to fetch voiceIds
- async checkReady(){
- throwIfModuleMissing();
+ /**
+ * Perform a simple readiness check by trying to fetch voiceIds
+ */
+ async checkReady() {
+ await this.throwIfModuleMissing();
await this.fetchTtsVoiceObjects();
}
@@ -74,6 +90,11 @@ class EdgeTtsProvider {
// TTS Interfaces //
//#################//
+ /**
+ * Get a voice from the TTS provider.
+ * @param {string} voiceName Voice name to get
+ * @returns {Promise