-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form4.cs
51 lines (47 loc) · 1.52 KB
/
Form4.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
using System;
using System.Windows.Forms;
using NAudio.Wave;
namespace AudioWizard
{
public partial class Form4 : Form
{
OpenFileDialog OFD;
public Form4()
{
InitializeComponent();
}
private void openButton_Click(object sender, EventArgs e)
{
OFD = new OpenFileDialog();
if(OFD.ShowDialog()==DialogResult.OK)
{
inputTextBox.Text = OFD.FileName;
OFD.Dispose();
}
}
private void convertButton_Click(object sender, EventArgs e)
{
MediaFoundationReader foundationReader = new MediaFoundationReader(OFD.FileName);
SaveFileDialog SFD = new SaveFileDialog();
SFD.Title = "Save here your file";
if (mp3RadioButton.Checked)
{
SFD.Filter = "MP3|*.mp3";
SFD.ShowDialog();
MediaFoundationEncoder.EncodeToMp3(foundationReader, SFD.FileName);
}
if (aacRadioButton.Checked)
{
SFD.Filter = "AAC|*.aac";
SFD.ShowDialog();
MediaFoundationEncoder.EncodeToAac(foundationReader, SFD.FileName);
}
if (wmaRadioButton.Checked)
{
SFD.Filter = "WMA|*.wma";
SFD.ShowDialog();
MediaFoundationEncoder.EncodeToWma(foundationReader, SFD.FileName);
}
}
}
}