Jump to content

  • Log In with Google      Sign In   
  • Create Account

The XAudio2 graph


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 SyncViews   Members   -  Reputation: 465

Like
0Likes
Like

Posted 12 February 2011 - 03:29 PM

Looking at XAudio2 to use as the sound system in a personal project (since Ive never done lower level sound stuff before and figured id give it a try, even if only to make space invaders with 7.1 surround sound :) ) .

It seems to me that there is many cases where the audio system needs to know about other voices. For example when shutting the game down I cant delete a voice while their are other voices sending to it, however in many places playing a sound is kind of "fire and forget" (eg an explosion) as far as the rest of the game cares, so I dont have that voice object to delete first until after xaudio2 gives me the stream end callback...

Have I missed something here that would let me walk the XAudio2 voice graph, or am I just going about this the wrong way? Or is the best general way for me to maintain my own audio graph even though there must be one of some sorts internally already???

Sponsor:

#2 Iveco   Members   -  Reputation: 104

Like
0Likes
Like

Posted 09 March 2011 - 06:01 AM

You can use XAudio2 callbacks or use the bufferstate of the SourceVoice directly, and check if this is empty.
XAUDIO2_VOICE_STATE state;
sourcevoice->GetState(&state);
if (state.pCurrentBufferContext == NULL && state.BuffersQueued == 0) 
{
  // SOUND FINISHED
}

When you shutdown the game, you can stop all you running SourceVoices and delete them afterwards (prior shutting down XAudio2).
Obviously this will produce glitches, lower the volumes for a few frames (fadeoff) until destroying it.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS