From 890cb717a4570aac796ccfbcd200983ad52447d5 Mon Sep 17 00:00:00 2001 From: sr55 Date: Fri, 17 Jul 2009 20:07:41 +0000 Subject: [PATCH] WinGui: - Some fixes and code tweaks to the audio panel git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2705 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Controls/AudioPanel.Designer.cs | 130 ++++++------- win/C#/Controls/AudioPanel.cs | 246 +++++++++++-------------- 2 files changed, 176 insertions(+), 200 deletions(-) diff --git a/win/C#/Controls/AudioPanel.Designer.cs b/win/C#/Controls/AudioPanel.Designer.cs index 95b938d61..fe765cf94 100644 --- a/win/C#/Controls/AudioPanel.Designer.cs +++ b/win/C#/Controls/AudioPanel.Designer.cs @@ -58,12 +58,12 @@ namespace Handbrake.Controls this.label66 = new System.Windows.Forms.Label(); this.label65 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); - this.drp_audenc_1 = new System.Windows.Forms.ComboBox(); + this.drp_audioEncoder = new System.Windows.Forms.ComboBox(); this.label27 = new System.Windows.Forms.Label(); - this.drp_audmix_1 = new System.Windows.Forms.ComboBox(); - this.drp_track1Audio = new System.Windows.Forms.ComboBox(); - this.drp_audbit_1 = new System.Windows.Forms.ComboBox(); - this.drp_audsr_1 = new System.Windows.Forms.ComboBox(); + this.drp_audioMix = new System.Windows.Forms.ComboBox(); + this.drp_audioTrack = new System.Windows.Forms.ComboBox(); + this.drp_audioBitrate = new System.Windows.Forms.ComboBox(); + this.drp_audioSample = new System.Windows.Forms.ComboBox(); this.AudioTrackGroup = new System.Windows.Forms.GroupBox(); this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components); this.audioMenu.SuspendLayout(); @@ -137,19 +137,19 @@ namespace Handbrake.Controls this.toolStripSeparator2, this.audioList_remove}); this.audioMenu.Name = "audioMenu"; - this.audioMenu.Size = new System.Drawing.Size(139, 76); + this.audioMenu.Size = new System.Drawing.Size(142, 76); // // audioList_moveup // this.audioList_moveup.Name = "audioList_moveup"; - this.audioList_moveup.Size = new System.Drawing.Size(138, 22); + this.audioList_moveup.Size = new System.Drawing.Size(141, 22); this.audioList_moveup.Text = "Move Up"; this.audioList_moveup.Click += new System.EventHandler(this.audioList_moveup_Click); // // audioList_movedown // this.audioList_movedown.Name = "audioList_movedown"; - this.audioList_movedown.Size = new System.Drawing.Size(138, 22); + this.audioList_movedown.Size = new System.Drawing.Size(141, 22); this.audioList_movedown.Text = "Move Down"; this.audioList_movedown.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.audioList_movedown.Click += new System.EventHandler(this.audioList_movedown_Click); @@ -157,12 +157,12 @@ namespace Handbrake.Controls // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(135, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(138, 6); // // audioList_remove // this.audioList_remove.Name = "audioList_remove"; - this.audioList_remove.Size = new System.Drawing.Size(138, 22); + this.audioList_remove.Size = new System.Drawing.Size(141, 22); this.audioList_remove.Text = "Remove"; this.audioList_remove.Click += new System.EventHandler(this.audioList_remove_Click); // @@ -275,20 +275,20 @@ namespace Handbrake.Controls this.label14.TabIndex = 55; this.label14.Text = "Mixdown"; // - // drp_audenc_1 + // drp_audioEncoder // - this.drp_audenc_1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.drp_audenc_1.FormattingEnabled = true; - this.drp_audenc_1.Items.AddRange(new object[] { + this.drp_audioEncoder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.drp_audioEncoder.FormattingEnabled = true; + this.drp_audioEncoder.Items.AddRange(new object[] { "AAC (faac)", "MP3 (lame)", "Vorbis (vorbis)", "AC3 Passthru"}); - this.drp_audenc_1.Location = new System.Drawing.Point(215, 34); - this.drp_audenc_1.Name = "drp_audenc_1"; - this.drp_audenc_1.Size = new System.Drawing.Size(111, 21); - this.drp_audenc_1.TabIndex = 52; - this.drp_audenc_1.SelectedIndexChanged += new System.EventHandler(this.drp_audenc_1_SelectedIndexChanged); + this.drp_audioEncoder.Location = new System.Drawing.Point(215, 34); + this.drp_audioEncoder.Name = "drp_audioEncoder"; + this.drp_audioEncoder.Size = new System.Drawing.Size(111, 21); + this.drp_audioEncoder.TabIndex = 52; + this.drp_audioEncoder.SelectedIndexChanged += new System.EventHandler(this.drp_audenc_SelectedIndexChanged); // // label27 // @@ -300,40 +300,40 @@ namespace Handbrake.Controls this.label27.TabIndex = 51; this.label27.Text = "Source"; // - // drp_audmix_1 + // drp_audioMix // - this.drp_audmix_1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.drp_audmix_1.FormattingEnabled = true; - this.drp_audmix_1.Items.AddRange(new object[] { + this.drp_audioMix.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.drp_audioMix.FormattingEnabled = true; + this.drp_audioMix.Items.AddRange(new object[] { "Automatic", "Mono", "Stereo", "Dolby Surround", "Dolby Pro Logic II", "6 Channel Discrete"}); - this.drp_audmix_1.Location = new System.Drawing.Point(332, 34); - this.drp_audmix_1.Name = "drp_audmix_1"; - this.drp_audmix_1.Size = new System.Drawing.Size(129, 21); - this.drp_audmix_1.TabIndex = 54; - this.drp_audmix_1.SelectedIndexChanged += new System.EventHandler(this.drp_audmix_1_SelectedIndexChanged); + this.drp_audioMix.Location = new System.Drawing.Point(332, 34); + this.drp_audioMix.Name = "drp_audioMix"; + this.drp_audioMix.Size = new System.Drawing.Size(129, 21); + this.drp_audioMix.TabIndex = 54; + this.drp_audioMix.SelectedIndexChanged += new System.EventHandler(this.drp_audmix_SelectedIndexChanged); // - // drp_track1Audio + // drp_audioTrack // - this.drp_track1Audio.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.drp_track1Audio.FormattingEnabled = true; - this.drp_track1Audio.Items.AddRange(new object[] { + this.drp_audioTrack.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.drp_audioTrack.FormattingEnabled = true; + this.drp_audioTrack.Items.AddRange(new object[] { "Automatic"}); - this.drp_track1Audio.Location = new System.Drawing.Point(15, 35); - this.drp_track1Audio.Name = "drp_track1Audio"; - this.drp_track1Audio.Size = new System.Drawing.Size(194, 21); - this.drp_track1Audio.TabIndex = 50; - this.drp_track1Audio.SelectedIndexChanged += new System.EventHandler(this.drp_track1Audio_SelectedIndexChanged); + this.drp_audioTrack.Location = new System.Drawing.Point(15, 35); + this.drp_audioTrack.Name = "drp_audioTrack"; + this.drp_audioTrack.Size = new System.Drawing.Size(194, 21); + this.drp_audioTrack.TabIndex = 50; + this.drp_audioTrack.SelectedIndexChanged += new System.EventHandler(this.drp_audioTrack_SelectedIndexChanged); // - // drp_audbit_1 + // drp_audioBitrate // - this.drp_audbit_1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.drp_audbit_1.FormattingEnabled = true; - this.drp_audbit_1.Items.AddRange(new object[] { + this.drp_audioBitrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.drp_audioBitrate.FormattingEnabled = true; + this.drp_audioBitrate.Items.AddRange(new object[] { "32", "40", "48", @@ -344,40 +344,40 @@ namespace Handbrake.Controls "112", "128", "160"}); - this.drp_audbit_1.Location = new System.Drawing.Point(525, 34); - this.drp_audbit_1.Name = "drp_audbit_1"; - this.drp_audbit_1.Size = new System.Drawing.Size(70, 21); - this.drp_audbit_1.TabIndex = 58; - this.drp_audbit_1.SelectedIndexChanged += new System.EventHandler(this.drp_audbit_1_SelectedIndexChanged); + this.drp_audioBitrate.Location = new System.Drawing.Point(525, 34); + this.drp_audioBitrate.Name = "drp_audioBitrate"; + this.drp_audioBitrate.Size = new System.Drawing.Size(70, 21); + this.drp_audioBitrate.TabIndex = 58; + this.drp_audioBitrate.SelectedIndexChanged += new System.EventHandler(this.drp_audbit_SelectedIndexChanged); // - // drp_audsr_1 + // drp_audioSample // - this.drp_audsr_1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.drp_audsr_1.FormattingEnabled = true; - this.drp_audsr_1.Items.AddRange(new object[] { + this.drp_audioSample.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.drp_audioSample.FormattingEnabled = true; + this.drp_audioSample.Items.AddRange(new object[] { "Auto", "48", "44.1", "32", "24", "22.05"}); - this.drp_audsr_1.Location = new System.Drawing.Point(467, 34); - this.drp_audsr_1.Name = "drp_audsr_1"; - this.drp_audsr_1.Size = new System.Drawing.Size(55, 21); - this.drp_audsr_1.TabIndex = 56; - this.drp_audsr_1.SelectedIndexChanged += new System.EventHandler(this.drp_audsr_1_SelectedIndexChanged); + this.drp_audioSample.Location = new System.Drawing.Point(467, 34); + this.drp_audioSample.Name = "drp_audioSample"; + this.drp_audioSample.Size = new System.Drawing.Size(55, 21); + this.drp_audioSample.TabIndex = 56; + this.drp_audioSample.SelectedIndexChanged += new System.EventHandler(this.drp_audsr_SelectedIndexChanged); // // AudioTrackGroup // this.AudioTrackGroup.BackColor = System.Drawing.Color.Transparent; - this.AudioTrackGroup.Controls.Add(this.drp_track1Audio); - this.AudioTrackGroup.Controls.Add(this.drp_audsr_1); - this.AudioTrackGroup.Controls.Add(this.drp_audbit_1); - this.AudioTrackGroup.Controls.Add(this.drp_audmix_1); + this.AudioTrackGroup.Controls.Add(this.drp_audioTrack); + this.AudioTrackGroup.Controls.Add(this.drp_audioSample); + this.AudioTrackGroup.Controls.Add(this.drp_audioBitrate); + this.AudioTrackGroup.Controls.Add(this.drp_audioMix); this.AudioTrackGroup.Controls.Add(this.lbl_drc); this.AudioTrackGroup.Controls.Add(this.label27); this.AudioTrackGroup.Controls.Add(this.label16); - this.AudioTrackGroup.Controls.Add(this.drp_audenc_1); + this.AudioTrackGroup.Controls.Add(this.drp_audioEncoder); this.AudioTrackGroup.Controls.Add(this.tb_drc); this.AudioTrackGroup.Controls.Add(this.label14); this.AudioTrackGroup.Controls.Add(this.label65); @@ -437,12 +437,11 @@ namespace Handbrake.Controls internal System.Windows.Forms.Label label66; internal System.Windows.Forms.Label label65; internal System.Windows.Forms.Label label14; - internal System.Windows.Forms.ComboBox drp_audenc_1; + internal System.Windows.Forms.ComboBox drp_audioEncoder; internal System.Windows.Forms.Label label27; - internal System.Windows.Forms.ComboBox drp_audmix_1; - internal System.Windows.Forms.ComboBox drp_track1Audio; - internal System.Windows.Forms.ComboBox drp_audbit_1; - internal System.Windows.Forms.ComboBox drp_audsr_1; + internal System.Windows.Forms.ComboBox drp_audioMix; + internal System.Windows.Forms.ComboBox drp_audioTrack; + internal System.Windows.Forms.ComboBox drp_audioSample; private System.Windows.Forms.ColumnHeader col_id; private System.Windows.Forms.GroupBox AudioTrackGroup; private System.Windows.Forms.ImageList AudioMenuRowHeightHack; @@ -451,5 +450,6 @@ namespace Handbrake.Controls private System.Windows.Forms.ToolStripMenuItem audioList_movedown; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem audioList_remove; + internal System.Windows.Forms.ComboBox drp_audioBitrate; } } diff --git a/win/C#/Controls/AudioPanel.cs b/win/C#/Controls/AudioPanel.cs index 272f88ce8..d086999a1 100644 --- a/win/C#/Controls/AudioPanel.cs +++ b/win/C#/Controls/AudioPanel.cs @@ -12,93 +12,96 @@ namespace Handbrake.Controls public partial class AudioPanel : UserControl { public event EventHandler AudioListChanged; + public AudioPanel() { InitializeComponent(); + drp_audioMix.SelectedIndex = 0; } // Audio Track Options - private void drp_track1Audio_SelectedIndexChanged(object sender, EventArgs e) + private void drp_audioTrack_SelectedIndexChanged(object sender, EventArgs e) { if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0) { - lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[1].Text = drp_track1Audio.Text; + lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[1].Text = drp_audioTrack.Text; lv_audioList.Select(); } - } - private void drp_audenc_1_SelectedIndexChanged(object sender, EventArgs e) + private void drp_audenc_SelectedIndexChanged(object sender, EventArgs e) { - if (drp_audenc_1.Text.Contains("AC3") || drp_audenc_1.Text.Contains("DTS")) + // Setup the widgets with the correct avail options + if (drp_audioEncoder.Text.Contains("AAC")) { - drp_audmix_1.Enabled = false; - drp_audbit_1.Enabled = false; - drp_audsr_1.Enabled = false; - - drp_audmix_1.SelectedIndex = 0; - drp_audbit_1.SelectedIndex = 0; - drp_audsr_1.SelectedIndex = 0; + setMixDown(true); + setBitrate(160); } else { - drp_audmix_1.Enabled = true; - drp_audbit_1.Enabled = true; - drp_audsr_1.Enabled = true; - - drp_audmix_1.Text = "Automatic"; - drp_audbit_1.Text = "160"; - drp_audsr_1.Text = "Auto"; + setMixDown(false); + setBitrate(320); } - if (drp_audenc_1.Text.Contains("AAC")) + // Configure the widgets with values + if (drp_audioEncoder.Text.Contains("AC3") || drp_audioEncoder.Text.Contains("DTS")) { - setMixDownAllOptions(drp_audmix_1); - setBitrateSelections160(drp_audbit_1); + drp_audioMix.Enabled = false; + drp_audioBitrate.Enabled = false; + drp_audioSample.Enabled = false; + + drp_audioMix.SelectedIndex = 0; + drp_audioBitrate.SelectedIndex = 0; + drp_audioSample.SelectedIndex = 0; } else { - setMixDownNotAAC(drp_audmix_1); - setBitrateSelections320(drp_audbit_1); + drp_audioMix.Enabled = true; + drp_audioBitrate.Enabled = true; + drp_audioSample.Enabled = true; + + drp_audioMix.SelectedIndex = 0; + drp_audioBitrate.SelectedIndex = 9; + drp_audioSample.SelectedIndex = 0; } // Update an item in the Audio list if required. if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0) { - lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text = drp_audenc_1.Text; + lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text = drp_audioEncoder.Text; lv_audioList.Select(); } } - private void drp_audmix_1_SelectedIndexChanged(object sender, EventArgs e) + private void drp_audmix_SelectedIndexChanged(object sender, EventArgs e) { - if ((drp_audenc_1.Text.Contains("AAC")) && (drp_audmix_1.Text == "6 Channel Discrete")) - setBitrateSelections384(drp_audbit_1); - else if ((drp_audenc_1.Text.Contains("AAC")) && (drp_audmix_1.Text != "6 Channel Discrete")) - setBitrateSelections160(drp_audbit_1); drp_audbit_1.Text = "160"; + if ((drp_audioEncoder.Text.Contains("AAC")) && (drp_audioMix.Text == "6 Channel Discrete")) + setBitrate(384); + else if ((drp_audioEncoder.Text.Contains("AAC")) && (drp_audioMix.Text != "6 Channel Discrete")) + setBitrate(160); // Update an item in the Audio list if required. if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0) { - lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text = drp_audmix_1.Text; + lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text = drp_audioMix.Text; lv_audioList.Select(); } } - private void drp_audsr_1_SelectedIndexChanged(object sender, EventArgs e) + private void drp_audsr_SelectedIndexChanged(object sender, EventArgs e) { // Update an item in the Audio list if required. if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0) { - lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text = drp_audsr_1.Text; + lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text = drp_audioSample.Text; lv_audioList.Select(); } } - private void drp_audbit_1_SelectedIndexChanged(object sender, EventArgs e) + private void drp_audbit_SelectedIndexChanged(object sender, EventArgs e) { // Update an item in the Audio list if required. if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0) { - if (drp_audenc_1.Text.Contains("AC3")) - drp_audbit_1.Text = "Auto"; - lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text = drp_audbit_1.Text; + if (drp_audioEncoder.Text.Contains("AC3")) + drp_audioBitrate.SelectedItem = "Auto"; + lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text = drp_audioBitrate.Text; lv_audioList.Select(); } } @@ -114,7 +117,7 @@ namespace Handbrake.Controls // Update an item in the Audio list if required. if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0) { - lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text = lbl_drc.Text; + lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text = value.ToString(); lv_audioList.Select(); } } @@ -122,14 +125,18 @@ namespace Handbrake.Controls // Track Controls private void btn_addAudioTrack_Click(object sender, EventArgs e) { + double value = 0; + if (tb_drc.Value != 0) + value = ((tb_drc.Value - 1) / 10.0) + 1; + // Create a new row for the Audio list based on the currently selected items in the dropdown. ListViewItem newTrack = new ListViewItem(getNewID().ToString()); - newTrack.SubItems.Add(drp_track1Audio.Text); - newTrack.SubItems.Add(drp_audenc_1.Text); - newTrack.SubItems.Add(drp_audmix_1.Text); - newTrack.SubItems.Add(drp_audsr_1.Text); - newTrack.SubItems.Add(drp_audbit_1.Text); - newTrack.SubItems.Add(lbl_drc.Text); + newTrack.SubItems.Add(drp_audioTrack.Text); + newTrack.SubItems.Add(drp_audioEncoder.Text); + newTrack.SubItems.Add(drp_audioMix.Text); + newTrack.SubItems.Add(drp_audioSample.Text); + newTrack.SubItems.Add(drp_audioBitrate.Text); + newTrack.SubItems.Add(value.ToString()); lv_audioList.Items.Add(newTrack); // The Audio List has changed to raise the event. @@ -216,11 +223,12 @@ namespace Handbrake.Controls // Public Functions public void setTrackList(Parsing.Title selectedTitle) { - drp_track1Audio.Items.Clear(); - drp_track1Audio.Items.Add("Automatic"); - drp_track1Audio.Items.Add("None"); - drp_track1Audio.Items.AddRange(selectedTitle.AudioTracks.ToArray()); - drp_track1Audio.SelectedIndex = 0; + drp_audioTrack.Items.Clear(); + drp_audioTrack.Items.Add("Automatic"); + drp_audioTrack.Items.Add("None"); + drp_audioTrack.Items.AddRange(selectedTitle.AudioTracks.ToArray()); + drp_audioTrack.SelectedIndex = 0; + drp_audioMix.SelectedIndex = 0; } public ListView getAudioPanel() { @@ -230,32 +238,32 @@ namespace Handbrake.Controls { if ((path.Contains("MP4")) || (path.Contains("M4V"))) { - string oldval = drp_audenc_1.Text; - drp_audenc_1.Items.Clear(); - drp_audenc_1.Items.Add("AAC (faac)"); - drp_audenc_1.Items.Add("AC3 Passthru"); + string oldval = drp_audioEncoder.Text; + drp_audioEncoder.Items.Clear(); + drp_audioEncoder.Items.Add("AAC (faac)"); + drp_audioEncoder.Items.Add("AC3 Passthru"); if ((oldval != "AAC (faac)") && (oldval != "AC3 Passthru")) - drp_audenc_1.SelectedIndex = 0; + drp_audioEncoder.SelectedIndex = 0; } else if (path.Contains("MKV")) { - drp_audenc_1.Items.Clear(); - drp_audenc_1.Items.Add("AAC (faac)"); - drp_audenc_1.Items.Add("MP3 (lame)"); - drp_audenc_1.Items.Add("AC3 Passthru"); - drp_audenc_1.Items.Add("DTS Passthru"); - drp_audenc_1.Items.Add("Vorbis (vorbis)"); + drp_audioEncoder.Items.Clear(); + drp_audioEncoder.Items.Add("AAC (faac)"); + drp_audioEncoder.Items.Add("MP3 (lame)"); + drp_audioEncoder.Items.Add("AC3 Passthru"); + drp_audioEncoder.Items.Add("DTS Passthru"); + drp_audioEncoder.Items.Add("Vorbis (vorbis)"); - if (drp_audenc_1.Text == string.Empty) - drp_audenc_1.SelectedIndex = 0; + if (drp_audioEncoder.Text == string.Empty) + drp_audioEncoder.SelectedIndex = 0; } // Make sure the table is updated with new audio codecs foreach (ListViewItem row in lv_audioList.Items) { - if (!drp_audenc_1.Items.Contains(row.SubItems[2].Text)) - row.SubItems[2].Text = drp_audenc_1.Items[0].ToString(); + if (!drp_audioEncoder.Items.Contains(row.SubItems[2].Text)) + row.SubItems[2].Text = drp_audioEncoder.Items[0].ToString(); } } public void addTrackForPreset(ListViewItem item) @@ -285,85 +293,52 @@ namespace Handbrake.Controls i++; } } - private static void setBitrateSelections384(ComboBox dropDown) - { - dropDown.Items.Clear(); - dropDown.Items.Add("32"); - dropDown.Items.Add("40"); - dropDown.Items.Add("48"); - dropDown.Items.Add("56"); - dropDown.Items.Add("64"); - dropDown.Items.Add("80"); - dropDown.Items.Add("86"); - dropDown.Items.Add("112"); - dropDown.Items.Add("128"); - dropDown.Items.Add("160"); - dropDown.Items.Add("192"); - dropDown.Items.Add("224"); - dropDown.Items.Add("256"); - dropDown.Items.Add("320"); - dropDown.Items.Add("384"); - } - private static void setBitrateSelections320(ComboBox dropDown) + private void setBitrate(int max) { - dropDown.Items.Clear(); - dropDown.Items.Add("32"); - dropDown.Items.Add("40"); - dropDown.Items.Add("48"); - dropDown.Items.Add("56"); - dropDown.Items.Add("64"); - dropDown.Items.Add("80"); - dropDown.Items.Add("86"); - dropDown.Items.Add("112"); - dropDown.Items.Add("128"); - dropDown.Items.Add("160"); - dropDown.Items.Add("192"); - dropDown.Items.Add("224"); - dropDown.Items.Add("256"); - dropDown.Items.Add("320"); - } - private static void setBitrateSelections160(ComboBox dropDown) - { - dropDown.Items.Clear(); - dropDown.Items.Add("32"); - dropDown.Items.Add("40"); - dropDown.Items.Add("48"); - dropDown.Items.Add("56"); - dropDown.Items.Add("64"); - dropDown.Items.Add("80"); - dropDown.Items.Add("86"); - dropDown.Items.Add("112"); - dropDown.Items.Add("128"); - dropDown.Items.Add("160"); - } - private static void setMixDownAllOptions(ComboBox dropdown) - { - dropdown.Items.Clear(); - dropdown.Items.Add("Automatic"); - dropdown.Items.Add("Mono"); - dropdown.Items.Add("Stereo"); - dropdown.Items.Add("Dolby Surround"); - dropdown.Items.Add("Dolby Pro Logic II"); - dropdown.Items.Add("6 Channel Discrete"); + if (max > 160) + { + drp_audioBitrate.Items.Add("192"); + drp_audioBitrate.Items.Add("224"); + drp_audioBitrate.Items.Add("256"); + drp_audioBitrate.Items.Add("320"); + if (max == 384) + drp_audioBitrate.Items.Add("384"); + else + drp_audioBitrate.Items.Remove("384"); + } + else + { + drp_audioBitrate.Items.Remove("192"); + drp_audioBitrate.Items.Remove("224"); + drp_audioBitrate.Items.Remove("256"); + drp_audioBitrate.Items.Remove("320"); + drp_audioBitrate.Items.Remove("384"); + } + if (drp_audioBitrate.SelectedItem == null) + drp_audioBitrate.SelectedIndex = drp_audioBitrate.Items.Count - 1; } - private static void setMixDownNotAAC(ComboBox dropdown) + private void setMixDown(Boolean aac) { - dropdown.Items.Clear(); - dropdown.Items.Add("Automatic"); - dropdown.Items.Add("Stereo"); - dropdown.Items.Add("Dolby Surround"); - dropdown.Items.Add("Dolby Pro Logic II"); + drp_audioMix.Items.Clear(); + drp_audioMix.Items.Add("Automatic"); + if (aac) + drp_audioMix.Items.Add("Mono"); + drp_audioMix.Items.Add("Stereo"); + drp_audioMix.Items.Add("Dolby Surround"); + drp_audioMix.Items.Add("Dolby Pro Logic II"); + if (aac) + drp_audioMix.Items.Add("6 Channel Discrete"); } private void lv_audioList_SelectedIndexChanged(object sender, EventArgs e) { // Set the dropdown controls based on the selected item in the Audio List. if (lv_audioList.Items.Count != 0 && lv_audioList.SelectedIndices.Count != 0) { - drp_track1Audio.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[1].Text; - drp_audenc_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text; - drp_audmix_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text; - drp_audsr_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text; - drp_audbit_1.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text; + drp_audioTrack.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[1].Text; + drp_audioEncoder.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[2].Text; + drp_audioMix.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[3].Text; + drp_audioSample.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[4].Text; + drp_audioBitrate.SelectedItem = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[5].Text; double drcValue; int drcCalculated; double.TryParse(lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text, out drcValue); if (drcValue == 0) drcCalculated = 0; @@ -371,6 +346,7 @@ namespace Handbrake.Controls drcValue = ((drcValue * 10) + 1) - 10; int.TryParse(drcValue.ToString(), out drcCalculated); tb_drc.Value = drcCalculated; + lbl_drc.Text = lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[6].Text; AudioTrackGroup.Text = "Selected Track: " + lv_audioList.Items[lv_audioList.SelectedIndices[0]].SubItems[0].Text; } @@ -379,4 +355,4 @@ namespace Handbrake.Controls } } -} +} \ No newline at end of file -- 2.40.0