forked from BearWare/TeamTalk5
-
Notifications
You must be signed in to change notification settings - Fork 1
/
AudioStorageDlg.cs
104 lines (95 loc) · 3.42 KB
/
AudioStorageDlg.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
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
/*
* Copyright (c) 2005-2018, BearWare.dk
*
* Contact Information:
*
* Bjoern D. Rasmussen
* Kirketoften 5
* DK-8260 Viby J
* Denmark
* Email: [email protected]
* Phone: +45 20 20 54 59
* Web: http://www.bearware.dk
*
* This source code is part of the TeamTalk SDK owned by
* BearWare.dk. Use of this file, or its compiled unit, requires a
* TeamTalk SDK License Key issued by BearWare.dk.
*
* The TeamTalk SDK License Agreement along with its Terms and
* Conditions are outlined in the file License.txt included with the
* TeamTalk SDK distribution.
*
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using BearWare;
namespace TeamTalkApp.NET
{
struct AudioFormat
{
public AudioFileFormat aff;
public string name;
public AudioFormat(AudioFileFormat aff, string name)
{
this.aff = aff; this.name = name;
}
public override string ToString()
{
return name;
}
}
public partial class AudioStorageDlg : Form
{
Settings settings;
public AudioStorageDlg(Settings settings)
{
this.settings = settings;
InitializeComponent();
this.CenterToScreen();
fileformatComboBox.Items.Add(new AudioFormat(AudioFileFormat.AFF_WAVE_FORMAT, "Wave format"));
fileformatComboBox.Items.Add(new AudioFormat(AudioFileFormat.AFF_MP3_64KBIT_FORMAT, "MP3 format (64kbit)"));
fileformatComboBox.Items.Add(new AudioFormat(AudioFileFormat.AFF_MP3_128KBIT_FORMAT, "MP3 format (128kbit)"));
fileformatComboBox.Items.Add(new AudioFormat(AudioFileFormat.AFF_MP3_256KBIT_FORMAT, "MP3 format (256kbit)"));
fileformatComboBox.SelectedIndex = 0;
}
private void button3_Click(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
folderpathTextBox.Text = folderBrowserDialog1.SelectedPath;
}
private void button1_Click(object sender, EventArgs e)
{
if (!Directory.Exists(folderpathTextBox.Text))
{
MessageBox.Show("Folder for audio storage doesn't exist", "Folder for audio files");
return;
}
AudioFileFormat aff = ((AudioFormat)fileformatComboBox.SelectedItem).aff;
settings.aff = aff;
settings.audiofolder = folderpathTextBox.Text;
settings.muxed_audio_file = muxedRadioButton.Checked;
}
private void fileformatComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
AudioFileFormat aff = ((AudioFormat)fileformatComboBox.SelectedItem).aff;
if (!File.Exists("lame_enc.dll"))
{
switch (aff)
{
case AudioFileFormat.AFF_MP3_64KBIT_FORMAT:
case AudioFileFormat.AFF_MP3_128KBIT_FORMAT:
case AudioFileFormat.AFF_MP3_256KBIT_FORMAT:
MessageBox.Show("DLL file lame_enc.dll is required for MP3 encoding");
fileformatComboBox.SelectedIndex = 0;
break;
}
}
}
}
}