I've been digging into xAudio recently and i failed to find some answers i need.
{ Not to waste your time - i need to find a way to get master voice current progress }
The thing is, - SourceVoice does provide a method to give it's state (https://msdn.microsoft.com/en-us/library/windows/desktop/hh405047(v=vs.85).aspx)
So, via this method we can get XAUDIO2_VOICE_STATE to calculate current position when the voice is playing.
But with xAudio SourceVoice isn't really our final entity to work with (or is it?!). Cause it all goes into a Mastering Voice before reaching the audio device.
And the IXAudio2MasteringVoice interface doesn't provide us with anything like GetState().
So my question is, - how do i get my current progress, if i need to synchronize a number of voices. Thank you in advance!
The 'master voice' represents the output device (which is really the start of the WASAPI chain that does a system-level mix and then puts the result in the actual hardware playback buffer). As such, there's no notion of 'progress' or 'sample position'. You can attach an effects chain, but that's about it.
The best way to synchronize voices is to use "operation sets" which ensure that multiple actions are all processed in the same frame, such as starting or stopping individual source voices as a group. See MSDN: XAudio2 Operation Sets.
You can also attach a IXAudio2VoiceCallback
to your source voices to get notification of progress on submitted work. See MSDN: XAudio2 Callbacks