View Single Post
Old 12 October 2016, 18:38   #22
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,519
I did some testing with winuae.exe dated 2016-10-12 16:03. Pretty good results: no crackling with sound buffer set to Min in both windowed and non-vsync full-screen modes. My laptop is eight years old so you don't need super-fast hardware to benefit from low sound latency.

Some tips which might help:
  • Set power saving mode to high performance
  • Open Sound control panel. On the Enhancements tab, check the "Disable all enhancements" box.
Some notes:
  • With default format set to 16-bit 44.1kHz in Sound control panel, WinUAE set to WASAPI EX 48kHz, I could use buffer 1 but buffer Min didn't work. Later I changed default format in Sound control panel to 48kHz, after which WASAPI EX buffer Min did work.
  • Full-screen, no vsync mode works fine with graphics set to none, double- or triple-buffering. I can set sound buffer to Min and get no crackling. Variable sync seems to work the same as non-vsync mode (no sound crackling).
  • With (full-screen) low-latency vsync, or legacy vsync (which forces double-buffered graphics) I need to increase sound buffer to 3 or 4 for crackle-free audio. Could WinUAE sleeping/waiting for the next frame cause that? Would having another thread for servicing audio requests help?
  • WinUAE doesn't seem to support/use sample rates higher than 48kHz. If it supported 96kHz could that halve the minimum-possible audio latency?

Windows 10 x86-64 build 10586.589. High Definition Audio Device default format initially 16-bit 44.1kHz (in Sound control panel). WinUAE set to windowed, no vsync, no buffering (though Windows 10 DWM forces vsync?), sound 48kHz.

WASAPI EX buffer 1:
WASAPI: IsOffloadCapable() returned 0 00000000
WASAPI: AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED: 170 -> 192
WASAPI: IsOffloadCapable() returned 0 00000000
WASAPI: '{0.0.0.00000000}.{b32283a3-ec24-40ed-a52a-7128ab296ef6}'
WASAPI: Exclusive Pull CH=2 FREQ=48000 BUF=192 (192)


Change to buffer 2:
WASAPI: IsOffloadCapable() returned 0 00000000
WASAPI: AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED: 341 -> 352
WASAPI: IsOffloadCapable() returned 0 00000000
WASAPI: '{0.0.0.00000000}.{b32283a3-ec24-40ed-a52a-7128ab296ef6}'
WASAPI: Exclusive Pull CH=2 FREQ=48000 BUF=352 (352)


Change to buffer 3:
WASAPI: IsOffloadCapable() returned 0 00000000
WASAPI: '{0.0.0.00000000}.{b32283a3-ec24-40ed-a52a-7128ab296ef6}'
WASAPI: Exclusive Pull CH=2 FREQ=48000 BUF=512 (512)


On changing to buffer Min:
WASAPI: IsOffloadCapable() returned 0 00000000
WASAPI: AUDCLNT_E_BUFFER_SIZE_ERROR 0
WASAPI: IsOffloadCapable() returned 0 00000000
Sorry, can't initialize sound.



Change to WASAPI non-exclusive, buffer 1:
WASAPI: IsFormatSupported(2,00000003,48000) (2,44100) 00000001
WASAPI: GetCurrentSharedModeEnginePeriod() CH=2 FREQ=44100 BITS=32 CurrentPeriodInFrames=448
WASAPI: GetSharedModeEnginePeriod() DPIF=448 FPIF=32 MinPIF=128 MaxPIF=448
WASAPI: IsOffloadCapable() returned 0 00000000
WASAPI: InitializeSharedAudioStream() Period=160. HRESULT=00000000
WASAPI: GetCurrentSharedModeEnginePeriod() CH=2 FREQ=44100 BITS=32 CurrentPeriodInFrames=160
WASAPI: '{0.0.0.00000000}.{b32283a3-ec24-40ed-a52a-7128ab296ef6}'
WASAPI: Shared Pull CH=2 FREQ=44100 BUF=176 (352)


With emulation running and sound playing (still WASAPI non-exclusive), I opened Sound control panel and checked "Disable all enhancements". WinUAE locked up, printing this over and over in the log:
WASAPI: GetCurrentPadding() 88890004
WASAPI: GetCurrentPadding() 88890004


I changed default format in Sound control panel to 16-bit 48kHz, killed WinUAE then ran it again. WASAPI non-exclusive, buffer 1:
WASAPI: GetCurrentSharedModeEnginePeriod() CH=2 FREQ=48000 BITS=32 CurrentPeriodInFrames=480
WASAPI: GetSharedModeEnginePeriod() DPIF=480 FPIF=32 MinPIF=128 MaxPIF=480
WASAPI: IsOffloadCapable() returned 0 00000000
WASAPI: InitializeSharedAudioStream() Period=160. HRESULT=00000000
WASAPI: GetCurrentSharedModeEnginePeriod() CH=2 FREQ=48000 BITS=32 CurrentPeriodInFrames=160
WASAPI: '{0.0.0.00000000}.{b32283a3-ec24-40ed-a52a-7128ab296ef6}'
WASAPI: Shared Pull CH=2 FREQ=48000 BUF=176 (352)


Change to buffer Min (still WASAPI non-exclusive):
WASAPI: GetCurrentSharedModeEnginePeriod() CH=2 FREQ=48000 BITS=32 CurrentPeriodInFrames=480
WASAPI: GetSharedModeEnginePeriod() DPIF=480 FPIF=32 MinPIF=128 MaxPIF=480
WASAPI: IsOffloadCapable() returned 0 00000000
WASAPI: InitializeSharedAudioStream() Period=128. HRESULT=00000000
WASAPI: GetCurrentSharedModeEnginePeriod() CH=2 FREQ=48000 BITS=32 CurrentPeriodInFrames=128
WASAPI: '{0.0.0.00000000}.{b32283a3-ec24-40ed-a52a-7128ab296ef6}'
WASAPI: Shared Pull CH=2 FREQ=48000 BUF=140 (280)


Change to WASAPI EX (still buffer Min). This time it worked:
WASAPI: IsOffloadCapable() returned 0 00000000
WASAPI: AUDCLNT_E_BUFFER_SIZE_ERROR 0
WASAPI: IsOffloadCapable() returned 0 00000000
WASAPI: '{0.0.0.00000000}.{b32283a3-ec24-40ed-a52a-7128ab296ef6}'
WASAPI: Exclusive Pull CH=2 FREQ=48000 BUF=128 (128)

Last edited by mark_k; 12 October 2016 at 18:52.
mark_k is offline  
 
Page generated in 0.07126 seconds with 9 queries