Add audio settings for TTS final video file

This commit is contained in:
Nikolaj Olsson 2024-06-09 08:57:23 +02:00
parent ecafda8394
commit 93367dd9d7
12 changed files with 529 additions and 124 deletions

View File

@ -199,6 +199,9 @@ namespace Nikse.SubtitleEdit.Core.Common
public string TextToSpeechAzureApiKey { get; set; } public string TextToSpeechAzureApiKey { get; set; }
public string TextToSpeechAzureRegion { get; set; } public string TextToSpeechAzureRegion { get; set; }
public bool TextToSpeechPreview { get; set; } public bool TextToSpeechPreview { get; set; }
public bool TextToSpeechCustomAudio { get; set; }
public bool TextToSpeechCustomAudioStereo { get; set; }
public string TextToSpeechCustomAudioEncoding { get; set; }
public bool TextToSpeechAddToVideoFile { get; set; } public bool TextToSpeechAddToVideoFile { get; set; }
public bool ListViewSyntaxColorDurationSmall { get; set; } public bool ListViewSyntaxColorDurationSmall { get; set; }
public bool ListViewSyntaxColorDurationBig { get; set; } public bool ListViewSyntaxColorDurationBig { get; set; }
@ -5538,6 +5541,24 @@ $HorzAlign = Center
settings.Tools.TextToSpeechPreview = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture); settings.Tools.TextToSpeechPreview = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture);
} }
subNode = node.SelectSingleNode("TextToSpeechCustomAudio");
if (subNode != null)
{
settings.Tools.TextToSpeechCustomAudio = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture);
}
subNode = node.SelectSingleNode("TextToSpeechCustomAudioStereo");
if (subNode != null)
{
settings.Tools.TextToSpeechCustomAudioStereo = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture);
}
subNode = node.SelectSingleNode("TextToSpeechCustomAudioEncoding");
if (subNode != null)
{
settings.Tools.TextToSpeechCustomAudioEncoding = subNode.InnerText;
}
subNode = node.SelectSingleNode("TextToSpeechAddToVideoFile"); subNode = node.SelectSingleNode("TextToSpeechAddToVideoFile");
if (subNode != null) if (subNode != null)
{ {
@ -12092,6 +12113,9 @@ $HorzAlign = Center
textWriter.WriteElementString("TextToSpeechAzureApiKey", settings.Tools.TextToSpeechAzureApiKey); textWriter.WriteElementString("TextToSpeechAzureApiKey", settings.Tools.TextToSpeechAzureApiKey);
textWriter.WriteElementString("TextToSpeechAzureRegion", settings.Tools.TextToSpeechAzureRegion); textWriter.WriteElementString("TextToSpeechAzureRegion", settings.Tools.TextToSpeechAzureRegion);
textWriter.WriteElementString("TextToSpeechPreview", settings.Tools.TextToSpeechPreview.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("TextToSpeechPreview", settings.Tools.TextToSpeechPreview.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("TextToSpeechCustomAudio", settings.Tools.TextToSpeechCustomAudio.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("TextToSpeechCustomAudioStereo", settings.Tools.TextToSpeechCustomAudioStereo.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("TextToSpeechCustomAudioEncoding", settings.Tools.TextToSpeechCustomAudioEncoding);
textWriter.WriteElementString("TextToSpeechAddToVideoFile", settings.Tools.TextToSpeechAddToVideoFile.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("TextToSpeechAddToVideoFile", settings.Tools.TextToSpeechAddToVideoFile.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ListViewSyntaxColorDurationSmall", settings.Tools.ListViewSyntaxColorDurationSmall.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("ListViewSyntaxColorDurationSmall", settings.Tools.ListViewSyntaxColorDurationSmall.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ListViewSyntaxColorDurationBig", settings.Tools.ListViewSyntaxColorDurationBig.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("ListViewSyntaxColorDurationBig", settings.Tools.ListViewSyntaxColorDurationBig.ToString(CultureInfo.InvariantCulture));

View File

@ -1086,7 +1086,7 @@ namespace Nikse.SubtitleEdit.Forms
private void AudioWaveform_OnSingleClick(object sender, AudioVisualizer.ParagraphEventArgs e) private void AudioWaveform_OnSingleClick(object sender, AudioVisualizer.ParagraphEventArgs e)
{ {
timerWaveform.Stop(); timerWaveform?.Stop();
ResetPlaySelection(); ResetPlaySelection();
if (mediaPlayer.VideoPlayer != null) if (mediaPlayer.VideoPlayer != null)
{ {
@ -1108,7 +1108,7 @@ namespace Nikse.SubtitleEdit.Forms
SelectListViewIndexAndEnsureVisible(_subtitle.GetIndex(e.Paragraph)); SelectListViewIndexAndEnsureVisible(_subtitle.GetIndex(e.Paragraph));
} }
timerWaveform.Start(); timerWaveform?.Start();
} }
private void AudioWaveform_OnParagraphRightClicked(object sender, AudioVisualizer.ParagraphEventArgs e) private void AudioWaveform_OnParagraphRightClicked(object sender, AudioVisualizer.ParagraphEventArgs e)

View File

@ -91,13 +91,19 @@ namespace Nikse.SubtitleEdit.Forms.Translate
{ {
if (nikseTextBoxPrompt.Text.Contains('{')) if (nikseTextBoxPrompt.Text.Contains('{'))
{ {
MessageBox.Show("Character not allowed: {"); MessageBox.Show("Character not allowed in prompt: {");
return; return;
} }
if (nikseTextBoxPrompt.Text.Contains('}')) if (nikseTextBoxPrompt.Text.Contains('}'))
{ {
MessageBox.Show("Character not allowed: }"); MessageBox.Show("Character not allowed in prompt: }");
return;
}
if (nikseTextBoxPrompt.Text.Length > 1000)
{
MessageBox.Show("Too many characters in prompt");
return; return;
} }

View File

@ -35,26 +35,28 @@
this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.labelEngine = new System.Windows.Forms.Label(); this.labelEngine = new System.Windows.Forms.Label();
this.groupBoxSettings = new System.Windows.Forms.GroupBox(); this.groupBoxSettings = new System.Windows.Forms.GroupBox();
this.linkLabelCustomAudio = new System.Windows.Forms.LinkLabel();
this.checkBoxAudioEncoding = new System.Windows.Forms.CheckBox();
this.labelRegion = new System.Windows.Forms.Label(); this.labelRegion = new System.Windows.Forms.Label();
this.nikseComboBoxRegion = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.labelVoiceCount = new System.Windows.Forms.Label(); this.labelVoiceCount = new System.Windows.Forms.Label();
this.checkBoxShowPreview = new System.Windows.Forms.CheckBox(); this.checkBoxShowPreview = new System.Windows.Forms.CheckBox();
this.labelApiKey = new System.Windows.Forms.Label(); this.labelApiKey = new System.Windows.Forms.Label();
this.nikseTextBoxApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox();
this.TextBoxTest = new Nikse.SubtitleEdit.Controls.NikseTextBox();
this.buttonTestVoice = new System.Windows.Forms.Button(); this.buttonTestVoice = new System.Windows.Forms.Button();
this.checkBoxAddToVideoFile = new System.Windows.Forms.CheckBox(); this.checkBoxAddToVideoFile = new System.Windows.Forms.CheckBox();
this.labelVoice = new System.Windows.Forms.Label(); this.labelVoice = new System.Windows.Forms.Label();
this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.contextMenuStripVoices = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStripVoices = new System.Windows.Forms.ContextMenuStrip(this.components);
this.refreshVoicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.refreshVoicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.listViewActors = new System.Windows.Forms.ListView(); this.listViewActors = new System.Windows.Forms.ListView();
this.columnHeaderActor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderActor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderVoice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderVoice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.contextMenuStripActors = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStripActors = new System.Windows.Forms.ContextMenuStrip(this.components);
this.labelActors = new System.Windows.Forms.Label(); this.labelActors = new System.Windows.Forms.Label();
this.buttonCancel = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button();
this.nikseComboBoxRegion = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.nikseTextBoxApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox();
this.TextBoxTest = new Nikse.SubtitleEdit.Controls.NikseTextBox();
this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.groupBoxSettings.SuspendLayout(); this.groupBoxSettings.SuspendLayout();
this.contextMenuStripVoices.SuspendLayout(); this.contextMenuStripVoices.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -63,7 +65,7 @@
// //
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(686, 456); this.buttonOK.Location = new System.Drawing.Point(720, 486);
this.buttonOK.Name = "buttonOK"; this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 100; this.buttonOK.TabIndex = 100;
@ -76,7 +78,7 @@
this.labelProgress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.labelProgress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelProgress.AutoSize = true; this.labelProgress.AutoSize = true;
this.labelProgress.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.labelProgress.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.labelProgress.Location = new System.Drawing.Point(12, 433); this.labelProgress.Location = new System.Drawing.Point(12, 463);
this.labelProgress.Name = "labelProgress"; this.labelProgress.Name = "labelProgress";
this.labelProgress.Size = new System.Drawing.Size(70, 13); this.labelProgress.Size = new System.Drawing.Size(70, 13);
this.labelProgress.TabIndex = 9; this.labelProgress.TabIndex = 9;
@ -86,7 +88,7 @@
// //
this.buttonGenerateTTS.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonGenerateTTS.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonGenerateTTS.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonGenerateTTS.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonGenerateTTS.Location = new System.Drawing.Point(614, 423); this.buttonGenerateTTS.Location = new System.Drawing.Point(648, 453);
this.buttonGenerateTTS.Name = "buttonGenerateTTS"; this.buttonGenerateTTS.Name = "buttonGenerateTTS";
this.buttonGenerateTTS.Size = new System.Drawing.Size(228, 23); this.buttonGenerateTTS.Size = new System.Drawing.Size(228, 23);
this.buttonGenerateTTS.TabIndex = 90; this.buttonGenerateTTS.TabIndex = 90;
@ -98,9 +100,9 @@
// //
this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.progressBar1.Location = new System.Drawing.Point(12, 456); this.progressBar1.Location = new System.Drawing.Point(12, 486);
this.progressBar1.Name = "progressBar1"; this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(665, 10); this.progressBar1.Size = new System.Drawing.Size(699, 10);
this.progressBar1.TabIndex = 12; this.progressBar1.TabIndex = 12;
// //
// labelEngine // labelEngine
@ -117,6 +119,8 @@
// //
this.groupBoxSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.groupBoxSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left))); | System.Windows.Forms.AnchorStyles.Left)));
this.groupBoxSettings.Controls.Add(this.linkLabelCustomAudio);
this.groupBoxSettings.Controls.Add(this.checkBoxAudioEncoding);
this.groupBoxSettings.Controls.Add(this.labelRegion); this.groupBoxSettings.Controls.Add(this.labelRegion);
this.groupBoxSettings.Controls.Add(this.nikseComboBoxRegion); this.groupBoxSettings.Controls.Add(this.nikseComboBoxRegion);
this.groupBoxSettings.Controls.Add(this.labelVoiceCount); this.groupBoxSettings.Controls.Add(this.labelVoiceCount);
@ -132,11 +136,34 @@
this.groupBoxSettings.Controls.Add(this.nikseComboBoxEngine); this.groupBoxSettings.Controls.Add(this.nikseComboBoxEngine);
this.groupBoxSettings.Location = new System.Drawing.Point(15, 12); this.groupBoxSettings.Location = new System.Drawing.Point(15, 12);
this.groupBoxSettings.Name = "groupBoxSettings"; this.groupBoxSettings.Name = "groupBoxSettings";
this.groupBoxSettings.Size = new System.Drawing.Size(391, 405); this.groupBoxSettings.Size = new System.Drawing.Size(391, 435);
this.groupBoxSettings.TabIndex = 1; this.groupBoxSettings.TabIndex = 1;
this.groupBoxSettings.TabStop = false; this.groupBoxSettings.TabStop = false;
this.groupBoxSettings.Text = "Settings"; this.groupBoxSettings.Text = "Settings";
// //
// linkLabelCustomAudio
//
this.linkLabelCustomAudio.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.linkLabelCustomAudio.AutoSize = true;
this.linkLabelCustomAudio.Location = new System.Drawing.Point(169, 400);
this.linkLabelCustomAudio.Name = "linkLabelCustomAudio";
this.linkLabelCustomAudio.Size = new System.Drawing.Size(45, 13);
this.linkLabelCustomAudio.TabIndex = 34;
this.linkLabelCustomAudio.TabStop = true;
this.linkLabelCustomAudio.Text = "Settings";
this.linkLabelCustomAudio.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelCustomAudio_LinkClicked);
//
// checkBoxAudioEncoding
//
this.checkBoxAudioEncoding.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkBoxAudioEncoding.AutoSize = true;
this.checkBoxAudioEncoding.Location = new System.Drawing.Point(32, 401);
this.checkBoxAudioEncoding.Name = "checkBoxAudioEncoding";
this.checkBoxAudioEncoding.Size = new System.Drawing.Size(137, 17);
this.checkBoxAudioEncoding.TabIndex = 33;
this.checkBoxAudioEncoding.Text = "Custom audio encoding";
this.checkBoxAudioEncoding.UseVisualStyleBackColor = true;
//
// labelRegion // labelRegion
// //
this.labelRegion.AutoSize = true; this.labelRegion.AutoSize = true;
@ -147,31 +174,6 @@
this.labelRegion.TabIndex = 32; this.labelRegion.TabIndex = 32;
this.labelRegion.Text = "Region"; this.labelRegion.Text = "Region";
// //
// nikseComboBoxRegion
//
this.nikseComboBoxRegion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nikseComboBoxRegion.BackColor = System.Drawing.SystemColors.Window;
this.nikseComboBoxRegion.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
this.nikseComboBoxRegion.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179)))));
this.nikseComboBoxRegion.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
this.nikseComboBoxRegion.ButtonForeColor = System.Drawing.SystemColors.ControlText;
this.nikseComboBoxRegion.ButtonForeColorDown = System.Drawing.Color.Orange;
this.nikseComboBoxRegion.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.nikseComboBoxRegion.DropDownHeight = 400;
this.nikseComboBoxRegion.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.nikseComboBoxRegion.DropDownWidth = 0;
this.nikseComboBoxRegion.FormattingEnabled = false;
this.nikseComboBoxRegion.Location = new System.Drawing.Point(17, 286);
this.nikseComboBoxRegion.MaxLength = 32767;
this.nikseComboBoxRegion.Name = "nikseComboBoxRegion";
this.nikseComboBoxRegion.SelectedIndex = -1;
this.nikseComboBoxRegion.SelectedItem = null;
this.nikseComboBoxRegion.SelectedText = "";
this.nikseComboBoxRegion.Size = new System.Drawing.Size(351, 23);
this.nikseComboBoxRegion.TabIndex = 31;
this.nikseComboBoxRegion.UsePopupWindow = false;
//
// labelVoiceCount // labelVoiceCount
// //
this.labelVoiceCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelVoiceCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -188,7 +190,7 @@
this.checkBoxShowPreview.AutoSize = true; this.checkBoxShowPreview.AutoSize = true;
this.checkBoxShowPreview.Checked = true; this.checkBoxShowPreview.Checked = true;
this.checkBoxShowPreview.CheckState = System.Windows.Forms.CheckState.Checked; this.checkBoxShowPreview.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxShowPreview.Location = new System.Drawing.Point(17, 333); this.checkBoxShowPreview.Location = new System.Drawing.Point(17, 352);
this.checkBoxShowPreview.Name = "checkBoxShowPreview"; this.checkBoxShowPreview.Name = "checkBoxShowPreview";
this.checkBoxShowPreview.Size = new System.Drawing.Size(115, 17); this.checkBoxShowPreview.Size = new System.Drawing.Size(115, 17);
this.checkBoxShowPreview.TabIndex = 25; this.checkBoxShowPreview.TabIndex = 25;
@ -205,28 +207,6 @@
this.labelApiKey.TabIndex = 28; this.labelApiKey.TabIndex = 28;
this.labelApiKey.Text = "API key"; this.labelApiKey.Text = "API key";
// //
// nikseTextBoxApiKey
//
this.nikseTextBoxApiKey.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nikseTextBoxApiKey.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.nikseTextBoxApiKey.Location = new System.Drawing.Point(17, 237);
this.nikseTextBoxApiKey.Name = "nikseTextBoxApiKey";
this.nikseTextBoxApiKey.Size = new System.Drawing.Size(351, 20);
this.nikseTextBoxApiKey.TabIndex = 27;
//
// 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, 172);
this.TextBoxTest.Name = "TextBoxTest";
this.TextBoxTest.Size = new System.Drawing.Size(351, 20);
this.TextBoxTest.TabIndex = 20;
this.TextBoxTest.Text = "Hello, how are you?";
this.TextBoxTest.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxTest_KeyDown);
//
// buttonTestVoice // buttonTestVoice
// //
this.buttonTestVoice.Location = new System.Drawing.Point(17, 141); this.buttonTestVoice.Location = new System.Drawing.Point(17, 141);
@ -243,7 +223,7 @@
this.checkBoxAddToVideoFile.AutoSize = true; this.checkBoxAddToVideoFile.AutoSize = true;
this.checkBoxAddToVideoFile.Checked = true; this.checkBoxAddToVideoFile.Checked = true;
this.checkBoxAddToVideoFile.CheckState = System.Windows.Forms.CheckState.Checked; this.checkBoxAddToVideoFile.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxAddToVideoFile.Location = new System.Drawing.Point(17, 357); this.checkBoxAddToVideoFile.Location = new System.Drawing.Point(17, 376);
this.checkBoxAddToVideoFile.Name = "checkBoxAddToVideoFile"; this.checkBoxAddToVideoFile.Name = "checkBoxAddToVideoFile";
this.checkBoxAddToVideoFile.Size = new System.Drawing.Size(176, 17); this.checkBoxAddToVideoFile.Size = new System.Drawing.Size(176, 17);
this.checkBoxAddToVideoFile.TabIndex = 26; this.checkBoxAddToVideoFile.TabIndex = 26;
@ -260,32 +240,6 @@
this.labelVoice.TabIndex = 16; this.labelVoice.TabIndex = 16;
this.labelVoice.Text = "Voice"; this.labelVoice.Text = "Voice";
// //
// nikseComboBoxVoice
//
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)))));
this.nikseComboBoxVoice.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
this.nikseComboBoxVoice.ButtonForeColor = System.Drawing.SystemColors.ControlText;
this.nikseComboBoxVoice.ButtonForeColorDown = System.Drawing.Color.Orange;
this.nikseComboBoxVoice.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.nikseComboBoxVoice.ContextMenuStrip = this.contextMenuStripVoices;
this.nikseComboBoxVoice.DropDownHeight = 400;
this.nikseComboBoxVoice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.nikseComboBoxVoice.DropDownWidth = 0;
this.nikseComboBoxVoice.FormattingEnabled = false;
this.nikseComboBoxVoice.Location = new System.Drawing.Point(17, 110);
this.nikseComboBoxVoice.MaxLength = 32767;
this.nikseComboBoxVoice.Name = "nikseComboBoxVoice";
this.nikseComboBoxVoice.SelectedIndex = -1;
this.nikseComboBoxVoice.SelectedItem = null;
this.nikseComboBoxVoice.SelectedText = "";
this.nikseComboBoxVoice.Size = new System.Drawing.Size(351, 23);
this.nikseComboBoxVoice.TabIndex = 10;
this.nikseComboBoxVoice.UsePopupWindow = false;
//
// contextMenuStripVoices // contextMenuStripVoices
// //
this.contextMenuStripVoices.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contextMenuStripVoices.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -301,33 +255,6 @@
this.refreshVoicesToolStripMenuItem.Text = "Refresh voices"; this.refreshVoicesToolStripMenuItem.Text = "Refresh voices";
this.refreshVoicesToolStripMenuItem.Click += new System.EventHandler(this.refreshVoicesToolStripMenuItem_Click); this.refreshVoicesToolStripMenuItem.Click += new System.EventHandler(this.refreshVoicesToolStripMenuItem_Click);
// //
// nikseComboBoxEngine
//
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)))));
this.nikseComboBoxEngine.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
this.nikseComboBoxEngine.ButtonForeColor = System.Drawing.SystemColors.ControlText;
this.nikseComboBoxEngine.ButtonForeColorDown = System.Drawing.Color.Orange;
this.nikseComboBoxEngine.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.nikseComboBoxEngine.DropDownHeight = 400;
this.nikseComboBoxEngine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
this.nikseComboBoxEngine.DropDownWidth = 391;
this.nikseComboBoxEngine.FormattingEnabled = false;
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(351, 23);
this.nikseComboBoxEngine.TabIndex = 5;
this.nikseComboBoxEngine.TabStop = false;
this.nikseComboBoxEngine.Text = "nikseComboBox1";
this.nikseComboBoxEngine.UsePopupWindow = false;
//
// listViewActors // listViewActors
// //
this.listViewActors.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.listViewActors.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -342,7 +269,7 @@
this.listViewActors.HideSelection = false; this.listViewActors.HideSelection = false;
this.listViewActors.Location = new System.Drawing.Point(412, 42); this.listViewActors.Location = new System.Drawing.Point(412, 42);
this.listViewActors.Name = "listViewActors"; this.listViewActors.Name = "listViewActors";
this.listViewActors.Size = new System.Drawing.Size(430, 375); this.listViewActors.Size = new System.Drawing.Size(464, 405);
this.listViewActors.TabIndex = 40; this.listViewActors.TabIndex = 40;
this.listViewActors.UseCompatibleStateImageBehavior = false; this.listViewActors.UseCompatibleStateImageBehavior = false;
this.listViewActors.View = System.Windows.Forms.View.Details; this.listViewActors.View = System.Windows.Forms.View.Details;
@ -377,7 +304,7 @@
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(767, 456); this.buttonCancel.Location = new System.Drawing.Point(801, 486);
this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 101; this.buttonCancel.TabIndex = 101;
@ -385,11 +312,111 @@
this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
// //
// nikseComboBoxRegion
//
this.nikseComboBoxRegion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nikseComboBoxRegion.BackColor = System.Drawing.SystemColors.Window;
this.nikseComboBoxRegion.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
this.nikseComboBoxRegion.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179)))));
this.nikseComboBoxRegion.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
this.nikseComboBoxRegion.ButtonForeColor = System.Drawing.SystemColors.ControlText;
this.nikseComboBoxRegion.ButtonForeColorDown = System.Drawing.Color.Orange;
this.nikseComboBoxRegion.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.nikseComboBoxRegion.DropDownHeight = 400;
this.nikseComboBoxRegion.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.nikseComboBoxRegion.DropDownWidth = 0;
this.nikseComboBoxRegion.FormattingEnabled = false;
this.nikseComboBoxRegion.Location = new System.Drawing.Point(17, 286);
this.nikseComboBoxRegion.MaxLength = 32767;
this.nikseComboBoxRegion.Name = "nikseComboBoxRegion";
this.nikseComboBoxRegion.SelectedIndex = -1;
this.nikseComboBoxRegion.SelectedItem = null;
this.nikseComboBoxRegion.SelectedText = "";
this.nikseComboBoxRegion.Size = new System.Drawing.Size(351, 23);
this.nikseComboBoxRegion.TabIndex = 31;
this.nikseComboBoxRegion.UsePopupWindow = false;
//
// nikseTextBoxApiKey
//
this.nikseTextBoxApiKey.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nikseTextBoxApiKey.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.nikseTextBoxApiKey.Location = new System.Drawing.Point(17, 237);
this.nikseTextBoxApiKey.Name = "nikseTextBoxApiKey";
this.nikseTextBoxApiKey.Size = new System.Drawing.Size(351, 20);
this.nikseTextBoxApiKey.TabIndex = 27;
//
// 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, 172);
this.TextBoxTest.Name = "TextBoxTest";
this.TextBoxTest.Size = new System.Drawing.Size(351, 20);
this.TextBoxTest.TabIndex = 20;
this.TextBoxTest.Text = "Hello, how are you?";
this.TextBoxTest.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxTest_KeyDown);
//
// nikseComboBoxVoice
//
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)))));
this.nikseComboBoxVoice.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
this.nikseComboBoxVoice.ButtonForeColor = System.Drawing.SystemColors.ControlText;
this.nikseComboBoxVoice.ButtonForeColorDown = System.Drawing.Color.Orange;
this.nikseComboBoxVoice.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.nikseComboBoxVoice.ContextMenuStrip = this.contextMenuStripVoices;
this.nikseComboBoxVoice.DropDownHeight = 400;
this.nikseComboBoxVoice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.nikseComboBoxVoice.DropDownWidth = 0;
this.nikseComboBoxVoice.FormattingEnabled = false;
this.nikseComboBoxVoice.Location = new System.Drawing.Point(17, 110);
this.nikseComboBoxVoice.MaxLength = 32767;
this.nikseComboBoxVoice.Name = "nikseComboBoxVoice";
this.nikseComboBoxVoice.SelectedIndex = -1;
this.nikseComboBoxVoice.SelectedItem = null;
this.nikseComboBoxVoice.SelectedText = "";
this.nikseComboBoxVoice.Size = new System.Drawing.Size(351, 23);
this.nikseComboBoxVoice.TabIndex = 10;
this.nikseComboBoxVoice.UsePopupWindow = false;
//
// nikseComboBoxEngine
//
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)))));
this.nikseComboBoxEngine.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
this.nikseComboBoxEngine.ButtonForeColor = System.Drawing.SystemColors.ControlText;
this.nikseComboBoxEngine.ButtonForeColorDown = System.Drawing.Color.Orange;
this.nikseComboBoxEngine.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.nikseComboBoxEngine.DropDownHeight = 400;
this.nikseComboBoxEngine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
this.nikseComboBoxEngine.DropDownWidth = 391;
this.nikseComboBoxEngine.FormattingEnabled = false;
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(351, 23);
this.nikseComboBoxEngine.TabIndex = 5;
this.nikseComboBoxEngine.TabStop = false;
this.nikseComboBoxEngine.Text = "nikseComboBox1";
this.nikseComboBoxEngine.UsePopupWindow = false;
//
// TextToSpeech // TextToSpeech
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(854, 491); this.ClientSize = new System.Drawing.Size(888, 521);
this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.labelActors); this.Controls.Add(this.labelActors);
this.Controls.Add(this.listViewActors); this.Controls.Add(this.listViewActors);
@ -446,5 +473,7 @@
private Controls.NikseComboBox nikseComboBoxRegion; private Controls.NikseComboBox nikseComboBoxRegion;
private System.Windows.Forms.ContextMenuStrip contextMenuStripVoices; private System.Windows.Forms.ContextMenuStrip contextMenuStripVoices;
private System.Windows.Forms.ToolStripMenuItem refreshVoicesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem refreshVoicesToolStripMenuItem;
private System.Windows.Forms.CheckBox checkBoxAudioEncoding;
private System.Windows.Forms.LinkLabel linkLabelCustomAudio;
} }
} }

