Hi All.I have a WaveCyclic (msvad based) USB audio driver. It works perfectly except for one issue: lip-sync is not perfect and I would like to compensate for hardware/USB latencies to fix this.
According to MS docs, GetPosition() should start incrementing when in the RUN state. Also, GetPosition() is supposed to return the current sample position which is being output by the speakers. For my driver, there is about 30ms of USB buffering and then the USB audio device also buffers about 30ms. This amounts to a total hardware latency of 60ms. Since GetPosition() is supposed to return the buffer position currently being output by the DAC, this means that after entering KS_RUN state, GetPosition() should return 0 for about 60ms, and only then start to increment (since the hardware is not outputting the sample data for the first 60 ms).
The problem is that when GetPosition() is implemented to stay at position 0 for 60ms, WaveCyclic stops calling CopyTo() and the render stream stalls.
Does anyone know why this happens? Is this a bug in Wavecyclic? It should not stall under these conditions, right? This is how hardware latency should be handled no? The buffer size I report back to WaveCyclic is large enough to handle 60ms of data, and CopyTo() stalls after just 30ms... It's a mystery. One can repeat this problem by simply modifying MSVAD to return 0 for 60ms after entering KS_RUN state.
Any help is much appreciated! Thanks ****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.com/