Wasapi audio backend problem

When I switch to wasapi all my games run 5 fps slower (60 -> 55). This is with share mode on. When i switch to exclusive mode the frame rate goes back up but there is some stuttering.

Another problem I noticed is that when closing a core that was running a game. retroarch will no longer detect any of the cores and if you try to run another game through the playlist the game/core will fail to load. Though this seems to happen randomly and I am not sure how to reproduce. Does not happen with any other audio backend.

Log:

RetroArch [INFO] :: === Build =======================================
Capabilities: MMX MMXEXT SSE1 SSE2 SSE3 SSSE3 SSE4 SSE4.2 AVX AES
Built: May 31 2017
RetroArch [INFO] :: Version: 1.6.0
RetroArch [INFO] :: Git: 1056027
RetroArch [INFO] :: =================================================
RetroArch [INFO] :: Loading dynamic libretro core from: "C:\Emulators\RetroArch\cores\nestopia_libretro.dll"
RetroArch [INFO] :: [overrides] no core-specific overrides found at C:\Emulators\RetroArch\config\Nestopia\Nestopia.cfg.
RetroArch [INFO] :: [overrides] no game-specific overrides found at C:\Emulators\RetroArch\config\Nestopia\Super Mario Bros. 2 (USA) (Rev A).cfg.
RetroArch [INFO] :: Shaders: preset directory: C:\Emulators\RetroArch\shaders\presets
RetroArch [INFO] :: Shaders: no game-specific preset found at C:\Emulators\RetroArch\shaders\presets\Nestopia\Super Mario Bros. 2 (USA) (Rev A).cgp.
RetroArch [INFO] :: Shaders: no game-specific preset found at C:\Emulators\RetroArch\shaders\presets\Nestopia\Super Mario Bros. 2 (USA) (Rev A).glslp.
RetroArch [INFO] :: Shaders: no core-specific preset found at C:\Emulators\RetroArch\shaders\presets\Nestopia\Nestopia.cgp.
RetroArch [INFO] :: Shaders: no core-specific preset found at C:\Emulators\RetroArch\shaders\presets\Nestopia\Nestopia.glslp.
RetroArch [INFO] :: Environ SET_VARIABLES.
RetroArch [INFO] :: Remaps: remap directory: C:\Emulators\RetroArch\config\remaps
RetroArch [INFO] :: Remaps: no game-specific remap found at C:\Emulators\RetroArch\config\remaps\Nestopia\Super Mario Bros. 2 (USA) (Rev A).rmp.
RetroArch [INFO] :: Remaps: core-specific remap found at C:\Emulators\RetroArch\config\remaps\Nestopia\Nestopia.rmp.
RetroArch [INFO] :: Redirecting save file to "D:\Games\Nintendo - Nintendo Entertainment System\Super Mario Bros. 2 (USA) (Rev A).srm".
RetroArch [INFO] :: Environ GET_LOG_INTERFACE.
RetroArch [INFO] :: Environ PERFORMANCE_LEVEL: 6.
RetroArch [INFO] :: Loading content file: D:\Games\Nintendo - Nintendo Entertainment System\Super Mario Bros. 2 (USA) (Rev A).nes.
RetroArch [INFO] :: Did not find a valid content patch.
RetroArch [INFO] :: CRC32: 0x17518181 .
RetroArch [WARN] :: SYSTEM DIR is empty, assume CONTENT DIR D:\Games\Nintendo - Nintendo Entertainment System\Super Mario Bros. 2 (USA) (Rev A).nes
RetroArch [INFO] :: Environ SYSTEM_DIRECTORY: "D:\Games\Nintendo - Nintendo Entertainment System\".
RetroArch [libretro INFO] :: Custom palette path: D:\Games\Nintendo - Nintendo Entertainment System\\custom.pal
RetroArch [libretro WARN] :: custom.pal not found in system directory.
RetroArch [libretro INFO] :: NstDatabase.xml path: D:\Games\Nintendo - Nintendo Entertainment System\\NstDatabase.xml
RetroArch [libretro WARN] :: NstDatabase.xml required to detect region and some mappers.
RetroArch [INFO] :: Environ SET_PIXEL_FORMAT: XRGB8888.
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_favored_system:
RetroArch [INFO] ::     auto
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_genie_distortion:
RetroArch [INFO] ::     disabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_ram_power_state:
RetroArch [INFO] ::     0x00
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_nospritelimit:
RetroArch [INFO] ::     disabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_fds_auto_insert:
RetroArch [INFO] ::     enabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_blargg_ntsc_filter:
RetroArch [INFO] ::     disabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_palette:
RetroArch [INFO] ::     pvm-style-d93-fbx
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_overscan_v:
RetroArch [INFO] ::     enabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_overscan_h:
RetroArch [INFO] ::     disabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_aspect:
RetroArch [INFO] ::     auto
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_turbo_pulse:
RetroArch [INFO] ::     2
RetroArch [INFO] :: Environ SET_GEOMETRY.
RetroArch [INFO] :: SET_GEOMETRY: 256x224, aspect: 1.306.
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_favored_system:
RetroArch [INFO] ::     auto
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_genie_distortion:
RetroArch [INFO] ::     disabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_ram_power_state:
RetroArch [INFO] ::     0x00
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_nospritelimit:
RetroArch [INFO] ::     disabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_fds_auto_insert:
RetroArch [INFO] ::     enabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_blargg_ntsc_filter:
RetroArch [INFO] ::     disabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_palette:
RetroArch [INFO] ::     pvm-style-d93-fbx
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_overscan_v:
RetroArch [INFO] ::     enabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_overscan_h:
RetroArch [INFO] ::     disabled
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_aspect:
RetroArch [INFO] ::     auto
RetroArch [INFO] :: Environ GET_VARIABLE nestopia_turbo_pulse:
RetroArch [INFO] ::     2
RetroArch [INFO] :: Environ SET_GEOMETRY.
RetroArch [libretro INFO] :: [Nestopia]: Machine is NTSC.
RetroArch [INFO] :: Skipping SRAM load..
RetroArch [INFO] :: CHEEVOS system RAM: 0000000000000000 0
RetroArch [INFO] :: CHEEVOS save RAM:   0000000000000000 0
RetroArch [INFO] :: CHEEVOS video RAM:  0000000000000000 0
RetroArch [INFO] :: CHEEVOS RTC:        0000000000000000 0
RetroArch [INFO] :: Version of libretro API: 1
RetroArch [INFO] :: Compiled against API: 1
RetroArch [INFO] :: [Audio]: Set audio input rate to: 44055.95 Hz.
RetroArch [INFO] :: Found shader "C:\Emulators\RetroArch\shaders\CRT-Lottes.cgp"
RetroArch [INFO] :: Found shader "C:\Emulators\RetroArch\shaders\retroarch.cgp"
RetroArch [INFO] :: [Video]: Video @ 879x672
RetroArch [INFO] :: [GL]: Found GL context: wgl
RetroArch [INFO] :: [GL]: Detecting screen resolution 2560x1600.
RetroArch [INFO] :: [WGL]: wglSwapInterval(1)
RetroArch [INFO] :: [GL]: Vendor: NVIDIA Corporation, Renderer: GeForce GTX 780 Ti/PCIe/SSE2.
RetroArch [INFO] :: [GL]: Version: 4.5.0 NVIDIA 382.05.
RetroArch [INFO] :: [GL]: Using resolution 879x672
RetroArch [INFO] :: [GL]: Default shader backend found: glsl.
RetroArch [INFO] :: [Shader driver]: Using GLSL shader backend.
RetroArch [INFO] :: [GLSL]: Checking GLSL shader support ...
RetroArch [WARN] :: [GL]: Stock GLSL shaders will be used.
RetroArch [INFO] :: [GLSL]: Found GLSL vertex shader.
RetroArch [INFO] :: [GLSL]: Found GLSL fragment shader.
RetroArch [INFO] :: [GLSL]: Linking GLSL program.
RetroArch [INFO] :: [GLSL]: Found GLSL vertex shader.
RetroArch [INFO] :: [GLSL]: Found GLSL fragment shader.
RetroArch [INFO] :: [GLSL]: Linking GLSL program.
RetroArch [INFO] :: [GLSL]: Found GLSL vertex shader.
RetroArch [INFO] :: [GLSL]: Found GLSL fragment shader.
RetroArch [INFO] :: [GLSL]: Linking GLSL program.
RetroArch [INFO] :: [GLSL]: Found GLSL vertex shader.
RetroArch [INFO] :: [GLSL]: Found GLSL fragment shader.
RetroArch [INFO] :: [GLSL]: Linking GLSL program.
RetroArch [INFO] :: [GLSL]: Found GLSL vertex shader.
RetroArch [INFO] :: [GLSL]: Found GLSL fragment shader.
RetroArch [INFO] :: [GLSL]: Linking GLSL program.
RetroArch [INFO] :: [GLSL]: Found GLSL vertex shader.
RetroArch [INFO] :: [GLSL]: Found GLSL fragment shader.
RetroArch [INFO] :: [GLSL]: Linking GLSL program.
RetroArch [INFO] :: [GLSL]: Found GLSL vertex shader.
RetroArch [INFO] :: [GLSL]: Found GLSL fragment shader.
RetroArch [INFO] :: [GLSL]: Linking GLSL program.
RetroArch [INFO] :: [GLSL]: Found GLSL vertex shader.
RetroArch [INFO] :: [GLSL]: Found GLSL fragment shader.
RetroArch [INFO] :: [GLSL]: Linking GLSL program.
RetroArch [INFO] :: [GL]: Using 4 textures.
RetroArch [INFO] :: [GL]: Loaded 1 program(s).
RetroArch [INFO] :: Found XInput v1.4.
RetroArch [INFO] :: Found XInput v1.4.
RetroArch [INFO] :: Enumerating DInput joypads ...
RetroArch [INFO] :: Device #0 PID: {05C4} VID:{054C}
RetroArch [INFO] :: [Autodetect]: 40 profiles found.
RetroArch [INFO] :: [Autodetect]: selected configuration: C:\Emulators\RetroArch\autoconfig\xinput\DUALSHOCK_4.cfg
RetroArch [INFO] :: Done enumerating DInput joypads ...
RetroArch [INFO] :: [Joypad]: Found joypad driver: "dinput".
RetroArch [INFO] :: [Font]: Using font rendering backend: freetype.
RetroArch [INFO] :: [WASAPI]: Initializing default device ...
RetroArch [INFO] :: [WASAPI]: Device initialized.
RetroArch [INFO] :: [WASAPI]: Initializing client (shared, float, 48000Hz, 64ms) ...
RetroArch [WARN] :: [WASAPI]: Unsupported format.
RetroArch [INFO] :: [WASAPI]: Initializing client (shared, float, 44100Hz, 64ms) ...
RetroArch [INFO] :: [WASAPI]: Client initialized (shared, float, 44100Hz, 10.0ms).
RetroArch [INFO] :: [WASAPI]: Client's buffer length is 970 frames (22.0ms).
RetroArch [INFO] :: [WASAPI]: Device period is 10.0ms (441 frames).
RetroArch [INFO] :: [WASAPI]: Intermediate buffer length is 441 frames (10.0ms).
RetroArch [INFO] :: [WASAPI]: Enumerating active devices ...
RetroArch [INFO] :: [WASAPI]: Speakers (ASUS Xonar Essence STX Audio Device) {0.0.0.00000000}.{302a4807-5fe9-4041-aa5b-9dafaad31a0a}
RetroArch [INFO] :: [WASAPI]: Digital Output (ASUS Xonar Essence STX Audio Device) {0.0.0.00000000}.{791a2ed8-f528-4369-9353-e49dc6ba2c24}
RetroArch [INFO] :: [WASAPI]: Devices enumerated.
RetroArch [INFO] :: [Font]: Using font rendering backend: freetype.
RetroArch [INFO] :: [Font]: Using font rendering backend: freetype.
RetroArch [INFO] :: Loading history file: [C:\Emulators\RetroArch\content_history.lpl].
RetroArch [INFO] :: Loading history file: [C:\Emulators\RetroArch\content_music_history.lpl].
RetroArch [INFO] :: Loading history file: [C:\Emulators\RetroArch\content_video_history.lpl].
RetroArch [INFO] :: Loading history file: [C:\Emulators\RetroArch\content_image_history.lpl].
RetroArch [INFO] :: [GL]: VSync => on
RetroArch [INFO] :: [WGL]: wglSwapInterval(1)
RetroArch [INFO] :: [WASAPI]: Sync on.
RetroArch [INFO] :: Paused.

I noticed too that with the Wasapi driver, games stutter with audio sync enabled. With audio sync disabled, the game stops stuttering, but the audio is bad because it is out of sync.

Same issue over here too.

try by increasing the buffer size.

I appear to have the same issue. Obvious and frequent stuttering when I enabled WASAPI and RawInput. I haven’t had time to investigate, but it’s likely WASAPI and not RawInput that causes this for me as well.

Using Windows 10 (1703), i7-6700K, GTX 1080 and an Asus Xonar DX soundcard.

Same here, i tried several times.

Win7 x64 Steinberg UR22 usb audio interface.

There’s some kind of performance issue when using WASAPI. Even when using no frame delay, there seems to be the occasional audio glitch and visual stutter. The reported framerate is between 59 and 60 FPS. When using some frame delay, performance deteriorates quickly, with distracting audio glitches and more stuttering.

When switching to the xaudio driver, I can use a frame delay of 12 and there are no audio or video glitches.

Tested with Nestopia on a 4.4GHz 6700K.

If you’re having problems with the WASAPI audio driver, you should probably post about the issue on the github thread, since I don’t think casdevel visits the forum.