tailieunhanh - Microsoft XNA Game Studio Creator’s Guide- P17

Microsoft XNA Game Studio Creator’s Guide- P17:The release of the XNA platform and specifically the ability for anyone to write Xbox 360 console games was truly a major progression in the game-programming world. Before XNA, it was simply too complicated and costly for a student, software hobbyist, or independent game developer to gain access to a decent development kit for a major console platform. | This page intentionally left blank c 27 CHAPTER Game Adding Audio to Your AUDIO effects not only raise the appeal of a game but you can also use them to challenge players to make judgments based on sound. This chapter shows you how to add audio to your game and create audio depth. With 3D audio enabled you can actually tell where things are just by their sounds. For example if you heard distant footsteps in your right ear but could not see anybody walking you would know that somebody is walking behind you off to the right. If you were to turn 180 degrees you would see the person walking and the sound would be louder in your left ear. Your game will offer far more appeal and vibrancy with sounds throughout the environment and with music to match. About xact In addition to enabling 3D audio the XACT audio studio is intended to simplify the process of managing your audio files and sound cues. You can use it to organize wave files and to set their playback properties. XACT is installed as part of XNA Game Studio. Currently WAV wave AIF and AIFF audio interchange file format files are the only audio formats supported in XACT. If you want to play back other for-mats such as MP3 you can use the Song class in conjunction with the MediaPlayer class to load and play these types of files. HE SONG AND SOUNDEFFECT ALTERNATIVE 3D Audio from XACT will not work on the Zune. However a separate audio Application Programming Interface API is available to enable playback for your 2D games on the Zune. You can use this API in your PC and Xbox 360 projects as well. This audio library includes a Song class for playing MP3 audio files in conjunction with the MediaPlayer class. A SoundEffect class allows you to play wave files. Basically all you have to do is load your wave file and play it. This process is so much simpler than implementing audio with XACT the XNA community refers to it as play and forget. If you want to pause resume or set the volume of your SoundEffect objects you can .