View File

@ -121,6 +121,9 @@ namespace Nikse.SubtitleEdit.Forms.Tts
buttonGenerateTTS.Text = LanguageSettings.Current.TextToSpeech.GenerateSpeech; buttonGenerateTTS.Text = LanguageSettings.Current.TextToSpeech.GenerateSpeech;
labelRegion.Text = LanguageSettings.Current.General.Region; labelRegion.Text = LanguageSettings.Current.General.Region;
checkBoxShowPreview.Text = LanguageSettings.Current.TextToSpeech.ReviewAudioClips; checkBoxShowPreview.Text = LanguageSettings.Current.TextToSpeech.ReviewAudioClips;
checkBoxAudioEncoding.Text = LanguageSettings.Current.TextToSpeech.CustomAudioEncoding;
linkLabelCustomAudio.Text = LanguageSettings.Current.Settings.Title;
linkLabelCustomAudio.Left = checkBoxAudioEncoding.Right + 3;
buttonOK.Text = LanguageSettings.Current.General.Ok; buttonOK.Text = LanguageSettings.Current.General.Ok;
buttonCancel.Text = LanguageSettings.Current.General.Cancel; buttonCancel.Text = LanguageSettings.Current.General.Cancel;
UiUtil.FixLargeFonts(this, buttonOK); UiUtil.FixLargeFonts(this, buttonOK);
@ -179,7 +182,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts
nikseComboBoxVoice.Text = Configuration.Settings.Tools.TextToSpeechLastVoice; nikseComboBoxVoice.Text = Configuration.Settings.Tools.TextToSpeechLastVoice;
checkBoxAddToVideoFile.Checked = Configuration.Settings.Tools.TextToSpeechAddToVideoFile; checkBoxAddToVideoFile.Checked = Configuration.Settings.Tools.TextToSpeechAddToVideoFile;
checkBoxShowPreview.Checked = Configuration.Settings.Tools.TextToSpeechPreview; checkBoxShowPreview.Checked = Configuration.Settings.Tools.TextToSpeechPreview;
checkBoxAudioEncoding.Checked = Configuration.Settings.Tools.TextToSpeechCustomAudio;
checkBoxAddToVideoFile.Enabled = _videoFileName != null; checkBoxAddToVideoFile.Enabled = _videoFileName != null;
} }
@ -392,7 +395,20 @@ namespace Nikse.SubtitleEdit.Forms.Tts
labelProgress.Text = "Add audio to video file..."; labelProgress.Text = "Add audio to video file...";
var outputFileName = Path.Combine(_waveFolder, Path.GetFileNameWithoutExtension(audioFileName) + videoExt); var outputFileName = Path.Combine(_waveFolder, Path.GetFileNameWithoutExtension(audioFileName) + videoExt);
var addAudioProcess = VideoPreviewGenerator.AddAudioTrack(_videoFileName, audioFileName, outputFileName);
var audioEncoding = Configuration.Settings.Tools.TextToSpeechCustomAudioEncoding;
if (string.IsNullOrWhiteSpace(audioEncoding) || !checkBoxAudioEncoding.Checked)
{
audioEncoding = string.Empty;
}
bool? stereo = null;
if (Configuration.Settings.Tools.TextToSpeechCustomAudioStereo && checkBoxAudioEncoding.Checked)
{
stereo = true;
}
var addAudioProcess = VideoPreviewGenerator.AddAudioTrack(_videoFileName, audioFileName, outputFileName, audioEncoding, stereo);
addAudioProcess.Start(); addAudioProcess.Start();
while (!addAudioProcess.HasExited) while (!addAudioProcess.HasExited)
{ {
@ -2313,5 +2329,13 @@ namespace Nikse.SubtitleEdit.Forms.Tts
Cursor = Cursors.Default; Cursor = Cursors.Default;
} }
} }
private void linkLabelCustomAudio_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
using (var form = new TtsAudioEncoding())
{
form.ShowDialog(this);
}
}
} }
} }

