private void DoBatchProcess() { try { string inputfile, outputfile; if (GetSingleInputFile(out inputfile, out outputfile)) { var buf2 = AudioFileReader.ReadAllSamples(inputfile); for (int k = 0; k < listBox_procs.Items.Count; k++) { string query = (string)listBox_procs.Items[k]; var proc = AudioProcessFactory.FromString(query); buf2 = proc.Do(buf2); } WaveFileWriter.WriteAllSamples(outputfile, buf2, buf2.Length, 44100, 32); // FIXME: サンプリングレートとビット深度 } } catch (Exception e) { MessageBox.Show("エラーが起きちゃった・・・ごめんね・・・。\r\n\r\nstack trace: \r\n" + e.ToString(), "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button_conv_Click(object sender, EventArgs e) { if (textBox_ir.Text == "") { MessageBox.Show("インパルス応答の入力ファイルの欄が空欄になってるよ!"); textBox_ir.Text = "【ここだよ!!】"; return; } if (!AudioFileReader.FileExists(textBox_ir.Text)) { MessageBox.Show("インパルス応答の入力ファイルが無いよー? : " + textBox_ir.Text); return; } var buf2 = AudioFileReader.ReadAllSamples(textBox_ir.Text); DoSingleProcess(new Convolution(buf2)); }
private void DoSingleProcess(AudioProcess proc) { try { string inputfile, outputfile; if (GetSingleInputFile(out inputfile, out outputfile)) { var buf2 = AudioFileReader.ReadAllSamples(inputfile); var buf3 = proc.Do(buf2); // TODO: 勝手に違う拡張子のファイルを探すのはやめる WaveFileWriter.WriteAllSamples(outputfile, buf3, buf3.Length, 44100, 32); // FIXME: サンプリングレートとビット深度 } } catch (Exception e) { MessageBox.Show("エラーが起きちゃった・・・ごめんね・・・。\r\n\r\nstack trace: \r\n" + e.ToString(), "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); } }