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:
- Right-click on a Screen or Entity’s “Files” item
- Select “Add File”->”Existing File”
- 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:
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:
public void CustomActivity(bool firstTimeCalled)
For more information on SoundEffect in FlatRedBall, see theSoundEffect page.