From 740ac29f6b23f633c01a336fd519acae1d419a7f Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sat, 19 Oct 2024 21:31:51 +0200 Subject: [PATCH] Do not append voices when reloading --- src/ui/Forms/Tts/TextToSpeech.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ui/Forms/Tts/TextToSpeech.cs b/src/ui/Forms/Tts/TextToSpeech.cs index 437057930..b5d04fb80 100644 --- a/src/ui/Forms/Tts/TextToSpeech.cs +++ b/src/ui/Forms/Tts/TextToSpeech.cs @@ -1890,15 +1890,15 @@ namespace Nikse.SubtitleEdit.Forms.Tts Directory.CreateDirectory(ttsPath); } - var elevenLabsPath = Path.Combine(ttsPath, "Piper"); - if (!Directory.Exists(elevenLabsPath)) + var piperPath = Path.Combine(ttsPath, "Piper"); + if (!Directory.Exists(piperPath)) { - Directory.CreateDirectory(elevenLabsPath); + Directory.CreateDirectory(piperPath); } var result = new List(); - var jsonFileName = Path.Combine(elevenLabsPath, "voices.json"); + var jsonFileName = Path.Combine(piperPath, "voices.json"); if (!File.Exists(jsonFileName)) { @@ -1915,7 +1915,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts if (!string.IsNullOrEmpty(fileName)) { var name = entry.FilenameInZip; - var path = Path.Combine(elevenLabsPath, name.Replace('/', Path.DirectorySeparatorChar)); + var path = Path.Combine(piperPath, name.Replace('/', Path.DirectorySeparatorChar)); zip.ExtractFile(entry, path); } } @@ -2403,6 +2403,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts } else if (engine.Id == TextToSpeechEngineId.ElevenLabs) { + _elevenLabVoices.Clear(); GetElevenLabVoices(false); nikseComboBoxEngine_SelectedIndexChanged(null, null); }