SoundEffectInstance

Introduction

A SoundEffectInstance is a sound effect which provides a number of properties which can be used to modify how the sound is played back - for example volume, pitch, and whether the sound is looping. If a SoundEffectInstance is playing, it cannot be played again until the sound ends, or until the SoundEffectInstance is explicitly stopped. This can give precise control over how many sounds are playing at one time.

How to create a SoundEffectInstance

To add a SoundEffectInstance to your project:

  1. Make sure you have a Glue project with a Screen or Entity which will contain the SoundEffectInstance.

  2. Add a new WAV file to your Screen or Entity. For more information, the .WAV file page.

At this point the SoundEffectInstance will be available in code, but you cannot change any variables on the SoundEffectInstance. To do this:

  1. Right-click on Objects

  2. Select "Add Object"

  3. Select the "From File" option

  4. Select the .wav file you added as a file

  5. Click OK

  6. Select the newly-created object

  7. Change "SourceName" to "Entire File (SoundEffectInstance)"

Modifying Variables

// 50% volume:
SoundEffectInstanceObject.Volume = .5f;

// Pan it full left:
SoundEffectInstanceObject.Pan = -1.0f;

Last updated