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

Silly XAudio2 question regarding IXAudio2SourceVoice's - how many to use?

Last post 22/09/2009 16:31 by Iveco. 3 replies.
  • 21/09/2009 21:12

    Silly XAudio2 question regarding IXAudio2SourceVoice's - how many to use?

    Hey, I'm working on updating a game to use XAudio2 instead of Directsound. The way the game handles sounds is the standard affair - load some wav files, create dsound buffers for each and play them when required. I'm a little confused about the source voices - should I create a source voice for every sound I'm loading? I'm sure I saw a post on a forum somewhere saying no to that, but I can't find it now and i'm not 100% sure if that's actually what they said. If you're not supposed to create source voices for all the sounds that can potentially play in your game, how do you handle it? Do you create a pool of source buffers and find an empty one to use when it comes to play a sound? Is it a bad idea to create and release source voices whenever they're required or is there high overhead from doing this? I'm still working on implementing XAudio2 so I haven't had much of a chance to play around with this yet..any help would be appreciated!
  • 22/09/2009 12:37 In reply to

    Re: Silly XAudio2 question regarding IXAudio2SourceVoice's - how many to use?

    I recommend reading everything in the SDK about XAudio2 first. There are also a few good tutorials to start with. You will need SourceVoices for each sound but you only will need one MasterVoice. It's important to understand the XAudio2 audio graph (chain). SourceVoices can also be attached to SubMixVoices (effects processing voices). Therefore you can get the chain like: SourceVoice -> SubMixVoice -> MasterVoice (final output device/speakers). Probably you won't need SubMixVoices in the beginning. You can use callbacks from the engine to find out when particular sounds finished their playback and release the SourceVoice afterwards.

    http://www.gamasutra.com/view/feature/3525/sponsored_feature_an_introduction_.php?page=3

    Regards from Germany
  • 22/09/2009 15:05 In reply to

    Re: Silly XAudio2 question regarding IXAudio2SourceVoice's - how many to use?

    Thanks for that - I was hoping it'd be a case of a sourcevoice per sound. I tried it last night and I was hearing audio, only sounds were cutting off early or playing late. It's still a work in progress so i'm not worried about that yet. At least I know i'm on the right track! Thanks for the link too, looks good. Didn't see it while googling for some reason..
  • 22/09/2009 16:31 In reply to

    Re: Silly XAudio2 question regarding IXAudio2SourceVoice's - how many to use?

    Sure no problem. It's really hard to find useful information about XAudio2. This forum is also a very good source for further information. If you have anymore questions don't hesitate to post here.
    Regards from Germany
Page 1 of 1 (4 items) Previous Next