Summary


In this chapter you learned all about sound effects in XNA. XACT is the tool you have to use, no matter if you think it is great or you are annoyed by it. XACT allows you to play sound effects and even music on the Xbox 360 and Windows with the help of the XNA Framework.

Here are all the important points about XACT you learned in this chapter:

  • XACT is the only way to play sounds on the Xbox 360 with XNA.

  • The XACT tool might be annoying at first, but once you get used to it you’ll enjoy the new cool features. For example, using the fade in and fade out settings for music items is much cooler to use than having to write your own fade in and out code.

  • MP3, OGG, or ACC compression or other custom compression formats are not supported by XACT. The only two formats supported are ADPCM for the Windows platform and XMA for the Xbox 360 platform.

  • XMA is a good and useful compression format for the Xbox 360, but ADPCM is not really useful. If you have the time and you want smaller sound files on Windows, implement DirectAudioVideoPlayback from the DirectX SDK into your engine or use other external sound engines for the Windows part of your game.

  • I recommend 75% quality for XMA and 128 or 256 samples per block for ADPCM. Whatever you choose you have to live with the fact that the Windows version of your game will probably be twice as big as the Xbox 360 version in XNA just because of the sound files and the bad ADPCM compression.

  • Make sure your Sound class is easy to use and accessible from everywhere.

  • Use the Sounds enum to quickly access and play all available sound cues.

  • Write helper methods for code you call often.

  • Setting custom cue variables is first configured in XACT and then programmed into your XNA code. SetVariable is the method for all the dirty cue instance variable modifying.

The next chapter discusses the Input class for handling the keyboard, the mouse, and the Xbox 360 gamepad controller devices, which is already in the graphics engine you wrote, but all the methods have not been discussed in detail. Additionally you will learn about the menu system and other UI (user interface) code that directly interacts with the Input class. For example, sounds are played by the UI code automatically every time you hover over a control or if you click a control. For custom controls you have to do all the checking and handling yourself. You will also learn more about the XNA Shooter game, which will then be completed in Chapter 11.




Professional XNA Game Programming
Professional XNA Programming: Building Games for Xbox 360 and Windows with XNA Game Studio 2.0
ISBN: 0470261285
EAN: 2147483647
Year: 2007
Pages: 138

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net