[wdmaudiodev] Re: Different amount of data in CopyFrom and CopyTo functions with same audio format.

  • From: Michail Nikolaev <michail.nikolaev@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Sun, 31 May 2009 19:19:03 +0300

Hello.Problem now is fixed.
In GetPosition method i check, if there is no 1920 bytes in buffer(now i use
48000) - i add *1920-AMOUNT_OF_DATA_IN_BUFFER* to returned position. In this
case system gets me new data to complete synchronization.

But now I have strange moment with latency on waveCyclic.
I take msvad simple example. Comment all in CopyTo and CopyFrom method(to
prevent writing data to disk). Build if with free enviroment.

And do next latency test(in real case with using a lot of buffers. This is
euilation of transfering data from virtual capture stream to render stream
in real device):
    Read some data from this virtual device(from capture stream),
    Wait for end of operation.
    Write simple tone to real-device render pin.
    Wait for end of operation.

And on "empty" msvad I've got delays in tone. But in case of using real
capture driver delays is very small. In case of VAC - there are no delays.

Why waveCyclic works so slowly? And how speed can be increased? Maybe i
should try to use wavePc?. Or msvad example hase some lattency problems(but
i can't see them)?

Thanks for any adventages..


2009/5/27 Tim Roberts <timr@xxxxxxxxx>

>  Michail Nikolaev wrote:
>
> How big is your buffer?
>
>
>  Nevermind. It is about 4096 * 32 bytes. But if it will overloaded - i'll
> get debug message. But problem is about empty buffer.
>
>
> OK, the lesson being that you can buffer about 750 milliseconds of data.
>
>
>  Did you mean milliseconds there (as opposed to "ns" nanoseconds)?  Do
>>
> you get ANY data from Media Player?  That is, do you get buffers which
>>
> then stop, or do you get no buffers at all?
>
>
>
>  Hm. I think it microseconds(I have not WDK at current moment - i use 
> KeStallProcessor*
> function).
>
>
> Most audio stacks try to send you 10 milliseconds of data at a time, so
> waiting for a number of microseconds is a useless exercise.  Also, remember
> that KeStallProcessor actually runs a tight CPU loop; if you have a single
> processor machine, then of course you aren't going to get any additional
> data, because the CPU is 100% busy doing your stall.  No other threads can
> run.  If you want to wait for more data to arrive, then you need to do
> something like KeDelayExecutionThread, which suspends your thread and allows
> other threads to run.
>
>
>  Yes i get data from Media Player. I heard it. But because there is no
> data in some moments - I write zeros (184 bytes). And it produces delay in
> sound.
>
>
> Well, there are no guarantees about the sizes of packets you get in and
> out, but sooner or later you should be able to get in sync.
>
> --
> Tim Roberts, timr@xxxxxxxxx
> Providenza & Boekelheide, Inc.
>
>

Other related posts: