/// <summary> /// Plays test audio. /// </summary> private void PlayTestAudio() { try{ using (FileStream fs = File.OpenRead(m_PlayFile)){ byte[] buffer = new byte[400]; int readedCount = fs.Read(buffer, 0, buffer.Length); long lastSendTime = DateTime.Now.Ticks; while (m_IsSendingTest && readedCount > 0) { // Send and read next. m_pWaveOut.Write(buffer, 0, readedCount); readedCount = fs.Read(buffer, 0, buffer.Length); Thread.Sleep(25); lastSendTime = DateTime.Now.Ticks; } } } catch (Exception x) { MessageBox.Show(null, "Error: " + x.ToString(), "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error); } }