Playing Audio Files
My.Computer.Audio provides three methods for audio files reproduction. The first one is Play, which can play a .Wav file. The following is an example:
My.Computer.Audio.Play("C:\MySound.Wav", AudioPlayMode.WaitToComplete)
You need to pass at least the filename as the first argument; as an alternative, you can pass the .wav file as a byte array or a FileStream. The AudioPlayMode enumeration allows specifying how the audio file needs to be played. WaitToComplete means that no other code will be executed until the reproduction ends; Background, which is the default setting, means that the audio is reproduced asynchronously; last, BackgroundLoop means that the audio file is reproduced in the loop until you explicitly invoke the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access