This question is about windows audio session API. After reading microsoft's sample code, I find that after getting a IAudioClient, "GetService" Method is called on it to obtain a IAudioRenderClient. And then the GetBuffer and ReleaseBuffer method of IAudioRenderClient is called to add buffer to be played.
My question:
Why is IAudioRenderClient necessary, why not just put the GetBuffer and ReleaseBuffer method directly in IAudioClient? Namely when is the case we need multiple IAudioRenderClient for a single IAudioClient?
Since when we play audio, we always need a IAudioClient, and on this IAudioClient we call GetService to obtain a IAudioRenderClient, we don't have any chance to call CoCreateInstance() to create IAudioRenderClient do we? Then why do we need a IID for IAudioRenderClient?
==============================================================================
After some more reading, I think IAudioClient can be a IAudioRenderClient or a IAudioCaptureClient. But another question arise, why we call GetService to obtain IAudioRenderClient but not QueryInterface?