diff --git a/src/ui/Forms/Tts/RegenerateAudioClip.Designer.cs b/src/ui/Forms/Tts/RegenerateAudioClip.Designer.cs index 5742b86be..894a55b12 100644 --- a/src/ui/Forms/Tts/RegenerateAudioClip.Designer.cs +++ b/src/ui/Forms/Tts/RegenerateAudioClip.Designer.cs @@ -36,6 +36,10 @@ this.buttonPlay = new System.Windows.Forms.Button(); this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.TextBoxReGenerate = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.nikseUpDownStability = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.nikseUpDownSimilarity = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelSimilarity = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelStability = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.SuspendLayout(); // // buttonCancel @@ -57,7 +61,7 @@ this.buttonReGenerate.Location = new System.Drawing.Point(362, 208); this.buttonReGenerate.Name = "buttonReGenerate"; this.buttonReGenerate.Size = new System.Drawing.Size(171, 24); - this.buttonReGenerate.TabIndex = 21; + this.buttonReGenerate.TabIndex = 4; this.buttonReGenerate.Text = "Regenerate "; this.buttonReGenerate.UseVisualStyleBackColor = true; this.buttonReGenerate.Click += new System.EventHandler(this.buttonReGenerate_Click); @@ -89,7 +93,7 @@ this.buttonOK.Location = new System.Drawing.Point(640, 208); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(84, 24); - this.buttonOK.TabIndex = 26; + this.buttonOK.TabIndex = 6; this.buttonOK.Text = "OK"; this.buttonOK.UseVisualStyleBackColor = true; this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); @@ -101,7 +105,7 @@ this.buttonPlay.Location = new System.Drawing.Point(539, 208); this.buttonPlay.Name = "buttonPlay"; this.buttonPlay.Size = new System.Drawing.Size(95, 24); - this.buttonPlay.TabIndex = 27; + this.buttonPlay.TabIndex = 5; this.buttonPlay.Text = "Play"; this.buttonPlay.UseVisualStyleBackColor = true; this.buttonPlay.Click += new System.EventHandler(this.buttonPlay_Click); @@ -127,7 +131,7 @@ this.nikseComboBoxVoice.SelectedItem = null; this.nikseComboBoxVoice.SelectedText = ""; this.nikseComboBoxVoice.Size = new System.Drawing.Size(278, 23); - this.nikseComboBoxVoice.TabIndex = 23; + this.nikseComboBoxVoice.TabIndex = 3; this.nikseComboBoxVoice.UsePopupWindow = false; // // TextBoxReGenerate @@ -139,14 +143,112 @@ this.TextBoxReGenerate.Location = new System.Drawing.Point(12, 40); this.TextBoxReGenerate.Multiline = true; this.TextBoxReGenerate.Name = "TextBoxReGenerate"; - this.TextBoxReGenerate.Size = new System.Drawing.Size(802, 162); - this.TextBoxReGenerate.TabIndex = 22; + this.TextBoxReGenerate.Size = new System.Drawing.Size(802, 126); + this.TextBoxReGenerate.TabIndex = 0; + // + // nikseUpDownStability + // + this.nikseUpDownStability.BackColor = System.Drawing.SystemColors.Window; + this.nikseUpDownStability.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseUpDownStability.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseUpDownStability.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseUpDownStability.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseUpDownStability.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseUpDownStability.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseUpDownStability.DecimalPlaces = 0; + this.nikseUpDownStability.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nikseUpDownStability.Location = new System.Drawing.Point(78, 179); + this.nikseUpDownStability.Maximum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.nikseUpDownStability.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.nikseUpDownStability.Name = "nikseUpDownStability"; + this.nikseUpDownStability.Size = new System.Drawing.Size(75, 23); + this.nikseUpDownStability.TabIndex = 1; + this.nikseUpDownStability.TabStop = false; + this.nikseUpDownStability.Text = "nikseUpDownStability"; + this.nikseUpDownStability.ThousandsSeparator = false; + this.nikseUpDownStability.Value = new decimal(new int[] { + 0, + 0, + 0, + 0}); + // + // nikseUpDownSimilarity + // + this.nikseUpDownSimilarity.BackColor = System.Drawing.SystemColors.Window; + this.nikseUpDownSimilarity.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseUpDownSimilarity.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseUpDownSimilarity.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseUpDownSimilarity.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseUpDownSimilarity.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseUpDownSimilarity.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseUpDownSimilarity.DecimalPlaces = 0; + this.nikseUpDownSimilarity.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nikseUpDownSimilarity.Location = new System.Drawing.Point(231, 179); + this.nikseUpDownSimilarity.Maximum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.nikseUpDownSimilarity.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.nikseUpDownSimilarity.Name = "nikseUpDownSimilarity"; + this.nikseUpDownSimilarity.Size = new System.Drawing.Size(75, 23); + this.nikseUpDownSimilarity.TabIndex = 2; + this.nikseUpDownSimilarity.TabStop = false; + this.nikseUpDownSimilarity.Text = "nikseUpDownSimilarity"; + this.nikseUpDownSimilarity.ThousandsSeparator = false; + this.nikseUpDownSimilarity.Value = new decimal(new int[] { + 0, + 0, + 0, + 0}); + // + // labelSimilarity + // + this.labelSimilarity.AutoSize = true; + this.labelSimilarity.Location = new System.Drawing.Point(178, 183); + this.labelSimilarity.Name = "labelSimilarity"; + this.labelSimilarity.Size = new System.Drawing.Size(47, 13); + this.labelSimilarity.TabIndex = 103; + this.labelSimilarity.Text = "Similarity"; + // + // labelStability + // + this.labelStability.AutoSize = true; + this.labelStability.Location = new System.Drawing.Point(29, 183); + this.labelStability.Name = "labelStability"; + this.labelStability.Size = new System.Drawing.Size(43, 13); + this.labelStability.TabIndex = 102; + this.labelStability.Text = "Stability"; // // RegenerateAudioClip // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(826, 243); + this.Controls.Add(this.nikseUpDownStability); + this.Controls.Add(this.nikseUpDownSimilarity); + this.Controls.Add(this.labelSimilarity); + this.Controls.Add(this.labelStability); this.Controls.Add(this.buttonPlay); this.Controls.Add(this.buttonOK); this.Controls.Add(this.labelText); @@ -177,5 +279,9 @@ private System.Windows.Forms.Label labelText; private System.Windows.Forms.Button buttonOK; private System.Windows.Forms.Button buttonPlay; + private Controls.NikseUpDown nikseUpDownStability; + private Controls.NikseUpDown nikseUpDownSimilarity; + private Controls.NikseLabel labelSimilarity; + private Controls.NikseLabel labelStability; } } \ No newline at end of file diff --git a/src/ui/Forms/Tts/RegenerateAudioClip.cs b/src/ui/Forms/Tts/RegenerateAudioClip.cs index 6bec4ad8e..379bb8a3a 100644 --- a/src/ui/Forms/Tts/RegenerateAudioClip.cs +++ b/src/ui/Forms/Tts/RegenerateAudioClip.cs @@ -16,7 +16,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts private readonly int _index; private LibMpvDynamic _libMpv; - public RegenerateAudioClip(TextToSpeech textToSpeech, Subtitle subtitle, int idx) + public RegenerateAudioClip(TextToSpeech textToSpeech, Subtitle subtitle, int idx, TextToSpeech.TextToSpeechEngine engine) { UiUtil.PreInitialize(this); InitializeComponent(); @@ -29,6 +29,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts Text = LanguageSettings.Current.ExportCustomText.Edit; labelText.Text = LanguageSettings.Current.General.Text; labelVoice.Text = LanguageSettings.Current.TextToSpeech.Voice; + labelStability.Text = LanguageSettings.Current.TextToSpeech.Stability; + labelSimilarity.Text = LanguageSettings.Current.TextToSpeech.Similarity; buttonReGenerate.Text = LanguageSettings.Current.TextToSpeech.Regenerate; buttonCancel.Text = LanguageSettings.Current.General.Cancel; buttonOK.Text = LanguageSettings.Current.General.Ok; @@ -38,10 +40,27 @@ namespace Nikse.SubtitleEdit.Forms.Tts TextBoxReGenerate.Text = subtitle.Paragraphs[idx].Text; textToSpeech.SetCurrentVoices(nikseComboBoxVoice); buttonPlay.Enabled = false; + nikseUpDownStability.Value = (int)Math.Round(Configuration.Settings.Tools.TextToSpeechElevenLabsStability * 100.0); + nikseUpDownSimilarity.Value = (int)Math.Round(Configuration.Settings.Tools.TextToSpeechElevenLabsSimilarity * 100.0); + + if (engine.Id == TextToSpeech.TextToSpeechEngineId.ElevenLabs) + { + } + else + { + labelStability.Visible = false; + labelSimilarity.Visible = false; + nikseUpDownStability.Visible = false; + nikseUpDownSimilarity.Visible = false; + TextBoxReGenerate.Height = buttonOK.Top - TextBoxReGenerate.Top - 10; + } } private void buttonReGenerate_Click(object sender, EventArgs e) { + Configuration.Settings.Tools.TextToSpeechElevenLabsStability = (double)nikseUpDownStability.Value / 100.0; + Configuration.Settings.Tools.TextToSpeechElevenLabsSimilarity = (double)nikseUpDownSimilarity.Value / 100.0; + var paragraph = _subtitle.Paragraphs[_index]; paragraph.Text = TextBoxReGenerate.Text.Trim(); diff --git a/src/ui/Forms/Tts/ReviewAudioClips.cs b/src/ui/Forms/Tts/ReviewAudioClips.cs index a9b186a8e..556b9409e 100644 --- a/src/ui/Forms/Tts/ReviewAudioClips.cs +++ b/src/ui/Forms/Tts/ReviewAudioClips.cs @@ -23,8 +23,9 @@ namespace Nikse.SubtitleEdit.Forms.Tts private bool _playing; private LibMpvDynamic _libMpv; private Timer _mpvDoneTimer; + private TextToSpeech.TextToSpeechEngine _engine; - public ReviewAudioClips(TextToSpeech textToSpeech, Subtitle subtitle, List fileNames) + public ReviewAudioClips(TextToSpeech textToSpeech, Subtitle subtitle, List fileNames, TextToSpeech.TextToSpeechEngine engine) { UiUtil.PreInitialize(this); InitializeComponent(); @@ -45,6 +46,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts _textToSpeech = textToSpeech; _subtitle = subtitle; _fileNames = fileNames; + _engine = engine; SkipIndices = new List(); @@ -264,7 +266,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts } var idx = listViewAudioClips.SelectedItems[0].Index; - using (var form = new RegenerateAudioClip(_textToSpeech, _subtitle, idx)) + using (var form = new RegenerateAudioClip(_textToSpeech, _subtitle, idx, _engine)) { var dr = form.ShowDialog(this); if (dr == DialogResult.OK) diff --git a/src/ui/Forms/Tts/TextToSpeech.Designer.cs b/src/ui/Forms/Tts/TextToSpeech.Designer.cs index c81d25f04..622578fb8 100644 --- a/src/ui/Forms/Tts/TextToSpeech.Designer.cs +++ b/src/ui/Forms/Tts/TextToSpeech.Designer.cs @@ -35,34 +35,34 @@ this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.labelEngine = new System.Windows.Forms.Label(); this.groupBoxSettings = new System.Windows.Forms.GroupBox(); + this.nikseUpDownStability = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.nikseUpDownSimilarity = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelSimilarity = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelStability = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelLanguage = new System.Windows.Forms.Label(); + this.nikseComboBoxLanguage = new Nikse.SubtitleEdit.Controls.NikseComboBox(); 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.nikseUpDownStability = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.nikseUpDownSimilarity = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelSimilarity = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelStability = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.nikseComboBoxLanguage = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - 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(); @@ -153,187 +153,6 @@ this.groupBoxSettings.TabStop = false; this.groupBoxSettings.Text = "Settings"; // - // labelLanguage - // - this.labelLanguage.AutoSize = true; - this.labelLanguage.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelLanguage.Location = new System.Drawing.Point(14, 274); - this.labelLanguage.Name = "labelLanguage"; - this.labelLanguage.Size = new System.Drawing.Size(55, 13); - this.labelLanguage.TabIndex = 36; - this.labelLanguage.Text = "Language"; - // - // 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(168, 400); - this.linkLabelCustomAudio.Name = "linkLabelCustomAudio"; - this.linkLabelCustomAudio.Size = new System.Drawing.Size(45, 13); - this.linkLabelCustomAudio.TabIndex = 43; - 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 = 42; - this.checkBoxAudioEncoding.Text = "Custom audio encoding"; - this.checkBoxAudioEncoding.UseVisualStyleBackColor = true; - // - // labelRegion - // - this.labelRegion.AutoSize = true; - this.labelRegion.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelRegion.Location = new System.Drawing.Point(14, 245); - this.labelRegion.Name = "labelRegion"; - this.labelRegion.Size = new System.Drawing.Size(41, 13); - this.labelRegion.TabIndex = 32; - this.labelRegion.Text = "Region"; - // - // labelVoiceCount - // - this.labelVoiceCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.labelVoiceCount.Location = new System.Drawing.Point(172, 83); - this.labelVoiceCount.Name = "labelVoiceCount"; - this.labelVoiceCount.Size = new System.Drawing.Size(196, 23); - this.labelVoiceCount.TabIndex = 29; - this.labelVoiceCount.Text = "255"; - this.labelVoiceCount.TextAlign = System.Drawing.ContentAlignment.BottomRight; - // - // checkBoxShowPreview - // - this.checkBoxShowPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.checkBoxShowPreview.AutoSize = true; - this.checkBoxShowPreview.Checked = true; - this.checkBoxShowPreview.CheckState = System.Windows.Forms.CheckState.Checked; - 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 = 40; - this.checkBoxShowPreview.Text = "Review audio clips"; - this.checkBoxShowPreview.UseVisualStyleBackColor = true; - // - // labelApiKey - // - this.labelApiKey.AutoSize = true; - this.labelApiKey.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelApiKey.Location = new System.Drawing.Point(14, 216); - this.labelApiKey.Name = "labelApiKey"; - this.labelApiKey.Size = new System.Drawing.Size(44, 13); - this.labelApiKey.TabIndex = 28; - this.labelApiKey.Text = "API key"; - // - // buttonTestVoice - // - this.buttonTestVoice.Location = new System.Drawing.Point(17, 141); - this.buttonTestVoice.Name = "buttonTestVoice"; - this.buttonTestVoice.Size = new System.Drawing.Size(150, 23); - this.buttonTestVoice.TabIndex = 15; - this.buttonTestVoice.Text = "Test voice"; - this.buttonTestVoice.UseVisualStyleBackColor = true; - this.buttonTestVoice.Click += new System.EventHandler(this.buttonTestVoice_Click); - // - // checkBoxAddToVideoFile - // - this.checkBoxAddToVideoFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.checkBoxAddToVideoFile.AutoSize = true; - this.checkBoxAddToVideoFile.Checked = true; - this.checkBoxAddToVideoFile.CheckState = System.Windows.Forms.CheckState.Checked; - 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 = 41; - this.checkBoxAddToVideoFile.Text = "Add audio to video file (new file)"; - this.checkBoxAddToVideoFile.UseVisualStyleBackColor = true; - // - // labelVoice - // - this.labelVoice.AutoSize = true; - this.labelVoice.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelVoice.Location = new System.Drawing.Point(14, 93); - this.labelVoice.Name = "labelVoice"; - this.labelVoice.Size = new System.Drawing.Size(34, 13); - this.labelVoice.TabIndex = 16; - this.labelVoice.Text = "Voice"; - // - // contextMenuStripVoices - // - this.contextMenuStripVoices.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.refreshVoicesToolStripMenuItem}); - this.contextMenuStripVoices.Name = "contextMenuStripVoices"; - this.contextMenuStripVoices.Size = new System.Drawing.Size(150, 26); - this.contextMenuStripVoices.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripVoices_Opening); - // - // refreshVoicesToolStripMenuItem - // - this.refreshVoicesToolStripMenuItem.Name = "refreshVoicesToolStripMenuItem"; - this.refreshVoicesToolStripMenuItem.Size = new System.Drawing.Size(149, 22); - this.refreshVoicesToolStripMenuItem.Text = "Refresh voices"; - this.refreshVoicesToolStripMenuItem.Click += new System.EventHandler(this.refreshVoicesToolStripMenuItem_Click); - // - // listViewActors - // - this.listViewActors.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listViewActors.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeaderActor, - this.columnHeaderVoice}); - this.listViewActors.ContextMenuStrip = this.contextMenuStripActors; - this.listViewActors.FullRowSelect = true; - this.listViewActors.GridLines = true; - this.listViewActors.HideSelection = false; - this.listViewActors.Location = new System.Drawing.Point(412, 42); - this.listViewActors.Name = "listViewActors"; - 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; - // - // columnHeaderActor - // - this.columnHeaderActor.Text = "Actor"; - this.columnHeaderActor.Width = 200; - // - // columnHeaderVoice - // - this.columnHeaderVoice.Text = "Voice"; - this.columnHeaderVoice.Width = 200; - // - // contextMenuStripActors - // - this.contextMenuStripActors.Name = "contextMenuStripActors"; - this.contextMenuStripActors.Size = new System.Drawing.Size(61, 4); - // - // labelActors - // - this.labelActors.AutoSize = true; - this.labelActors.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelActors.Location = new System.Drawing.Point(412, 19); - this.labelActors.Name = "labelActors"; - this.labelActors.Size = new System.Drawing.Size(170, 13); - this.labelActors.TabIndex = 19; - this.labelActors.Text = "Right-click to assign actor to voice"; - // - // 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(801, 486); - this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size(75, 23); - this.buttonCancel.TabIndex = 101; - this.buttonCancel.Text = "C&ancel"; - this.buttonCancel.UseVisualStyleBackColor = true; - this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); - // // nikseUpDownStability // this.nikseUpDownStability.BackColor = System.Drawing.SystemColors.Window; @@ -428,6 +247,16 @@ this.labelStability.TabIndex = 97; this.labelStability.Text = "Stability"; // + // labelLanguage + // + this.labelLanguage.AutoSize = true; + this.labelLanguage.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelLanguage.Location = new System.Drawing.Point(14, 274); + this.labelLanguage.Name = "labelLanguage"; + this.labelLanguage.Size = new System.Drawing.Size(55, 13); + this.labelLanguage.TabIndex = 36; + this.labelLanguage.Text = "Language"; + // // nikseComboBoxLanguage // this.nikseComboBoxLanguage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -453,6 +282,39 @@ this.nikseComboBoxLanguage.TabIndex = 35; this.nikseComboBoxLanguage.UsePopupWindow = false; // + // 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(168, 400); + this.linkLabelCustomAudio.Name = "linkLabelCustomAudio"; + this.linkLabelCustomAudio.Size = new System.Drawing.Size(45, 13); + this.linkLabelCustomAudio.TabIndex = 43; + 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 = 42; + this.checkBoxAudioEncoding.Text = "Custom audio encoding"; + this.checkBoxAudioEncoding.UseVisualStyleBackColor = true; + // + // labelRegion + // + this.labelRegion.AutoSize = true; + this.labelRegion.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelRegion.Location = new System.Drawing.Point(14, 245); + this.labelRegion.Name = "labelRegion"; + this.labelRegion.Size = new System.Drawing.Size(41, 13); + 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) @@ -479,6 +341,39 @@ this.nikseComboBoxRegion.UsePopupWindow = false; this.nikseComboBoxRegion.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxRegion_SelectedIndexChanged); // + // labelVoiceCount + // + this.labelVoiceCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.labelVoiceCount.Location = new System.Drawing.Point(172, 83); + this.labelVoiceCount.Name = "labelVoiceCount"; + this.labelVoiceCount.Size = new System.Drawing.Size(196, 23); + this.labelVoiceCount.TabIndex = 29; + this.labelVoiceCount.Text = "255"; + this.labelVoiceCount.TextAlign = System.Drawing.ContentAlignment.BottomRight; + // + // checkBoxShowPreview + // + this.checkBoxShowPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.checkBoxShowPreview.AutoSize = true; + this.checkBoxShowPreview.Checked = true; + this.checkBoxShowPreview.CheckState = System.Windows.Forms.CheckState.Checked; + 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 = 40; + this.checkBoxShowPreview.Text = "Review audio clips"; + this.checkBoxShowPreview.UseVisualStyleBackColor = true; + // + // labelApiKey + // + this.labelApiKey.AutoSize = true; + this.labelApiKey.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelApiKey.Location = new System.Drawing.Point(14, 216); + this.labelApiKey.Name = "labelApiKey"; + this.labelApiKey.Size = new System.Drawing.Size(44, 13); + 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) @@ -501,6 +396,39 @@ 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); + this.buttonTestVoice.Name = "buttonTestVoice"; + this.buttonTestVoice.Size = new System.Drawing.Size(150, 23); + this.buttonTestVoice.TabIndex = 15; + this.buttonTestVoice.Text = "Test voice"; + this.buttonTestVoice.UseVisualStyleBackColor = true; + this.buttonTestVoice.Click += new System.EventHandler(this.buttonTestVoice_Click); + // + // checkBoxAddToVideoFile + // + this.checkBoxAddToVideoFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.checkBoxAddToVideoFile.AutoSize = true; + this.checkBoxAddToVideoFile.Checked = true; + this.checkBoxAddToVideoFile.CheckState = System.Windows.Forms.CheckState.Checked; + 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 = 41; + this.checkBoxAddToVideoFile.Text = "Add audio to video file (new file)"; + this.checkBoxAddToVideoFile.UseVisualStyleBackColor = true; + // + // labelVoice + // + this.labelVoice.AutoSize = true; + this.labelVoice.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelVoice.Location = new System.Drawing.Point(14, 93); + this.labelVoice.Name = "labelVoice"; + this.labelVoice.Size = new System.Drawing.Size(34, 13); + 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) @@ -527,6 +455,21 @@ this.nikseComboBoxVoice.TabIndex = 10; this.nikseComboBoxVoice.UsePopupWindow = false; // + // contextMenuStripVoices + // + this.contextMenuStripVoices.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.refreshVoicesToolStripMenuItem}); + this.contextMenuStripVoices.Name = "contextMenuStripVoices"; + this.contextMenuStripVoices.Size = new System.Drawing.Size(150, 26); + this.contextMenuStripVoices.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripVoices_Opening); + // + // refreshVoicesToolStripMenuItem + // + this.refreshVoicesToolStripMenuItem.Name = "refreshVoicesToolStripMenuItem"; + this.refreshVoicesToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + 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) @@ -551,9 +494,66 @@ this.nikseComboBoxEngine.Size = new System.Drawing.Size(351, 23); this.nikseComboBoxEngine.TabIndex = 5; this.nikseComboBoxEngine.TabStop = false; - this.nikseComboBoxEngine.Text = "nikseComboBox1"; + this.nikseComboBoxEngine.Text = "nikseComboBoxEngine"; this.nikseComboBoxEngine.UsePopupWindow = false; // + // listViewActors + // + this.listViewActors.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listViewActors.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderActor, + this.columnHeaderVoice}); + this.listViewActors.ContextMenuStrip = this.contextMenuStripActors; + this.listViewActors.FullRowSelect = true; + this.listViewActors.GridLines = true; + this.listViewActors.HideSelection = false; + this.listViewActors.Location = new System.Drawing.Point(412, 42); + this.listViewActors.Name = "listViewActors"; + 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; + // + // columnHeaderActor + // + this.columnHeaderActor.Text = "Actor"; + this.columnHeaderActor.Width = 200; + // + // columnHeaderVoice + // + this.columnHeaderVoice.Text = "Voice"; + this.columnHeaderVoice.Width = 200; + // + // contextMenuStripActors + // + this.contextMenuStripActors.Name = "contextMenuStripActors"; + this.contextMenuStripActors.Size = new System.Drawing.Size(61, 4); + // + // labelActors + // + this.labelActors.AutoSize = true; + this.labelActors.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelActors.Location = new System.Drawing.Point(412, 19); + this.labelActors.Name = "labelActors"; + this.labelActors.Size = new System.Drawing.Size(170, 13); + this.labelActors.TabIndex = 19; + this.labelActors.Text = "Right-click to assign actor to voice"; + // + // 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(801, 486); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 101; + this.buttonCancel.Text = "C&ancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // // TextToSpeech // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/src/ui/Forms/Tts/TextToSpeech.cs b/src/ui/Forms/Tts/TextToSpeech.cs index ae71818e2..60bea37b7 100644 --- a/src/ui/Forms/Tts/TextToSpeech.cs +++ b/src/ui/Forms/Tts/TextToSpeech.cs @@ -258,7 +258,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts if (checkBoxShowPreview.Checked) { - using (var form = new ReviewAudioClips(this, _subtitle, fileNameAndSpeedFactors)) + var engine = _engines.First(p => p.Index == nikseComboBoxEngine.SelectedIndex); + using (var form = new ReviewAudioClips(this, _subtitle, fileNameAndSpeedFactors, engine)) { var dr = form.ShowDialog(this); if (dr != DialogResult.OK) @@ -1137,7 +1138,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts } } - var stability = Math.Round(Configuration.Settings.Tools.TextToSpeechElevenLabsStability, 1).ToString(CultureInfo.InvariantCulture); + var stability = Math.Round(Configuration.Settings.Tools.TextToSpeechElevenLabsStability, 1).ToString(CultureInfo.InvariantCulture); var similarity = Math.Round(Configuration.Settings.Tools.TextToSpeechElevenLabsSimilarity, 1).ToString(CultureInfo.InvariantCulture); var data = "{ \"text\": \"" + Json.EncodeJsonText(text) + $"\", \"model_id\": \"{model}\"{language}, \"voice_settings\": {{ \"stability\": {stability}, \"similarity_boost\": {similarity} }} }}"; var content = new StringContent(data, Encoding.UTF8); @@ -2132,7 +2133,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts if (!useCache) { - using(var httpClient = new HttpClient()) + using (var httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json"); httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json"); @@ -2493,7 +2494,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts { using (var form = new TtsAudioEncoding()) { - form.ShowDialog(this); + form.ShowDialog(this); } }