blob: 616d40f70855659bae776a1835273fc359e455d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/* Advanced Audio.cs
This file is part of the HandBrake source code.
Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
namespace Handbrake.ToolWindows
{
using System;
using System.Windows.Forms;
using HandBrake.ApplicationServices.Model.Encoding;
/// <summary>
/// Advanced Audio Panel
/// </summary>
public partial class AdvancedAudio : Form
{
public AdvancedAudio()
{
InitializeComponent();
}
private AudioTrack track;
/// <summary>
/// Gets or sets the Audio Track to alter.
/// </summary>
public AudioTrack Track
{
get
{
return this.track;
}
set
{
this.track = value;
if (this.track == null)
{
return;
}
// Set the Gain Control.
if (track.Gain == 0)
{
gainTrackBar.Value = 21; // The centre point
}
else if (track.Gain > 0)
{
gainTrackBar.Value = 21 + track.Gain;
}
else if (track.Gain < 0)
{
gainTrackBar.Value = 20 - Math.Abs(track.Gain);
}
lbl_GainValue.Text = string.Format("{0} dB", track.Gain);
}
}
/// <summary>
/// Close the window
/// </summary>
/// <param name="sender">The Sender</param>
/// <param name="e">The Event Args</param>
private void btn_close_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
/// <summary>
/// Set the Gain value for the audio track.
/// </summary>
/// <param name="sender">The Sender</param>
/// <param name="e">The Event Arg</param>
private void gainTrackBar_Scroll(object sender, EventArgs e)
{
// Figure out the Gain.
int gain = 0;
if (gainTrackBar.Value == 21)
{
gain = 0;
}
else if (gainTrackBar.Value > 21)
{
gain = gainTrackBar.Value - 21;
}
else if (gainTrackBar.Value < 21)
{
gain = (-20 + gainTrackBar.Value);
}
lbl_GainValue.Text = string.Format("{0} dB", gain);
// Set the model.
if (this.track == null)
{
return;
}
this.Track.Gain = gain;
}
}
}
|