How to: Group Audio Methods as an Operation Set
This topic shows you how you can group together XAudio2 methods so they take effect at the same time.
Declare a global operation set counter.
The operation set counter ensures that each operation set is unique.
UINT32 OperationSetCounter = 0;
Increment the global counter.
Each time you submit a new operation set, the global counter should increment to ensure each set is unique.
UINT32 OperationID = UINT32(InterlockedIncrement(LPLONG(&OperationSetCounter)));
Group the method calls by setting their operation set parameters.
Set the operation set parameters to the current value of the global counter.
hr = pSFXSourceVoice1->Start( 0, OperationID ); hr = pSFXSourceVoice2->Start( 0, OperationID ); hr = pSFXSourceVoice3->Start( 0, OperationID ); hr = pSFXSourceVoice4->Start( 0, OperationID );
Start the operation set.
After you call all the methods in the set, start the set by calling IXAudio2::CommitChanges with the current value of the global counter.