mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 04:33:04 +01:00
Add TTS to video menu
This commit is contained in:
parent
830be724e1
commit
670ea65d7d
24
src/ui/Forms/Main.Designer.cs
generated
24
src/ui/Forms/Main.Designer.cs
generated
@ -450,6 +450,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.splitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mergeWithPreviousToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mergeWithNextToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.runWhiperOnParagraphToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.extendToPreviousToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.extendToNextToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -579,7 +580,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.timerOriginalTextUndo = new System.Windows.Forms.Timer(this.components);
|
||||
this.contextMenuStripShowVideoControls = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.toolStripMenuItemShowVideoControls = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.runWhiperOnParagraphToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.textToSpeechAndAddToVideoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
@ -2297,6 +2298,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.generateVideoWithHardcodedSubtitleToolStripMenuItem,
|
||||
this.audioToTextWhisperTolStripMenuItem,
|
||||
this.videoaudioToTextToolStripMenuItem,
|
||||
this.textToSpeechAndAddToVideoToolStripMenuItem,
|
||||
this.toolStripSeparator5,
|
||||
this.undockVideoControlsToolStripMenuItem,
|
||||
this.redockVideoControlsToolStripMenuItem});
|
||||
@ -4477,7 +4479,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.seekSilenceToolStripMenuItem,
|
||||
this.insertSubtitleHereToolStripMenuItem});
|
||||
this.contextMenuStripWaveform.Name = "contextMenuStripWaveform";
|
||||
this.contextMenuStripWaveform.Size = new System.Drawing.Size(275, 534);
|
||||
this.contextMenuStripWaveform.Size = new System.Drawing.Size(275, 512);
|
||||
this.contextMenuStripWaveform.Closing += new System.Windows.Forms.ToolStripDropDownClosingEventHandler(this.ContextMenuStripWaveformClosing);
|
||||
this.contextMenuStripWaveform.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripWaveformOpening);
|
||||
//
|
||||
@ -4551,6 +4553,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.mergeWithNextToolStripMenuItem.Text = "Merge with next";
|
||||
this.mergeWithNextToolStripMenuItem.Click += new System.EventHandler(this.MergeWithNextToolStripMenuItemClick);
|
||||
//
|
||||
// runWhiperOnParagraphToolStripMenuItem
|
||||
//
|
||||
this.runWhiperOnParagraphToolStripMenuItem.Name = "runWhiperOnParagraphToolStripMenuItem";
|
||||
this.runWhiperOnParagraphToolStripMenuItem.Size = new System.Drawing.Size(274, 22);
|
||||
this.runWhiperOnParagraphToolStripMenuItem.Text = "Run Whiper on paragraph...";
|
||||
this.runWhiperOnParagraphToolStripMenuItem.Click += new System.EventHandler(this.runWhiperOnParagraphToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator11
|
||||
//
|
||||
this.toolStripSeparator11.Name = "toolStripSeparator11";
|
||||
@ -5881,12 +5890,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.toolStripMenuItemShowVideoControls.Text = "Show video controls";
|
||||
this.toolStripMenuItemShowVideoControls.Click += new System.EventHandler(this.ToolStripMenuItemShowVideoControlsClick);
|
||||
//
|
||||
// runWhiperOnParagraphToolStripMenuItem
|
||||
// textToSpeechAndAddToVideoToolStripMenuItem
|
||||
//
|
||||
this.runWhiperOnParagraphToolStripMenuItem.Name = "runWhiperOnParagraphToolStripMenuItem";
|
||||
this.runWhiperOnParagraphToolStripMenuItem.Size = new System.Drawing.Size(274, 22);
|
||||
this.runWhiperOnParagraphToolStripMenuItem.Text = "Run Whiper on paragraph...";
|
||||
this.runWhiperOnParagraphToolStripMenuItem.Click += new System.EventHandler(this.runWhiperOnParagraphToolStripMenuItem_Click);
|
||||
this.textToSpeechAndAddToVideoToolStripMenuItem.Name = "textToSpeechAndAddToVideoToolStripMenuItem";
|
||||
this.textToSpeechAndAddToVideoToolStripMenuItem.Size = new System.Drawing.Size(295, 22);
|
||||
this.textToSpeechAndAddToVideoToolStripMenuItem.Text = "Text to speech and add to video...";
|
||||
this.textToSpeechAndAddToVideoToolStripMenuItem.Click += new System.EventHandler(this.textToSpeechAndAddToVideoToolStripMenuItem_Click);
|
||||
//
|
||||
// Main
|
||||
//
|
||||
@ -6507,5 +6516,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemVerifyCompleteness;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButtonVideoOpen;
|
||||
private System.Windows.Forms.ToolStripMenuItem runWhiperOnParagraphToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem textToSpeechAndAddToVideoToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1824,6 +1824,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
generateVideoWithSoftcodedSubtitlesToolStripMenuItem.Text = _language.Menu.Video.GenerateVideoWithEmbeddedSubs;
|
||||
videoaudioToTextToolStripMenuItem.Text = string.Format(_language.Menu.Video.VideoAudioToTextX, "Vosk/Kaldi");
|
||||
audioToTextWhisperTolStripMenuItem.Text = string.Format(_language.Menu.Video.VideoAudioToTextX, "Whisper");
|
||||
textToSpeechAndAddToVideoToolStripMenuItem.Text = _language.Menu.Video.TextToSpeechAndAddToVideo;
|
||||
|
||||
smpteTimeModedropFrameToolStripMenuItem.Text = _language.Menu.Video.SmptTimeMode;
|
||||
toolStripMenuItemImportChapters.Text = _language.Menu.Video.ImportChaptersFromVideo;
|
||||
@ -19026,30 +19027,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
RunCustomSearch(Configuration.Settings.VideoControls.CustomSearchUrl5);
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.Modifiers == (Keys.Alt | Keys.Shift | Keys.Control) && e.KeyCode == Keys.T)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
|
||||
TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(25), () =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(_videoFileName) || _videoInfo == null)
|
||||
{
|
||||
MessageBox.Show(LanguageSettings.Current.General.NoVideoLoaded);
|
||||
return;
|
||||
}
|
||||
|
||||
if (RequireFfmpegOk())
|
||||
{
|
||||
using (var form = new TextToSpeech(_subtitle, GetCurrentSubtitleFormat(), _videoFileName, _videoInfo))
|
||||
{
|
||||
if (form.ShowDialog(this) != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// put new entries above tabs
|
||||
|
||||
@ -36746,5 +36723,28 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
AudioToTextWhisperSelectedLines();
|
||||
}
|
||||
|
||||
private void textToSpeechAndAddToVideoToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(25), () =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(_videoFileName) || _videoInfo == null)
|
||||
{
|
||||
MessageBox.Show(LanguageSettings.Current.General.NoVideoLoaded);
|
||||
return;
|
||||
}
|
||||
|
||||
if (RequireFfmpegOk())
|
||||
{
|
||||
using (var form = new TextToSpeech(_subtitle, GetCurrentSubtitleFormat(), _videoFileName, _videoInfo))
|
||||
{
|
||||
if (form.ShowDialog(this) != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
63
src/ui/Forms/Tts/TextToSpeech.Designer.cs
generated
63
src/ui/Forms/Tts/TextToSpeech.Designer.cs
generated
@ -1,6 +1,6 @@
|
||||
namespace Nikse.SubtitleEdit.Forms.Tts
|
||||
{
|
||||
partial class TextToSpeech
|
||||
sealed partial class TextToSpeech
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -42,9 +42,9 @@
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.contextMenuStripActors = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.TextBoxTest = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
||||
this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox();
|
||||
this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox();
|
||||
this.TextBoxTest = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
||||
this.groupBoxMsSettings.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -94,10 +94,9 @@
|
||||
//
|
||||
// labelEngine
|
||||
//
|
||||
this.labelEngine.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.labelEngine.AutoSize = true;
|
||||
this.labelEngine.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.labelEngine.Location = new System.Drawing.Point(448, 12);
|
||||
this.labelEngine.Location = new System.Drawing.Point(14, 22);
|
||||
this.labelEngine.Name = "labelEngine";
|
||||
this.labelEngine.Size = new System.Drawing.Size(40, 13);
|
||||
this.labelEngine.TabIndex = 14;
|
||||
@ -106,21 +105,24 @@
|
||||
// groupBoxMsSettings
|
||||
//
|
||||
this.groupBoxMsSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.groupBoxMsSettings.Controls.Add(this.TextBoxTest);
|
||||
this.groupBoxMsSettings.Controls.Add(this.buttonTestVoice);
|
||||
this.groupBoxMsSettings.Controls.Add(this.checkBoxAddToVideoFile);
|
||||
this.groupBoxMsSettings.Controls.Add(this.labelMsVoice);
|
||||
this.groupBoxMsSettings.Controls.Add(this.nikseComboBoxVoice);
|
||||
this.groupBoxMsSettings.Location = new System.Drawing.Point(451, 57);
|
||||
this.groupBoxMsSettings.Controls.Add(this.labelEngine);
|
||||
this.groupBoxMsSettings.Controls.Add(this.nikseComboBoxEngine);
|
||||
this.groupBoxMsSettings.Location = new System.Drawing.Point(15, 42);
|
||||
this.groupBoxMsSettings.Name = "groupBoxMsSettings";
|
||||
this.groupBoxMsSettings.Size = new System.Drawing.Size(391, 320);
|
||||
this.groupBoxMsSettings.Size = new System.Drawing.Size(391, 375);
|
||||
this.groupBoxMsSettings.TabIndex = 15;
|
||||
this.groupBoxMsSettings.TabStop = false;
|
||||
this.groupBoxMsSettings.Text = "Settings";
|
||||
//
|
||||
// buttonTestVoice
|
||||
//
|
||||
this.buttonTestVoice.Location = new System.Drawing.Point(17, 92);
|
||||
this.buttonTestVoice.Location = new System.Drawing.Point(17, 158);
|
||||
this.buttonTestVoice.Name = "buttonTestVoice";
|
||||
this.buttonTestVoice.Size = new System.Drawing.Size(150, 23);
|
||||
this.buttonTestVoice.TabIndex = 17;
|
||||
@ -130,10 +132,9 @@
|
||||
//
|
||||
// labelMsVoice
|
||||
//
|
||||
this.labelMsVoice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.labelMsVoice.AutoSize = true;
|
||||
this.labelMsVoice.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.labelMsVoice.Location = new System.Drawing.Point(14, 25);
|
||||
this.labelMsVoice.Location = new System.Drawing.Point(14, 108);
|
||||
this.labelMsVoice.Name = "labelMsVoice";
|
||||
this.labelMsVoice.Size = new System.Drawing.Size(34, 13);
|
||||
this.labelMsVoice.TabIndex = 16;
|
||||
@ -141,11 +142,10 @@
|
||||
//
|
||||
// checkBoxAddToVideoFile
|
||||
//
|
||||
this.checkBoxAddToVideoFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.checkBoxAddToVideoFile.AutoSize = true;
|
||||
this.checkBoxAddToVideoFile.Checked = true;
|
||||
this.checkBoxAddToVideoFile.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.checkBoxAddToVideoFile.Location = new System.Drawing.Point(614, 397);
|
||||
this.checkBoxAddToVideoFile.Location = new System.Drawing.Point(6, 286);
|
||||
this.checkBoxAddToVideoFile.Name = "checkBoxAddToVideoFile";
|
||||
this.checkBoxAddToVideoFile.Size = new System.Drawing.Size(176, 17);
|
||||
this.checkBoxAddToVideoFile.TabIndex = 16;
|
||||
@ -164,9 +164,9 @@
|
||||
this.listView1.FullRowSelect = true;
|
||||
this.listView1.GridLines = true;
|
||||
this.listView1.HideSelection = false;
|
||||
this.listView1.Location = new System.Drawing.Point(12, 28);
|
||||
this.listView1.Location = new System.Drawing.Point(412, 42);
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.Size = new System.Drawing.Size(421, 349);
|
||||
this.listView1.Size = new System.Drawing.Size(430, 375);
|
||||
this.listView1.TabIndex = 17;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
this.listView1.View = System.Windows.Forms.View.Details;
|
||||
@ -186,9 +186,21 @@
|
||||
this.contextMenuStripActors.Name = "contextMenuStripActors";
|
||||
this.contextMenuStripActors.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// TextBoxTest
|
||||
//
|
||||
this.TextBoxTest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TextBoxTest.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
|
||||
this.TextBoxTest.Location = new System.Drawing.Point(17, 187);
|
||||
this.TextBoxTest.Name = "TextBoxTest";
|
||||
this.TextBoxTest.Size = new System.Drawing.Size(351, 20);
|
||||
this.TextBoxTest.TabIndex = 18;
|
||||
this.TextBoxTest.Text = "Hello, how are you?";
|
||||
//
|
||||
// nikseComboBoxVoice
|
||||
//
|
||||
this.nikseComboBoxVoice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nikseComboBoxVoice.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nikseComboBoxVoice.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.nikseComboBoxVoice.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.nikseComboBoxVoice.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179)))));
|
||||
@ -200,7 +212,7 @@
|
||||
this.nikseComboBoxVoice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.nikseComboBoxVoice.DropDownWidth = 0;
|
||||
this.nikseComboBoxVoice.FormattingEnabled = false;
|
||||
this.nikseComboBoxVoice.Location = new System.Drawing.Point(17, 41);
|
||||
this.nikseComboBoxVoice.Location = new System.Drawing.Point(17, 124);
|
||||
this.nikseComboBoxVoice.MaxLength = 32767;
|
||||
this.nikseComboBoxVoice.Name = "nikseComboBoxVoice";
|
||||
this.nikseComboBoxVoice.SelectedIndex = -1;
|
||||
@ -212,7 +224,8 @@
|
||||
//
|
||||
// nikseComboBoxEngine
|
||||
//
|
||||
this.nikseComboBoxEngine.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nikseComboBoxEngine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nikseComboBoxEngine.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.nikseComboBoxEngine.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.nikseComboBoxEngine.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179)))));
|
||||
@ -224,38 +237,26 @@
|
||||
this.nikseComboBoxEngine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
|
||||
this.nikseComboBoxEngine.DropDownWidth = 391;
|
||||
this.nikseComboBoxEngine.FormattingEnabled = false;
|
||||
this.nikseComboBoxEngine.Location = new System.Drawing.Point(451, 28);
|
||||
this.nikseComboBoxEngine.Location = new System.Drawing.Point(17, 40);
|
||||
this.nikseComboBoxEngine.MaxLength = 32767;
|
||||
this.nikseComboBoxEngine.Name = "nikseComboBoxEngine";
|
||||
this.nikseComboBoxEngine.SelectedIndex = -1;
|
||||
this.nikseComboBoxEngine.SelectedItem = null;
|
||||
this.nikseComboBoxEngine.SelectedText = "";
|
||||
this.nikseComboBoxEngine.Size = new System.Drawing.Size(391, 23);
|
||||
this.nikseComboBoxEngine.Size = new System.Drawing.Size(351, 23);
|
||||
this.nikseComboBoxEngine.TabIndex = 13;
|
||||
this.nikseComboBoxEngine.TabStop = false;
|
||||
this.nikseComboBoxEngine.Text = "nikseComboBox1";
|
||||
this.nikseComboBoxEngine.UsePopupWindow = false;
|
||||
this.nikseComboBoxEngine.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxEngine_SelectedIndexChanged);
|
||||
//
|
||||
// TextBoxTest
|
||||
//
|
||||
this.TextBoxTest.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
|
||||
this.TextBoxTest.Location = new System.Drawing.Point(17, 121);
|
||||
this.TextBoxTest.Name = "TextBoxTest";
|
||||
this.TextBoxTest.Size = new System.Drawing.Size(351, 20);
|
||||
this.TextBoxTest.TabIndex = 18;
|
||||
this.TextBoxTest.Text = "Hello, how are you?";
|
||||
//
|
||||
// TextToSpeech
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(854, 491);
|
||||
this.Controls.Add(this.listView1);
|
||||
this.Controls.Add(this.checkBoxAddToVideoFile);
|
||||
this.Controls.Add(this.groupBoxMsSettings);
|
||||
this.Controls.Add(this.labelEngine);
|
||||
this.Controls.Add(this.nikseComboBoxEngine);
|
||||
this.Controls.Add(this.progressBar1);
|
||||
this.Controls.Add(this.buttonGenerateTTS);
|
||||
this.Controls.Add(this.labelProgress);
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Speech.Synthesis;
|
||||
@ -13,7 +14,7 @@ using MessageBox = Nikse.SubtitleEdit.Forms.SeMsgBox.MessageBox;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms.Tts
|
||||
{
|
||||
public partial class TextToSpeech : Form
|
||||
public sealed partial class TextToSpeech : Form
|
||||
{
|
||||
private readonly Subtitle _subtitle;
|
||||
private readonly string _videoFileName;
|
||||
@ -22,6 +23,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts
|
||||
private readonly List<ActorAndVoice> _actorAndVoices;
|
||||
private readonly SubtitleFormat _subtitleFormat;
|
||||
private bool _abort;
|
||||
private readonly List<string> _actors;
|
||||
|
||||
public class ActorAndVoice
|
||||
{
|
||||
@ -42,6 +44,12 @@ namespace Nikse.SubtitleEdit.Forms.Tts
|
||||
_videoFileName = videoFileName;
|
||||
_videoInfo = videoInfo;
|
||||
|
||||
_actors = _subtitle.Paragraphs
|
||||
.Where(p => !string.IsNullOrEmpty(p.Actor))
|
||||
.Select(p => p.Actor)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
buttonOK.Text = LanguageSettings.Current.General.Ok;
|
||||
UiUtil.FixLargeFonts(this, buttonOK);
|
||||
|
||||
@ -59,6 +67,19 @@ namespace Nikse.SubtitleEdit.Forms.Tts
|
||||
|
||||
listView1.Visible = false;
|
||||
nikseComboBoxEngine_SelectedIndexChanged(null, null);
|
||||
|
||||
if (!SubtitleFormatHasActors() || !_actors.Any())
|
||||
{
|
||||
var w = groupBoxMsSettings.Width + 100;
|
||||
var right = buttonOK.Right;
|
||||
groupBoxMsSettings.Left = progressBar1.Left;
|
||||
groupBoxMsSettings.Width = right - progressBar1.Left;
|
||||
groupBoxMsSettings.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
|
||||
|
||||
Width = w;
|
||||
MinimumSize = new Size(w, MinimumSize.Height);
|
||||
Width = w;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetActor(ActorAndVoice actor)
|
||||
@ -562,7 +583,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts
|
||||
var pythonExe = Path.Combine(pythonFolder, pythonFolderVersionFolder[0], "python.exe");
|
||||
if (!File.Exists(pythonExe))
|
||||
{
|
||||
pythonExe = "python.exe";
|
||||
pythonExe = Configuration.IsRunningOnWindows ? "python.exe" : "python";
|
||||
}
|
||||
|
||||
progressBar1.Value = 0;
|
||||
@ -696,16 +717,11 @@ namespace Nikse.SubtitleEdit.Forms.Tts
|
||||
|
||||
_actorAndVoices.Clear();
|
||||
|
||||
if (_subtitleFormat.GetType() == typeof(AdvancedSubStationAlpha))
|
||||
if (SubtitleFormatHasActors())
|
||||
{
|
||||
var actors = _subtitle.Paragraphs
|
||||
.Where(p => !string.IsNullOrEmpty(p.Actor))
|
||||
.Select(p => p.Actor)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
if (actors.Any())
|
||||
if (_actors.Any())
|
||||
{
|
||||
foreach (var actor in actors)
|
||||
foreach (var actor in _actors)
|
||||
{
|
||||
var actorAndVoice = new ActorAndVoice
|
||||
{
|
||||
@ -739,6 +755,15 @@ namespace Nikse.SubtitleEdit.Forms.Tts
|
||||
}
|
||||
}
|
||||
|
||||
private bool SubtitleFormatHasActors()
|
||||
{
|
||||
var formatType = _subtitleFormat.GetType();
|
||||
return formatType == typeof(AdvancedSubStationAlpha) ||
|
||||
formatType == typeof(SubStationAlpha) ||
|
||||
formatType == typeof(WebVTTFileWithLineNumber) ||
|
||||
formatType == typeof(WebVTT);
|
||||
}
|
||||
|
||||
private void TextToSpeech_ResizeEnd(object sender, EventArgs e)
|
||||
{
|
||||
listView1.AutoSizeLastColumn();
|
||||
|
@ -2035,6 +2035,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
RemoveOrExportShotChanges = "Remove/export shot changes...",
|
||||
WaveformBatchGenerate = "Batch generate waveforms...",
|
||||
ShowHideWaveformAndSpectrogram = "Show/hide waveform and spectrogram",
|
||||
TextToSpeechAndAddToVideo = "Text to speech and add to video...",
|
||||
UnDockVideoControls = "Un-dock video controls",
|
||||
ReDockVideoControls = "Re-dock video controls",
|
||||
},
|
||||
|
@ -1845,6 +1845,7 @@
|
||||
public string RemoveOrExportShotChanges { get; set; }
|
||||
public string WaveformBatchGenerate { get; set; }
|
||||
public string ShowHideWaveformAndSpectrogram { get; set; }
|
||||
public string TextToSpeechAndAddToVideo { get; set; }
|
||||
public string UnDockVideoControls { get; set; }
|
||||
public string ReDockVideoControls { get; set; }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user