The recipes in this chapter provide routines for playing sound files and for displaying video clips and photos. One recipe even demonstrates the “new” functionality of Visual Basic 2005 that commands your computer’s internal speaker to emit a system-dependent beep. (That takes us back a few years!) More advanced recipes let you process the JPEG photos from your digital camera. No longer is C++ coding required to manipulate images with respectable speed. Visual Basic programmers now have access to a full set of powerful multimedia-processing features built right into .NET.
You want to play a sound clip file, a system sound, or a music file such as an MP3.
Several different objects and system utilities are available to play sound clips or media files. In this recipe we’ll demonstrate the use of:
SoundPlayer to play audio
clip files such as WAV files
My.Computer.Audio. PlaySystemSound() to play
activate Windows Media Player to play MP3 and other media
The code required to play an audio sample is actually quite
short. In most cases, a single line of code is all it takes to play a
sound. Visual Basic 2005’s new
namespace provides a lot of new easy-to-use functionality. The
My.Computer.Audio.Play() method is a good example. Simply pass this method the name of an audio file and the play mode that controls how the sound ...