Wav file (.wav)

Introduction

Wav files can be used for sound effects in Glue. Wav files, which are uncompressed, are used because compression can introduce latency (delay before the sound plays).

Adding a .wav to a Glue project

To add a .wav file to Glue:

  1. Right-click on a Screen or Entity’s “Files” item
  2. Select “Add File”->”Existing File”
  3. Navigate to the location of the .wav that you would like to use and click OK

You should see the .wav file in your Glue project:

WavInGlue.png

Playing a SoundEffect in custom code

Once a .wav file has been added to your Glue project, Glue will generate an instance of a SoundEffect in generated code. In this example, I’ve added a file called GunShotSound.wav, so the object that Glue creates is called GunShotSound. The following code can be added to CustomActivity to play the sound when the space bar is pressed:

For more information on SoundEffect in FlatRedBall, see theSoundEffect page.