private void tagComboBox_SelectedIndexChanged(object sender, EventArgs e) { AudioTag tag = (AudioTag)tagComboBox.SelectedItem; startTxtBox.Text = tag.Start.ToString(); endTxtBox.Text = tag.End.ToString(); confidenceTxtBox.Text = tag.Confidence.ToString(); }
private void playBtn_Click(object sender, EventArgs e) { AudioTag tag = (AudioTag)tagComboBox.SelectedItem; if (tag != null && audioPath != "") { int margine = (int)margineNumerical.Value; var start = new TimeSpan(0, 0, 0, 0, tag.Start - margine); var end = new TimeSpan(0, 0, 0, 0, tag.End + margine); AudioPlayback.TrimPlayWAvFile(audioPath, start, end); } }
private void processBtn_Click(object sender, EventArgs e) { if (voiceFileTextBox.Text == "") { MessageBox.Show(this, "Please Selecte A Audio File", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (tagFileTextBox.Text == "") { MessageBox.Show(this, "Please Selecte A Tag File", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } tagComboBox.Items.Clear(); audioPath = voiceFileTextBox.Text; System.IO.StreamReader file = new System.IO.StreamReader(tagFileTextBox.Text); string line; List <String> words = new List <string>(); try { while ((line = file.ReadLine()) != null) { var parts = line.Split(' '); AudioTag tag = new AudioTag(); tag.Start = (int)(Convert.ToDouble(parts[0]) / 10000); tag.End = (int)(Convert.ToDouble(parts[1]) / 10000); tag.Tag = parts[2]; tag.Confidence = Convert.ToDouble(parts[3]); tagComboBox.Items.Add(tag); } } catch (Exception exception) { MessageBox.Show(this, "Input is not in correct format", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } tagComboBox.SelectedIndex = 0; }