[wdmaudiodev] Re: buffering samples in an APO

  • From: Abhinav Singh <abhinav4ever@xxxxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Thu, 18 Dec 2014 00:11:18 +0530

I totally forgot to implement GetLatency(..)..will add it to the APO.
However, my problem is slightly different. I have tried to explain it clearer 
with an example below:I am maintaining my own internal input and output 
buffer(separate from the FLOAT32 buffer point passed to the APOProcess(..) 
function.At 44.1 kHz, I will get 448 samples per call to APOProcess(). However, 
since my DSP algorithm only works with say exactly 768 samples, i will 
internally buffer the input received from APOProcess(...) until i have enough 
samples to process. I am also maintaining an internal output buffer where i 
will store the processed audio samples.I process audio samples when the samples 
count in my internal buffer exceeds 767 and store the processed audio stream in 
my internal output buffer.If i have enough samples in my internal output 
buffer(>=448),i will copy to APOProcess(..)'s output buffer otherwise i just 
set the first 448 samples in the APOProcess(..)'s output buffer with zero.So 
the very first call to APOProces(...), i will just buffer the input and send 
zeros as the output. However during the second call to APOProcess(..) i will 
have enough data to process and also send valid output(not zeros).Now, at the 
very end , my own internal input and output buffer might have some samples 
leftover and i was wondering if there are any workaround around this buffering 
problem without changing the DSP algorithm.

From: soccerl@xxxxxxxxxxxxx
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: buffering samples in an APO
Date: Tue, 16 Dec 2014 00:13:35 +0000

Is this a 100% repro?  Which OS version is it?
An APO has no idea on when the stream will end. If an audio application stops 
its streaming before the end of stream, I am not sure whether APO could do 
 with this situation.

From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx]
On Behalf Of Matthew van Eerde

Sent: Monday, December 15, 2014 10:23 AM

To: wdmaudiodev@xxxxxxxxxxxxx

Subject: [wdmaudiodev] Re: buffering samples in an APO

Make sure you implement IAudioProcessingObject::GetLatency(…), and report the 
delay between your input and output.
If an app cares about its sound playing all the way through to the very last 
byte, the design is for the IAudioClient to pad silence onto the end of the 
 and keep pumping silence until IAudioClock indicates that the very last byte 
has made it all the way through the speaker.

wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx]
On Behalf Of Abhinav Singh

Sent: Monday, December 15, 2014 10:12 AM

To: wdmaudiodev@xxxxxxxxxxxxx

Subject: [wdmaudiodev] buffering samples in an APO


I am trying to integrate a DSP algorithm with my GFX APO which requires a fixed 
number of samples greater than the number of samples i get every time the Audio 
Engine calls the APOProcess()
 function of my APO. So i buffer the samples until i have the required number 
of samples and feed the audio engine zeros until i have valid output to feed to 
the engine. This works but there is a loss of few samples at the very end(some 
samples remain unprocessed
 in the input buffer while some are left over in the output buffer ). Is there 
any workaround to this problem?


Other related posts: