diff --git a/src/common/interfaces/ConfigFile.ts b/src/common/interfaces/ConfigFile.ts index a5b8ba7..46a71bb 100644 --- a/src/common/interfaces/ConfigFile.ts +++ b/src/common/interfaces/ConfigFile.ts @@ -11,6 +11,7 @@ export interface Card { title?: string; audioPath?: string; audioText?: string; + audioVoice?: string answer?: true } diff --git a/src/frontend/components/EditorView/TTSDialog.vue b/src/frontend/components/EditorView/TTSDialog.vue index 4aa8238..ef30847 100644 --- a/src/frontend/components/EditorView/TTSDialog.vue +++ b/src/frontend/components/EditorView/TTSDialog.vue @@ -21,8 +21,8 @@ diff --git a/src/frontend/store/LINKaStore.ts b/src/frontend/store/LINKaStore.ts index 8e99588..374be69 100644 --- a/src/frontend/store/LINKaStore.ts +++ b/src/frontend/store/LINKaStore.ts @@ -17,6 +17,7 @@ export interface LINKaStore { accent: string, secondary: string } + voice: string, keyMapping: KeyMap selectedKey?: Side; diff --git a/src/frontend/store/index.ts b/src/frontend/store/index.ts index 733bd0f..c5a8633 100644 --- a/src/frontend/store/index.ts +++ b/src/frontend/store/index.ts @@ -13,6 +13,7 @@ const fields = [ { commit: "colors_primary", default: "#197377" } as Field, { commit: "colors_accent", default: "#7DF6FA" } as Field, { commit: "colors_secondary", default: "#FFAF00" } as Field, + { commit: "voice", default: "alena" } as Field, { commit: "button_timeout", default: 1000 } as Field, { commit: "button_eyeSelect", default: true } as Field, { commit: "button_eyeActivation", default: true } as Field, @@ -40,6 +41,7 @@ const store = createStore({ accent: "", primary: "#197377" }, + voice: "alena", button: { timeout: 1000, enabled: true, @@ -126,6 +128,9 @@ const store = createStore({ colors_secondary ({ colors }, value) { colors.secondary = value; }, + voice ({ voice }, value) { + voice = value; + }, editor_current ({ editor }, value) { editor.current = value; }, @@ -228,6 +233,9 @@ const store = createStore({ commit("keyMapping_" + side, state.keyMapping[side].filter((c) => c !== code)); state.selectedKey = undefined; }, + voice_change ({ state }, voice: string) { + state.voice = voice; + }, interface_outputLine ({ state, commit }) { commit("interface_outputLine", !state.ui.outputLine); diff --git a/src/frontend/utils/TTS.ts b/src/frontend/utils/TTS.ts index f10ab45..92d92eb 100644 --- a/src/frontend/utils/TTS.ts +++ b/src/frontend/utils/TTS.ts @@ -13,6 +13,16 @@ export class TTS { return TTS._instance; } + static voices = [ + { value: "zahar", text: "Захар" }, + { value: "ermil", text: "Емиль" }, + { value: "jane", text: "Джейн" }, + { value: "oksana", text: "Оксана" }, + { value: "alena", text: "Алёна" }, + { value: "filipp", text: "Филипп" }, + { value: "omazh", text: "Ома" } + ]; + public async playCards (file: string, cards: Card[], force = false) { if (this.isPlaying) { this.isPlaying = false; diff --git a/src/frontend/views/EditorView.vue b/src/frontend/views/EditorView.vue index c4efb62..b2814c8 100644 --- a/src/frontend/views/EditorView.vue +++ b/src/frontend/views/EditorView.vue @@ -99,7 +99,12 @@ - + @@ -391,10 +396,11 @@ async function selectImage () { store.dispatch("enable_ui"); } -function onAudioFromTTS ({ audioSrcFile, audioText }: { audioSrcFile: string, audioText: string }) { +function onAudioFromTTS ({ audioSrcFile, audioText, audioVoice }: { audioSrcFile: string, audioText: string, audioVoice: string }) { if (!selected.value) throw new Error("Setting audio from TTSDialog to a nullish selected card"); selected.value.audioPath = audioSrcFile; selected.value.audioText = audioText; + selected.value.audioVoice = audioVoice; } /** * Called each time the user decides to open the fs navigator and use an .mp3 diff --git a/src/frontend/views/SettingsView.vue b/src/frontend/views/SettingsView.vue index 4af9682..5a7dbf3 100644 --- a/src/frontend/views/SettingsView.vue +++ b/src/frontend/views/SettingsView.vue @@ -88,6 +88,14 @@ + + + + +