The Windows audio clock is driven by the audio endpoint – that is to say, you.
You in turn are feeding an application, which is feeding a remote device. So to
avoid drift issues, you need to be driven by the remote device.
Once you’ve got that architected, implement IMiniportWaveCyclic::GetPosition so
as to keep pace with the remote device. Then it will all just work.
From: Matthieu Collette<mailto:matthieu.collette@xxxxxxx>
Sent: Tuesday, April 26, 2016 5:04 AM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] How to perform adaptative resampling ?
Hi,
I have modified the MSVAD driver sample to be able to send audio data to a
remote device.
This driver sends audio data to a local application using a connection oriented
socket, then this application sends audio data to the remote device using a
datagram oriented socket. As much as possible, audio data must not be altered
to preserve a bit perfect audio path from the driver to the remote playback
device.
It works almost as expected regardless the clock synchronisation I am actually
facing to, problem I am still struggling with.
When both the source (computer + driver) and remote playback device are
configured to use a specific audio format (sample rate, bit depth, channels,
...), I can see that after a few minutes of continuous playback, a buffer under
run occurs on the remote device. Less often it is a buffer over run but in both
cases, the problem is similar : both devices have a distinct clock which I can
synchronise.
I do not have access to the local streaming application nor I have access to
the remote playback device. The only feedback I have during playback is how
much the remote device playback buffer is filled, feedback sent by the remote
playback device.
Using this feedback, I want to maintain a constant amount of audio data in that
buffer, and to achieve that, I need a way to accelerate or slow down the pace
at which I send audio data from the driver to this remote device.
My driver implements both IDmaChannel and IMiniportWaveCyclicStream interfaces.
I wonder how, using such interfaces, I can slow down / accelerate the pace at
which I send audio data to the remote device in order to provide it a constant
amount of samples.
Could it be possible to use IMiniportWaveCyclicStream::SetNotificationFreq and
/ or IPortWaveCyclic::Notify method to do what I need ?
Assuming that I can just rely on the remote device audio feedback, is it
relevant to use a wave cyclic driver ?
Thanks in advance for any tips !
Cheers
Matt