________________________________ De : wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] De la part de Tim Roberts Envoyé : jeudi 13 novembre 2008 19:12 À : wdmaudiodev@xxxxxxxxxxxxx Objet : [wdmaudiodev] Re: WaveCyclicStream::Silence() does not clear all old audio data Markus Bollinger wrote: With a MSVAD style WaveCyclic driver I observe a strange behaviour under Windows XP SP3 : The PortClass calls to IMiniportWaveCyclicStream::Silence() function do not clear all old audio data in the cyclic buffer. Right. The Silence method is basically a shortcut for RtlZeroMemory. It clears out whatever part of the buffer you tell it. It doesn't change the rest of the buffer. Yes, sure, in general it periodically wipes out a certain amount of data in the buffer (in most cases 12,5 ms of audio data), but in the case of timer notifications that happen every 15 ms it will leave 2,5 milliseconds of audio data in the buffer uncleared ! I found it : If there is an application that changes the Timer Resolution (timeBeginPeriod) to 10 ms or less (MediaPlayer changes it to ~4 ms), my driver timer notification gets called every ~10 ms as wished and everything is ok !!! Do I always need an application be present in the system that changes the timer resolution, or can this be done in the driver ??? During KSSTATE_RUN this is no problem due to new audio data coming in with CopyTo() that will be played. But when the application stops to play, CopyTo() function is no more called and the hardware continues to play until KSSTATE_PAUSE is called. As a result all fragments of old audio data that were not cleared by Silence() are played again. Well, how long of a delay do you see between the application stopping the graph and the transition to KSSTATE_PAUSE? That should happen almost instantaneously. With WinAmp there are 4 seconds between it's fade out and state pause. On many other applications if you click the Pause button and not the stop, it will be similar, Like MSVAD I use KeSetTimerEx to generate the necessary notifications every 10 ms, but in reality the real intervals will be greater than 10 ms, in many systems 15,625 ms !! Quite possible. KeSetTimerEx promises a minimum interval, not an exact interval. -- Tim Roberts, timr@xxxxxxxxx Providenza & Boekelheide, Inc.