c # wav format audio playback using the SoundPlayer

1. SoundPlayer referenced class in the namespace System.Media 

    SoundPlayer player = new SoundPlayer();

2. The method call Play ();

 

Play void public ()
{
 player.SoundLocation = @. "\ x0pbk-swz4q.wav"; // read audio file
  player.Load (); // synchronous mode
  player.play ();
  IF (MessageBox.Show ( " play music by volume on the rotary knob to test the headset, if the normal sound playback option is contrary No "," prompt ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
{
   DisplaylistboxMSG (" headset test results abnormality ");
}
 the else
{

   DisplaylistboxMSG (" normal test result the Headset ");
}
    Player.stop (); // stop playback
    player.Dispose ();
}

 

Guess you like

Origin www.cnblogs.com/ouyangkai/p/11284025.html