locked
Synchronization of Mic and Speaker on Windows Phone 8 RRS feed

  • Question

  • Hi,

    In a previous question of mine, James of MSFT noted that there should not be any clock drift between two devices when capturing and rendering using WASAPI on WP8, seeing as they use the same hardware clock. However, when I retrieve a QPC position value from either device-- GetBuffer() for the microphone can return a QPC value, and a call to GetPosition() for the render device will return one -- it seems as though there is 'drift'. This could be my misunderstanding of WASAPI, however. I understand that these QPC values reflect a high performance timer, but is that timer a reflection of the hardware clock? Or rather -- how, if at all, are the hardware clock and high performance timer associated?

    Here is my scenario: I have a loop that runs every 10ms (triggered by the microphone hardware interrupt), and each time I tell WASAPI to capture and render 10ms of data using corresponding calls to GetBuffer() and ReleaseBuffer(). (This approach is fully functional, as I've gotten clear and contiguous audio. However, in trying to implement echo cancellation, I've started to look into how synchronized the audio handling really is). I also grab the QPC value for each device on each loop. I expected to get a fairly consistent value when I took the difference of the two, but I've been getting values that jump around. For instance, in the beginning, the difference between the two QPC values will be around 30ms, but a minute into the program, it will be >100ms. Can someone help me figure out why this is the case?

    Thanks,

    Jim

    Monday, November 11, 2013 6:16 PM