Separate XAudio2 from DirectSound in preference and CMake

This commit is contained in:
wangqr 2019-11-01 22:30:54 -04:00
parent 309996aeb2
commit b947116937
2 changed files with 16 additions and 3 deletions

View file

@ -572,12 +572,18 @@ if(WITH_CSRI)
endif()
if(WIN32)
target_compile_definitions(Aegisub PRIVATE "WITH_DIRECTSOUND" "WITH_XAUDIO2")
target_compile_definitions(Aegisub PRIVATE "WITH_DIRECTSOUND")
target_link_libraries(Aegisub dsound)
target_sources(Aegisub PRIVATE src/audio_player_dsound.cpp src/audio_player_dsound2.cpp src/audio_player_xaudio2.cpp)
target_sources(Aegisub PRIVATE src/audio_player_dsound.cpp src/audio_player_dsound2.cpp)
set(WITH_DIRECTSOUND ON)
set(WITH_XAUDIO2 ON CACHE BOOL "Enable XAudio2 support")
if(WITH_XAUDIO2)
target_compile_definitions(Aegisub PRIVATE "WITH_XAUDIO2")
target_sources(Aegisub PRIVATE src/audio_player_xaudio2.cpp)
endif()
else()
set(WITH_DIRECTSOUND OFF)
set(WITH_XAUDIO2 OFF)
endif()
set(WITH_FFMS2 ON CACHE BOOL "Enable FFMS2 support")
@ -783,6 +789,7 @@ message(STATUS "\n"
" ALSA: ${WITH_ALSA}\n"
" DirectSound: ${WITH_DIRECTSOUND}\n"
" DirectSound-old: ${WITH_DIRECTSOUND}\n"
" XAudio2: ${WITH_XAUDIO2}\n"
" OpenAL: ${WITH_OPENAL}\n"
" OSS: ${WITH_OSS}\n"
" PortAudio: ${WITH_PORTAUDIO}\n"

View file

@ -413,8 +413,14 @@ void Advanced_Audio(wxTreebook *book, Preferences *parent) {
p->OptionBrowse(oss, _("OSS Device"), "Player/Audio/OSS/Device");
#endif
#ifdef WITH_DIRECTSOUND
#if defined(WITH_DIRECTSOUND) && defined(WITH_XAUDIO2)
auto dsound = p->PageSizer("DirectSound / XAudio2");
#elif defined(WITH_DIRECTSOUND)
auto dsound = p->PageSizer("DirectSound");
#elif defined(WITH_XAUDIO2)
auto dsound = p->PageSizer("XAudio2");
#endif
#if defined(WITH_DIRECTSOUND) || defined(WITH_XAUDIO2)
p->OptionAdd(dsound, _("Buffer latency"), "Player/Audio/DirectSound/Buffer Latency", 1, 1000);
p->OptionAdd(dsound, _("Buffer length"), "Player/Audio/DirectSound/Buffer Length", 1, 100);
#endif