Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better WASAPI audio resampler? #4608

Closed
slouken opened this issue Aug 8, 2021 · 2 comments
Closed

Better WASAPI audio resampler? #4608

slouken opened this issue Aug 8, 2021 · 2 comments
Assignees
Milestone

Comments

@slouken
Copy link
Collaborator

slouken commented Aug 8, 2021

@cgutman said in #4604:
WASAPI does actually have a proper resampler available via AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM and AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY documented here. I've confirmed it works at least back to Windows 7 (haven't tried Vista).

We should evaluate whether this resampler has better performance or quality than SDL's built-in resampler.

@slouken slouken added this to the 2.0.18 milestone Aug 8, 2021
@sezero
Copy link
Contributor

sezero commented Aug 11, 2021

@slouken: ac32c52 results in build errors with older SDKS. See:
https://buildbot.libsdl.org/#/builders/20/builds/559

FAILED: CMakeFiles/SDL2-static.dir/src/audio/wasapi/SDL_wasapi.c.obj 
C:\PROGRA~1\CMake\bin\ccache.exe  x86_64-w64-mingw32-gcc.exe -DUSING_GENERATED_CONFIG_H -Iinclude -I../include -idirafter "C:/buildbot/worker/SDL/sdl-mingw-amd64/src/src/video/khronos"  "-IC:/buildbot/worker/SDL/sdl-mingw-amd64/src/src/hidapi/hidapi" -msse3 -msse2 -msse -m3dnow -mmmx -Wshadow -fvisibility=hidden -Wdeclaration-after-statement -Werror=declaration-after-statement -fno-strict-aliasing -Wall  -Os -DNDEBUG -MD -MT CMakeFiles/SDL2-static.dir/src/audio/wasapi/SDL_wasapi.c.obj -MF CMakeFiles\SDL2-static.dir\src\audio\wasapi\SDL_wasapi.c.obj.d -o CMakeFiles/SDL2-static.dir/src/audio/wasapi/SDL_wasapi.c.obj   -c ../src/audio/wasapi/SDL_wasapi.c
../src/audio/wasapi/SDL_wasapi.c: In function 'WASAPI_PrepDevice':
../src/audio/wasapi/SDL_wasapi.c:561:25: error: 'AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM' undeclared (first use in this function); did you mean 'AUDCLNT_STREAMFLAGS_LOOPBACK'?
         streamflags |= (AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         AUDCLNT_STREAMFLAGS_LOOPBACK
../src/audio/wasapi/SDL_wasapi.c:561:25: note: each undeclared identifier is reported only once for each function it appears in
../src/audio/wasapi/SDL_wasapi.c:561:62: error: 'AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY' undeclared (first use in this function); did you mean 'AUDCLNT_STREAMFLAGS_RATEADJUST'?
         streamflags |= (AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY);
                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                              AUDCLNT_STREAMFLAGS_RATEADJUST

AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM and AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY
must be defined if not already defined, e.g. like:

#ifndef AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY
#define AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY 0x08000000
#endif
#ifndef AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM
#define AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM      0x80000000
#endif

I don't know whether the resulting dll will be compatible with win8x and older.

@sezero sezero reopened this Aug 11, 2021
@sezero
Copy link
Contributor

sezero commented Aug 11, 2021

OK, I went ahead and pushed ed6eb07

Still don't know whether the resulting dll will be compatible with win8x and older, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants