forked from naudio/NAudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPropertiesForm.cs
55 lines (51 loc) · 1.89 KB
/
PropertiesForm.cs
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace MarkHeath.AudioUtils
{
public partial class PropertiesForm : Form
{
MixdownInfo mixdownInfo;
public PropertiesForm(MixdownInfo mixdownInfo)
{
InitializeComponent();
this.mixdownInfo = mixdownInfo;
textBoxDelay.Text = mixdownInfo.DelayMilliseconds.ToString();
textBoxOffset.Text = mixdownInfo.OffsetMilliseconds.ToString();
trackBarVolume.Value = mixdownInfo.VolumeDecibels;
trackBarVolume_Scroll(this, EventArgs.Empty);
}
private void trackBarVolume_Scroll(object sender, EventArgs e)
{
textBoxVolume.Text = String.Format("{0} dB", trackBarVolume.Value);
mixdownInfo.VolumeDecibels = trackBarVolume.Value;
}
private void buttonOK_Click(object sender, EventArgs e)
{
int delay = 0;
int offset = 0;
bool parse = Int32.TryParse(textBoxDelay.Text,out delay);
if(!parse || delay < 0)
{
MessageBox.Show("Please enter a valid number of milliseconds for the delay.");
textBoxDelay.Focus();
return;
}
parse = Int32.TryParse(textBoxOffset.Text, out offset);
if (!parse || offset < 0)
{
MessageBox.Show("Please enter a valid number of milliseconds to trim from the start.");
textBoxOffset.Focus();
return;
}
mixdownInfo.DelayMilliseconds = delay;
mixdownInfo.OffsetMilliseconds = offset;
mixdownInfo.VolumeDecibels = trackBarVolume.Value;
this.Close();
}
}
}