XNA Creators Club Online
Page 1 of 1 (1 items)
Sort Posts: Previous Next

Multiple soundbanks/wavebanks

Last post 08-30-2008 8:02 PM by CDarklock. 0 replies.
  • 08-30-2008 8:02 PM

    Multiple soundbanks/wavebanks

    I've been rearchitecting a little for my DBP entry, and something occurred to me.

    Currently, I have something of a hack together where my main Game object carries the audio objects, and the ScreenManager calls up to the main Game object to get and play cues. Individual GameObject instances carry a reference to the GameScreen which they use to access the ScreenManager and tell it what sounds to play. So getting a cue in the GameObject goes like this:

    cue = this -> screen -> manager -> game -> soundbank -> getCue

    This seems too complicated. So am I right in thinking I should have several soundbanks and wavebanks in my project? I've never seen any real discussion of this.

    Imagine that I have twelve different kinds of enemy, and each of them makes unique sound effects, but only three of them occur in any given level. Is it actually the intent of XACT that I should have each of these types of enemies carry its own soundbank and wavebank, instanced off the same AudioEngine, and create the necessary ones during the load of each level? This would leave the unused WaveBank objects unloaded when a particular enemy does not appear, and also create a localised SoundBank object that only a particular enemy type uses. During construction, the game object would call up to get the audioengine, and create its own sound and wave banks. Then there would be one call in the constructor that goes:

    bank = new soundbank( this -> screen -> manager -> game -> audioengine, "soundsforthisobject" )

    And getting the cue from then on is just bank -> getCue everywhere else in the object.

    Are there things I'm overlooking in this, or am I on the right track? Is anyone else doing this sort of thing?

Page 1 of 1 (1 items) Previous Next