首页 > Computer > XNA > How To: Add a Sound File to Your Game Using XACT
2009
02-22

How To: Add a Sound File to Your Game Using XACT

Demonstrates how to add wave (.WAV) files to an XACT project that can be built and interpreted by an XNA Game Studio game to play audio.

For detailed information about how to author audio in the XACT tool, including information on categories, variables, and other advanced features, see XACT Audio Authoring.

Adding a Sound File to Your Game

To create a wave bank and a sound bank

  1. From the Start menu, click All Programs, click XNA Game Studio 3.0, click Tools, and then click Microsoft Cross-Platform Audio Creation Tool (XACT).

  2. To create a new project, click the File menu, and then click New Project.

    You will be asked for a location and a name for your project.

  3. Enter a name and a location that is easy for you to remember, and click OK.

    The project will be created, and the screen will resemble the following:

  4. In the empty project, create a wave bank. To do this, click Wave Banks, and then click New Wave Bank.

    A new wave bank appears in the tree view under Wave Banks with the default name “Wave Bank.”

  5. Press ENTER to accept the default name.

  6. To create a new sound bank, click Sound Banks, and then click New Sound Bank.

    A new sound bank appears in the tree view under Sound Banks with the default name “Sound Bank.”

  7. Press ENTER to accept the default name.

    At this point, two new windows have appeared: one for the wave bank and one for the sound bank.

  8. To arrange these windows for easier viewing, click Window, and then click Tile Horizontally.

    The windows should now look similar to the following:

To add wave files to the wave bank window

Now you need to add your wave file to the wave bank window.

  1. To make sure the wave bank window is active, click Wave Banks, and then click Insert Wave File(s).

  2. Insert one or more wave files into the wave bank.

    If you successfully added them, they will look similar to the following wave bank window:

    Now you need to perform the following step for each wave listed in the wave bank window.

  3. For each wave listed in the wave bank window, drag the wave from the wave bank window to the sound bank window, and then drop the wave on top of the Cue Name panel.

    XACT automatically creates a new cue that is linked to a new sound that plays this wave file. It should look similar to the following:

  4. If the lower-left corner of the sound bank window does not have any entries, add entries to it by dragging each sound from the upper-left panel of the sound bank to the lower left panel of the sound bank.

    This action creates cues that correspond to the sounds.

  5. To save the project, click File, and then click Save Project.

  6. Click File, and then Build… to build your project.

You are now ready to load and play sounds from this project in your game. See How To: Play a Sound for information on how to do this.

最后编辑:
作者:wy182000
这个作者貌似有点懒,什么都没有留下。

留下一个回复