From 40262121b058a4aefddf09dd50605e2e8ee5ea70 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 27 Oct 2024 08:11:26 +0100 Subject: [PATCH] More tts Work on #8869 --- src/ui/Forms/Tts/RegenerateAudioClip.cs | 8 ++++++++ src/ui/Forms/Tts/ReviewAudioClips.cs | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/ui/Forms/Tts/RegenerateAudioClip.cs b/src/ui/Forms/Tts/RegenerateAudioClip.cs index 8c31f1ed4..df4ce9f87 100644 --- a/src/ui/Forms/Tts/RegenerateAudioClip.cs +++ b/src/ui/Forms/Tts/RegenerateAudioClip.cs @@ -56,6 +56,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts private void buttonReGenerate_Click(object sender, EventArgs e) { + _libMpv?.Stop(); + Configuration.Settings.Tools.TextToSpeechElevenLabsStability = (double)nikseUpDownStability.Value / 100.0; Configuration.Settings.Tools.TextToSpeechElevenLabsSimilarity = (double)nikseUpDownSimilarity.Value / 100.0; @@ -86,21 +88,26 @@ namespace Nikse.SubtitleEdit.Forms.Tts private void buttonCancel_Click(object sender, EventArgs e) { + _libMpv?.Stop(); DialogResult = DialogResult.Cancel; } private void buttonOK_Click(object sender, EventArgs e) { + _libMpv?.Stop(); DialogResult = DialogResult.OK; } private void buttonPlay_Click(object sender, EventArgs e) { + _libMpv?.Stop(); + if (FileNameAndSpeedFactor == null) { return; } + buttonPlay.Enabled = false; var waveFileName = FileNameAndSpeedFactor.Filename; if (_libMpv != null) @@ -133,6 +140,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts using (var soundPlayer = new System.Media.SoundPlayer(waveFileName)) { soundPlayer.PlaySync(); + buttonPlay.Enabled = true; } } } diff --git a/src/ui/Forms/Tts/ReviewAudioClips.cs b/src/ui/Forms/Tts/ReviewAudioClips.cs index 556b9409e..d6134b347 100644 --- a/src/ui/Forms/Tts/ReviewAudioClips.cs +++ b/src/ui/Forms/Tts/ReviewAudioClips.cs @@ -206,6 +206,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts return; } + _libMpv?.Stop(); buttonPlay.Enabled = false; _playing = true; _abortPlay = false; @@ -265,6 +266,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts return; } + buttonStop_Click(null, null); + var idx = listViewAudioClips.SelectedItems[0].Index; using (var form = new RegenerateAudioClip(_textToSpeech, _subtitle, idx, _engine)) {