View File

@ -0,0 +1,147 @@
namespace Nikse.SubtitleEdit.Forms.Tts
{
sealed partial class TtsAudioEncoding
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.checkBoxMakeStereo = new System.Windows.Forms.CheckBox();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.labelAudioEnc = new Nikse.SubtitleEdit.Controls.NikseLabel();
this.comboBoxAudioEnc = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.SuspendLayout();
//
// checkBoxMakeStereo
//
this.checkBoxMakeStereo.AutoSize = true;
this.checkBoxMakeStereo.Checked = true;
this.checkBoxMakeStereo.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxMakeStereo.Location = new System.Drawing.Point(102, 50);
this.checkBoxMakeStereo.Name = "checkBoxMakeStereo";
this.checkBoxMakeStereo.Size = new System.Drawing.Size(57, 17);
this.checkBoxMakeStereo.TabIndex = 2;
this.checkBoxMakeStereo.Text = "Stereo";
this.checkBoxMakeStereo.UseVisualStyleBackColor = true;
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(179, 110);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 92;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(263, 110);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 93;
this.buttonCancel.Text = "C&ancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// labelAudioEnc
//
this.labelAudioEnc.AutoSize = true;
this.labelAudioEnc.Location = new System.Drawing.Point(25, 23);
this.labelAudioEnc.Name = "labelAudioEnc";
this.labelAudioEnc.Size = new System.Drawing.Size(52, 13);
this.labelAudioEnc.TabIndex = 0;
this.labelAudioEnc.Text = "Encoding";
//
// comboBoxAudioEnc
//
this.comboBoxAudioEnc.BackColor = System.Drawing.SystemColors.Window;
this.comboBoxAudioEnc.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
this.comboBoxAudioEnc.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179)))));
this.comboBoxAudioEnc.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
this.comboBoxAudioEnc.ButtonForeColor = System.Drawing.SystemColors.ControlText;
this.comboBoxAudioEnc.ButtonForeColorDown = System.Drawing.Color.Orange;
this.comboBoxAudioEnc.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.comboBoxAudioEnc.DropDownHeight = 400;
this.comboBoxAudioEnc.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxAudioEnc.DropDownWidth = 121;
this.comboBoxAudioEnc.FormattingEnabled = true;
this.comboBoxAudioEnc.Items.AddRange(new string[] {
"copy",
"aac",
"ac3",
"eac3",
"truehd",
"libvorbis",
"libmp3lame",
"libopus"});
this.comboBoxAudioEnc.Location = new System.Drawing.Point(102, 21);
this.comboBoxAudioEnc.MaxLength = 32767;
this.comboBoxAudioEnc.Name = "comboBoxAudioEnc";
this.comboBoxAudioEnc.SelectedIndex = -1;
this.comboBoxAudioEnc.SelectedItem = null;
this.comboBoxAudioEnc.SelectedText = "";
this.comboBoxAudioEnc.Size = new System.Drawing.Size(121, 21);
this.comboBoxAudioEnc.TabIndex = 1;
this.comboBoxAudioEnc.UsePopupWindow = false;
//
// TtsAudioEncoding
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(350, 145);
this.Controls.Add(this.labelAudioEnc);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.comboBoxAudioEnc);
this.Controls.Add(this.checkBoxMakeStereo);
this.Controls.Add(this.buttonCancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TtsAudioEncoding";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "TtsAudioEncoding";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Controls.NikseLabel labelAudioEnc;
private Controls.NikseComboBox comboBoxAudioEnc;
private System.Windows.Forms.CheckBox checkBoxMakeStereo;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
}
}

View File

@ -0,0 +1,41 @@
using Nikse.SubtitleEdit.Core.Common;
using Nikse.SubtitleEdit.Logic;
using System.Windows.Forms;
namespace Nikse.SubtitleEdit.Forms.Tts
{
public sealed partial class TtsAudioEncoding : Form
{
public TtsAudioEncoding()
{
UiUtil.PreInitialize(this);
InitializeComponent();
UiUtil.FixFonts(this);
Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Audio;
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
buttonOK.Text = LanguageSettings.Current.General.Ok;
UiUtil.FixLargeFonts(this, buttonOK);
if (string.IsNullOrWhiteSpace(Configuration.Settings.Tools.TextToSpeechCustomAudioEncoding))
{
Configuration.Settings.Tools.TextToSpeechCustomAudioEncoding = "copy";
}
checkBoxMakeStereo.Checked = Configuration.Settings.Tools.TextToSpeechCustomAudioStereo;
comboBoxAudioEnc.Text = Configuration.Settings.Tools.TextToSpeechCustomAudioEncoding;
}
private void buttonOK_Click(object sender, System.EventArgs e)
{
Configuration.Settings.Tools.TextToSpeechCustomAudioStereo = checkBoxMakeStereo.Checked;
Configuration.Settings.Tools.TextToSpeechCustomAudioEncoding = comboBoxAudioEnc.Text;
DialogResult = DialogResult.OK;
}
private void buttonCancel_Click(object sender, System.EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -3574,6 +3574,7 @@ can edit in same subtitle file (collaboration)",
GeneratingSpeechFromTextXOfY = "Generating speech from text: {0} / {1}...", GeneratingSpeechFromTextXOfY = "Generating speech from text: {0} / {1}...",
ReviewAudioClips = "Review audio clips", ReviewAudioClips = "Review audio clips",
ReviewInfo = "Review and edit/remove audio clips", ReviewInfo = "Review and edit/remove audio clips",
CustomAudioEncoding = "Custom audio encoding",
AutoContinue = "Auto-continue", AutoContinue = "Auto-continue",
Play = "Play", Play = "Play",
Regenerate = "Regenerate", Regenerate = "Regenerate",

View File

@ -3384,6 +3384,7 @@
public string MergingAudioTrackXOfY { get; set; } public string MergingAudioTrackXOfY { get; set; }
public string GeneratingSpeechFromTextXOfY { get; set; } public string GeneratingSpeechFromTextXOfY { get; set; }
public string ReviewAudioClips { get; set; } public string ReviewAudioClips { get; set; }
public string CustomAudioEncoding { get; set; }
public string ReviewInfo { get; set; } public string ReviewInfo { get; set; }
public string Play { get; set; } public string Play { get; set; }
public string AutoContinue { get; set; } public string AutoContinue { get; set; }

View File

@ -626,14 +626,17 @@ namespace Nikse.SubtitleEdit.Logic
return processMakeVideo; return processMakeVideo;
} }
public static Process AddAudioTrack(string inputFileName, string audioFileName, string outputFileName, DataReceivedEventHandler dataReceivedHandler = null) public static Process AddAudioTrack(string inputFileName, string audioFileName, string outputFileName, string audioEncoding, bool? stereo, DataReceivedEventHandler dataReceivedHandler = null)
{ {
var audioEncodingString = !string.IsNullOrEmpty(audioEncoding) ? "-c:a " + audioEncoding + " " : "-c:a copy ";
var stereoString = stereo == true ? "-ac 2 " : string.Empty;
var processMakeVideo = new Process var processMakeVideo = new Process
{ {
StartInfo = StartInfo =
{ {
FileName = GetFfmpegLocation(), FileName = GetFfmpegLocation(),
Arguments = $"-i \"{inputFileName}\" -i \"{audioFileName}\" -c copy -map 0:v:0 -map 1:a:0 \"{outputFileName}\"", Arguments = $"-i \"{inputFileName}\" -i \"{audioFileName}\" -c:v copy -map 0:v:0 -map 1:a:0 {audioEncodingString}{stereoString}\"{outputFileName}\"",
UseShellExecute = false, UseShellExecute = false,
CreateNoWindow = true CreateNoWindow = true
} }

View File

@ -1434,6 +1434,12 @@
<Compile Include="Forms\Tts\ReviewAudioClips.Designer.cs"> <Compile Include="Forms\Tts\ReviewAudioClips.Designer.cs">
<DependentUpon>ReviewAudioClips.cs</DependentUpon> <DependentUpon>ReviewAudioClips.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Forms\Tts\TtsAudioEncoding.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Tts\TtsAudioEncoding.Designer.cs">
<DependentUpon>TtsAudioEncoding.cs</DependentUpon>
</Compile>
<Compile Include="Forms\UnknownSubtitle.cs"> <Compile Include="Forms\UnknownSubtitle.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -2338,6 +2344,9 @@
<EmbeddedResource Include="Forms\Tts\ReviewAudioClips.resx"> <EmbeddedResource Include="Forms\Tts\ReviewAudioClips.resx">
<DependentUpon>ReviewAudioClips.cs</DependentUpon> <DependentUpon>ReviewAudioClips.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Forms\Tts\TtsAudioEncoding.resx">
<DependentUpon>TtsAudioEncoding.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\UnknownSubtitle.resx"> <EmbeddedResource Include="Forms\UnknownSubtitle.resx">
<DependentUpon>UnknownSubtitle.cs</DependentUpon> <DependentUpon>UnknownSubtitle.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>