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 enables you to specify 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 ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.