Work on #8869
This commit is contained in:
Nikolaj Olsson 2024-10-27 08:11:26 +01:00
parent b99fc65053
commit 40262121b0
2 changed files with 11 additions and 0 deletions

View File

@ -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;
}
}
}

View File

@ -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))
{