> I’m working on a better version which attempts to maintain sample granularity > but eliminates the slop. OK, I think I have something. Just want to run it few some tests before I share. Unfortunately the WaveCyclic model does not allow miniports to report a correlated time + QPC, so extrapolation is forced. MSVad doesn't care much, but hardware-based drivers are affected. ________________________________ From: Gaurav Khuntale<mailto:gauravkhuntale@xxxxxxxxx> Sent: 5/5/2014 7:01 AM To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx> Subject: [wdmaudiodev] Re: Need help in Passing a test case from KS-Position test Hi Matthew, I tried below code in GetPosition() and driver passed the test case. ULONGLONG currentTime = KeQueryInterruptTime(); ULONG timeElapsedInNS = (ULONG) (currentTime - m_ullDmaTimeStamp); // Diff in nanoseconds ULONGLONG bytesDisplaceMent = (ULONGLONG)( (ULONGLONG)m_ulDmaMovementRate * (ULONGLONG)timeElapsedInNS ) / 10000000; m_ulDmaPosition = (m_ulDmaPosition + (ULONG)bytesDisplaceMent) % m_ulDmaBufferSize; *Position = m_ulDmaPosition; m_ullDmaTimeStamp = currentTime; Is this a proper way to update position from GetPosition? Thanks, Gaurav On Sun, May 4, 2014 at 10:19 AM, Gaurav Khuntale <gauravkhuntale@xxxxxxxxx<mailto:gauravkhuntale@xxxxxxxxx>> wrote: Hmmm..i don't have a way to get a position from the layer below me because i am throwing the data over the network after processing it. I don't have any hardware for which my driver is working. Can you please let me know when your better version with sample granularity is ready? Thanks. On Sat, May 3, 2014 at 6:09 PM, Matthew van Eerde <Matthew.van.Eerde@xxxxxxxxxxxxx<mailto:Matthew.van.Eerde@xxxxxxxxxxxxx>> wrote: Do you have any way of getting a real position from the layer below you? That would be much better than relying on KeQueryInterruptTime(). Or are you throwing the data on the floor like MSVad does? Don’t use my code; it’s just a proof-of-concept to demonstrate that you can get much better than 0.29 ms jitter using sample accuracy instead of millisecond accuracy. In particular, I really don’t like this line: ULONG ulByteDisplacement = (ULONG)((m_ulDmaMovementRate * ullElapsed + ullHnsInHalfASec) / ullHnsPerSec); This line introduces slop into the byte position which accumulates over time. I think that’s why my skew actually regressed (but I’m not sure.) I’m working on a better version which attempts to maintain sample granularity but eliminates the slop.