diff --git a/src/libse/Common/Settings.cs b/src/libse/Common/Settings.cs index fa9d00353..c94f4adf5 100644 --- a/src/libse/Common/Settings.cs +++ b/src/libse/Common/Settings.cs @@ -2567,6 +2567,7 @@ $HorzAlign = Center public string MainVideoAudioToTextVosk { get; set; } public string MainVideoAudioToTextWhisper { get; set; } public string MainVideoAudioExtractAudioSelectedLines { get; set; } + public string MainVideoTextToSpeech { get; set; } // spell check public string MainSpellCheck { get; set; } @@ -10282,6 +10283,12 @@ $HorzAlign = Center shortcuts.MainVideoAudioExtractAudioSelectedLines = subNode.InnerText; } + subNode = node.SelectSingleNode("MainVideoTextToSpeech"); + if (subNode != null) + { + shortcuts.MainVideoTextToSpeech = subNode.InnerText; + } + subNode = node.SelectSingleNode("MainSpellCheck"); if (subNode != null) { @@ -12963,6 +12970,7 @@ $HorzAlign = Center textWriter.WriteElementString("MainVideoAudioToTextVosk", shortcuts.MainVideoAudioToTextVosk); textWriter.WriteElementString("MainVideoAudioToTextWhisper", shortcuts.MainVideoAudioToTextWhisper); textWriter.WriteElementString("MainVideoAudioExtractAudioSelectedLines", shortcuts.MainVideoAudioExtractAudioSelectedLines); + textWriter.WriteElementString("MainVideoTextToSpeech", shortcuts.MainVideoTextToSpeech); textWriter.WriteElementString("MainSpellCheck", shortcuts.MainSpellCheck); textWriter.WriteElementString("MainSpellCheckFindDoubleWords", shortcuts.MainSpellCheckFindDoubleWords); textWriter.WriteElementString("MainSpellCheckAddWordToNames", shortcuts.MainSpellCheckAddWordToNames); diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index 697e41ce5..7ba0b5b02 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -18678,6 +18678,11 @@ namespace Nikse.SubtitleEdit.Forms e.SuppressKeyPress = true; ExtractAudioSelectedLines(); } + else if (e.KeyData == _shortcuts.MainVideoTextToSpeech) + { + e.SuppressKeyPress = true; + TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(10), () => textToSpeechAndAddToVideoToolStripMenuItem_Click(null, null)); + } else if (e.KeyData == _shortcuts.MainVideoToggleBrightness) { if (mediaPlayer.VideoPlayer is LibMpvDynamic libMpv) diff --git a/src/ui/Forms/Options/Settings.cs b/src/ui/Forms/Options/Settings.cs index b2f0ec33c..e2b307ed0 100644 --- a/src/ui/Forms/Options/Settings.cs +++ b/src/ui/Forms/Options/Settings.cs @@ -1701,6 +1701,7 @@ namespace Nikse.SubtitleEdit.Forms.Options AddNode(videoNode, language.MainToggleVideoControls, nameof(Configuration.Settings.Shortcuts.MainVideoToggleControls)); AddNode(videoNode, string.Format(language.AudioToTextX, "Vosk"), nameof(Configuration.Settings.Shortcuts.MainVideoAudioToTextVosk)); AddNode(videoNode, string.Format(language.AudioToTextX, "Whisper"), nameof(Configuration.Settings.Shortcuts.MainVideoAudioToTextWhisper)); + AddNode(videoNode, LanguageSettings.Current.TextToSpeech.Title, nameof(Configuration.Settings.Shortcuts.MainVideoTextToSpeech)); AddNode(videoNode, language.AudioExtractSelectedLines, nameof(Configuration.Settings.Shortcuts.MainVideoAudioExtractAudioSelectedLines)); AddNode(videoNode, language.VideoToggleContrast, nameof(Configuration.Settings.Shortcuts.MainVideoToggleContrast)); AddNode(videoNode, language.VideoToggleBrightness, nameof(Configuration.Settings.Shortcuts.MainVideoToggleBrightness)); diff --git a/src/ui/Forms/TimedTextNewLanguage.cs b/src/ui/Forms/TimedTextNewLanguage.cs index 63c26cbce..9f81cf368 100644 --- a/src/ui/Forms/TimedTextNewLanguage.cs +++ b/src/ui/Forms/TimedTextNewLanguage.cs @@ -40,20 +40,20 @@ namespace Nikse.SubtitleEdit.Forms comboBoxLanguage.BeginUpdate(); comboBoxLanguage.Items.Clear(); - int selctedIndex = 0; - for (int i = 0; i < moreLanguages.Count; i++) + var selectedIndex = 0; + for (var i = 0; i < moreLanguages.Count; i++) { var language = moreLanguages[i]; var code = language.TwoLetterISOLanguageName.ToLowerInvariant(); comboBoxLanguage.Items.Add(new LanguageComboBoxItem(code, language.EnglishName + " / " + language.NativeName)); if (code == currentLanguage) { - selctedIndex = i; + selectedIndex = i; } } if (comboBoxLanguage.Items.Count > 0) { - comboBoxLanguage.SelectedIndex = selctedIndex; + comboBoxLanguage.SelectedIndex = selectedIndex; } comboBoxLanguage.EndUpdate(); } diff --git a/src/ui/Logic/MainShortcuts.cs b/src/ui/Logic/MainShortcuts.cs index 4ec8f0f6d..810a9a602 100644 --- a/src/ui/Logic/MainShortcuts.cs +++ b/src/ui/Logic/MainShortcuts.cs @@ -97,6 +97,7 @@ namespace Nikse.SubtitleEdit.Logic public Keys MainVideoAudioToTextVosk { get; set; } public Keys MainVideoAudioToTextWhisper { get; set; } public Keys MainVideoAudioExtractSelectedLines { get; set; } + public Keys MainVideoTextToSpeech { get; set; } public Keys MainVideoToggleContrast { get; set; } public Keys MainGoToPreviousSubtitleAndFocusVideo { get; set; } public Keys MainGoToNextSubtitleAndFocusVideo { get; set; } @@ -393,6 +394,7 @@ namespace Nikse.SubtitleEdit.Logic MainVideoAudioToTextVosk = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoAudioToTextVosk); MainVideoAudioToTextWhisper = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoAudioToTextWhisper); MainVideoAudioExtractSelectedLines = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoAudioExtractAudioSelectedLines); + MainVideoTextToSpeech = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoTextToSpeech); MainVideoToggleBrightness = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoToggleBrightness); MainVideoToggleContrast = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoToggleContrast); MainToolsAutoDuration = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainToolsAutoDuration);