We have an interesting problem with the audio playback and record. Our program uses the DirectDraw
Blt() function a lot, while play or record audio. Sometimes, when the
Blt() started, about 70-70 audio sample swaped in the played stream on analog output or in recorded input stream (we checked by gpio set-reset and oscilloscope). The InputBufferSize and OutputBufferSize in the registry is 256. We use the Winmm API. This issue is independent from the buffers start and end. The program uses one CPU core at about 50%. I attached an oscilloscope screen of the signal.
I can reproduce similar issue with your directshow audio playback demo, if I add a small code, that fill the display with random content in a loop with Directdraw
Blt() function (I attached the code also). The issue appear when the InputBufferSize and OutputBufferSize is below 512. For us the small buffer size is important, because of the low latency. Do you have any ideas? Maybe this is a Windows limitation?
I tried modify the
priority256 parameter in the registry (0, 1, 10, 100, 254) but it had no effect on the problem. I didn’t change anything in processor extensions. I tried to set the threads priority and affinity in a different variats, but the result is not clear. Sometimes it improves ,if the threads running only on the 1st processor core, audio on the highest priority and
Blt() the lowest. If only the
Blt() was on the second core, it wasn’t good.
Blt() a hardware-implemented function? If not, might this be a memory management issue?
Thank you for your patience!.
BLT is hardware acceleration enabled. There are few options to play around GPU configuration shown below
; These regsitry settings are needed for Vivante GDI/DD accelerator:
; GC2DAcceleratorEnable: enable different feature
; Bit0: set 1 to enable BLTPREPARE
; Bit1: set 1 to enable ALPHABLEND
; Bit2: set 1 to enable TRANSPARENT
; Bit3: set 1 to enable STRETCH
; Bit4: set 1 to enable MASK
; GC2DAcceleratorSyncMode: set different sync mode
; 0: force mode
; 1: async mode
; 2: full async mode
; The following settings balance CPU and GPU capibility.
; GC2DAcceleratorMinSize: set the min pixel number for hardware to render
; GC2DAcceleratorMinPixelForSimpleSrcCopy: set the min pixel number for simple src copy
; GC2DAcceleratorMinPixelForSimpleSolidFill: set the min pixel number for simple solid fill
; GC2DAcceleratorMinPixelForMask: set the min pixel number for masked blit
Could you try a few options and let us know is that makes any difference?
Also, Could you share 200Hz_s.wav file to us?
Dear @vighbalazs ,
Any chance, did you go through this thread:
Thank you your answer. I will try these options. I attached the wav file.