diff --git a/src/libse/Common/Settings.cs b/src/libse/Common/Settings.cs index 1c2ac9891..c3b12af0d 100644 --- a/src/libse/Common/Settings.cs +++ b/src/libse/Common/Settings.cs @@ -199,6 +199,9 @@ namespace Nikse.SubtitleEdit.Core.Common public string TextToSpeechAzureApiKey { get; set; } public string TextToSpeechAzureRegion { 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 ListViewSyntaxColorDurationSmall { get; set; } public bool ListViewSyntaxColorDurationBig { get; set; } @@ -5538,6 +5541,24 @@ $HorzAlign = Center 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"); if (subNode != null) { @@ -12092,6 +12113,9 @@ $HorzAlign = Center textWriter.WriteElementString("TextToSpeechAzureApiKey", settings.Tools.TextToSpeechAzureApiKey); textWriter.WriteElementString("TextToSpeechAzureRegion", settings.Tools.TextToSpeechAzureRegion); 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("ListViewSyntaxColorDurationSmall", settings.Tools.ListViewSyntaxColorDurationSmall.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("ListViewSyntaxColorDurationBig", settings.Tools.ListViewSyntaxColorDurationBig.ToString(CultureInfo.InvariantCulture)); diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index eb430e4c6..b22d6bd5c 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -1086,7 +1086,7 @@ namespace Nikse.SubtitleEdit.Forms private void AudioWaveform_OnSingleClick(object sender, AudioVisualizer.ParagraphEventArgs e) { - timerWaveform.Stop(); + timerWaveform?.Stop(); ResetPlaySelection(); if (mediaPlayer.VideoPlayer != null) { @@ -1108,7 +1108,7 @@ namespace Nikse.SubtitleEdit.Forms SelectListViewIndexAndEnsureVisible(_subtitle.GetIndex(e.Paragraph)); } - timerWaveform.Start(); + timerWaveform?.Start(); } private void AudioWaveform_OnParagraphRightClicked(object sender, AudioVisualizer.ParagraphEventArgs e) diff --git a/src/ui/Forms/Translate/AutoTranslateSettings.cs b/src/ui/Forms/Translate/AutoTranslateSettings.cs index 83a194619..2543d9389 100644 --- a/src/ui/Forms/Translate/AutoTranslateSettings.cs +++ b/src/ui/Forms/Translate/AutoTranslateSettings.cs @@ -91,13 +91,19 @@ namespace Nikse.SubtitleEdit.Forms.Translate { if (nikseTextBoxPrompt.Text.Contains('{')) { - MessageBox.Show("Character not allowed: {"); + MessageBox.Show("Character not allowed in prompt: {"); return; } 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; } diff --git a/src/ui/Forms/Tts/TextToSpeech.Designer.cs b/src/ui/Forms/Tts/TextToSpeech.Designer.cs index 57e6a91c9..aef54b24c 100644 --- a/src/ui/Forms/Tts/TextToSpeech.Designer.cs +++ b/src/ui/Forms/Tts/TextToSpeech.Designer.cs @@ -35,26 +35,28 @@ this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.labelEngine = new System.Windows.Forms.Label(); 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.nikseComboBoxRegion = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.labelVoiceCount = new System.Windows.Forms.Label(); this.checkBoxShowPreview = new System.Windows.Forms.CheckBox(); 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.checkBoxAddToVideoFile = new System.Windows.Forms.CheckBox(); this.labelVoice = new System.Windows.Forms.Label(); - this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.contextMenuStripVoices = new System.Windows.Forms.ContextMenuStrip(this.components); this.refreshVoicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.listViewActors = new System.Windows.Forms.ListView(); this.columnHeaderActor = ((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.labelActors = new System.Windows.Forms.Label(); 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.contextMenuStripVoices.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.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.Size = new System.Drawing.Size(75, 23); 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.AutoSize = true; 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.Size = new System.Drawing.Size(70, 13); 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.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.Size = new System.Drawing.Size(228, 23); 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) | 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.Size = new System.Drawing.Size(665, 10); + this.progressBar1.Size = new System.Drawing.Size(699, 10); this.progressBar1.TabIndex = 12; // // labelEngine @@ -117,6 +119,8 @@ // this.groupBoxSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | 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.nikseComboBoxRegion); this.groupBoxSettings.Controls.Add(this.labelVoiceCount); @@ -132,11 +136,34 @@ this.groupBoxSettings.Controls.Add(this.nikseComboBoxEngine); this.groupBoxSettings.Location = new System.Drawing.Point(15, 12); 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.TabStop = false; 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 // this.labelRegion.AutoSize = true; @@ -147,31 +174,6 @@ this.labelRegion.TabIndex = 32; 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 // 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.Checked = true; 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.Size = new System.Drawing.Size(115, 17); this.checkBoxShowPreview.TabIndex = 25; @@ -205,28 +207,6 @@ this.labelApiKey.TabIndex = 28; 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 // this.buttonTestVoice.Location = new System.Drawing.Point(17, 141); @@ -243,7 +223,7 @@ this.checkBoxAddToVideoFile.AutoSize = true; this.checkBoxAddToVideoFile.Checked = true; 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.Size = new System.Drawing.Size(176, 17); this.checkBoxAddToVideoFile.TabIndex = 26; @@ -260,32 +240,6 @@ this.labelVoice.TabIndex = 16; 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 // this.contextMenuStripVoices.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -301,33 +255,6 @@ this.refreshVoicesToolStripMenuItem.Text = "Refresh voices"; 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 // 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.Location = new System.Drawing.Point(412, 42); 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.UseCompatibleStateImageBehavior = false; 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.DialogResult = System.Windows.Forms.DialogResult.Cancel; 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.Size = new System.Drawing.Size(75, 23); this.buttonCancel.TabIndex = 101; @@ -385,11 +312,111 @@ this.buttonCancel.UseVisualStyleBackColor = true; 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 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 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.labelActors); this.Controls.Add(this.listViewActors); @@ -446,5 +473,7 @@ private Controls.NikseComboBox nikseComboBoxRegion; private System.Windows.Forms.ContextMenuStrip contextMenuStripVoices; private System.Windows.Forms.ToolStripMenuItem refreshVoicesToolStripMenuItem; + private System.Windows.Forms.CheckBox checkBoxAudioEncoding; + private System.Windows.Forms.LinkLabel linkLabelCustomAudio; } } \ No newline at end of file diff --git a/src/ui/Forms/Tts/TextToSpeech.cs b/src/ui/Forms/Tts/TextToSpeech.cs index 0a747733a..83de73571 100644 --- a/src/ui/Forms/Tts/TextToSpeech.cs +++ b/src/ui/Forms/Tts/TextToSpeech.cs @@ -121,6 +121,9 @@ namespace Nikse.SubtitleEdit.Forms.Tts buttonGenerateTTS.Text = LanguageSettings.Current.TextToSpeech.GenerateSpeech; labelRegion.Text = LanguageSettings.Current.General.Region; 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; buttonCancel.Text = LanguageSettings.Current.General.Cancel; UiUtil.FixLargeFonts(this, buttonOK); @@ -179,7 +182,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts nikseComboBoxVoice.Text = Configuration.Settings.Tools.TextToSpeechLastVoice; checkBoxAddToVideoFile.Checked = Configuration.Settings.Tools.TextToSpeechAddToVideoFile; checkBoxShowPreview.Checked = Configuration.Settings.Tools.TextToSpeechPreview; - + checkBoxAudioEncoding.Checked = Configuration.Settings.Tools.TextToSpeechCustomAudio; checkBoxAddToVideoFile.Enabled = _videoFileName != null; } @@ -392,7 +395,20 @@ namespace Nikse.SubtitleEdit.Forms.Tts labelProgress.Text = "Add audio to video file..."; 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(); while (!addAudioProcess.HasExited) { @@ -2313,5 +2329,13 @@ namespace Nikse.SubtitleEdit.Forms.Tts Cursor = Cursors.Default; } } + + private void linkLabelCustomAudio_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + using (var form = new TtsAudioEncoding()) + { + form.ShowDialog(this); + } + } } } \ No newline at end of file diff --git a/src/ui/Forms/Tts/TtsAudioEncoding.Designer.cs b/src/ui/Forms/Tts/TtsAudioEncoding.Designer.cs new file mode 100644 index 000000000..465ebe1bf --- /dev/null +++ b/src/ui/Forms/Tts/TtsAudioEncoding.Designer.cs @@ -0,0 +1,147 @@ +namespace Nikse.SubtitleEdit.Forms.Tts +{ + sealed partial class TtsAudioEncoding + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/src/ui/Forms/Tts/TtsAudioEncoding.cs b/src/ui/Forms/Tts/TtsAudioEncoding.cs new file mode 100644 index 000000000..69d76fed7 --- /dev/null +++ b/src/ui/Forms/Tts/TtsAudioEncoding.cs @@ -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; + } + } +} diff --git a/src/ui/Forms/Tts/TtsAudioEncoding.resx b/src/ui/Forms/Tts/TtsAudioEncoding.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/src/ui/Forms/Tts/TtsAudioEncoding.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/ui/Logic/Language.cs b/src/ui/Logic/Language.cs index 64b2817e3..981d6bee1 100644 --- a/src/ui/Logic/Language.cs +++ b/src/ui/Logic/Language.cs @@ -3574,6 +3574,7 @@ can edit in same subtitle file (collaboration)", GeneratingSpeechFromTextXOfY = "Generating speech from text: {0} / {1}...", ReviewAudioClips = "Review audio clips", ReviewInfo = "Review and edit/remove audio clips", + CustomAudioEncoding = "Custom audio encoding", AutoContinue = "Auto-continue", Play = "Play", Regenerate = "Regenerate", diff --git a/src/ui/Logic/LanguageStructure.cs b/src/ui/Logic/LanguageStructure.cs index 258b7dca4..37ad030e5 100644 --- a/src/ui/Logic/LanguageStructure.cs +++ b/src/ui/Logic/LanguageStructure.cs @@ -3384,6 +3384,7 @@ public string MergingAudioTrackXOfY { get; set; } public string GeneratingSpeechFromTextXOfY { get; set; } public string ReviewAudioClips { get; set; } + public string CustomAudioEncoding { get; set; } public string ReviewInfo { get; set; } public string Play { get; set; } public string AutoContinue { get; set; } diff --git a/src/ui/Logic/VideoPreviewGenerator.cs b/src/ui/Logic/VideoPreviewGenerator.cs index ee10c5121..28338011e 100644 --- a/src/ui/Logic/VideoPreviewGenerator.cs +++ b/src/ui/Logic/VideoPreviewGenerator.cs @@ -626,14 +626,17 @@ namespace Nikse.SubtitleEdit.Logic 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 { StartInfo = { 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, CreateNoWindow = true } diff --git a/src/ui/SubtitleEdit.csproj b/src/ui/SubtitleEdit.csproj index 430771e4b..ddff10534 100644 --- a/src/ui/SubtitleEdit.csproj +++ b/src/ui/SubtitleEdit.csproj @@ -1434,6 +1434,12 @@ ReviewAudioClips.cs + + Form + + + TtsAudioEncoding.cs + Form @@ -2338,6 +2344,9 @@ ReviewAudioClips.cs + + TtsAudioEncoding.cs + UnknownSubtitle.cs Designer