/// <summary> /// This is the function that actually performs the audio merging and runs as in a separate thread. /// </summary> private void AudioMergeWorker() { mAppForm.UseWaitCursor = true; try { // Disable the audio merge GUI elements on the main GUI mAppForm.DisableAudioMergeGUIElements(); // Merge the audio files. When done, set the status text in the GUI to say "Done.". WAVFile.MergeAudioFiles(mAudioFilenames, mDestFilename, mTempDir); // Clean and remove the temporary directory String retval = UtilityFunctions.DeleteDir(mTempDir); if (retval != "") { MessageBox.Show(mAppForm, "Error removing temporary directory:\n" + mTempDir + "\n" + retval, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (WAVFileAudioMergeException exc) { MessageBox.Show(mAppForm, "Audio merge exception: " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (WAVFileException exc) { MessageBox.Show(mAppForm, "WAV file exception: " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exc) { MessageBox.Show(mAppForm, exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } try { mAppForm.SetStatusLabel1Text("Done."); // Re-enable the audio merge GUI elements on the main GUI mAppForm.EnableAudioMergeGUIElements(); } catch (Exception exc) { MessageBox.Show(mAppForm, exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } mAppForm.UseWaitCursor = false; }
private void button5_Click(object sender, EventArgs e) { WAVFile.MergeAudioFiles(_filePaths, "HY_" + CommonUtil.GetTimeStamp() + ".wav", "waveTest"); }