Remove SDL sound driver
Because of reported framerate issues with the SDL sound driver, remove it and make XAudio2 the default on Windows and OpenAL the default everywhere else. Rewrite the "sdl" value from users' configs to the new default. Make OpenAL a mandatory dependency as well. Fix #709 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
418b7b64dc
commit
84b0a3e366
|
@ -152,7 +152,7 @@ And the following development libraries:
|
||||||
- [gettext](https://www.gnu.org/software/gettext/) and gettext-tools (optional, with ENABLE_NLS)
|
- [gettext](https://www.gnu.org/software/gettext/) and gettext-tools (optional, with ENABLE_NLS)
|
||||||
- [SDL2](https://www.libsdl.org/) (required)
|
- [SDL2](https://www.libsdl.org/) (required)
|
||||||
- [SFML](https://www.sfml-dev.org/) (optional, for link)
|
- [SFML](https://www.sfml-dev.org/) (optional, for link)
|
||||||
- [OpenAL](https://www.openal.org/) or [openal-soft](https://kcat.strangesoft.net/openal.html) (optional, a sound interface)
|
- [OpenAL](https://www.openal.org/) or [openal-soft](https://kcat.strangesoft.net/openal.html) (required, a sound interface)
|
||||||
- [wxWidgets](https://wxwidgets.org/) (required for GUI, 2.8 and non-stl builds are no longer supported)
|
- [wxWidgets](https://wxwidgets.org/) (required for GUI, 2.8 and non-stl builds are no longer supported)
|
||||||
|
|
||||||
On Linux and similar, you also need the version of GTK your wxWidgets is linked
|
On Linux and similar, you also need the version of GTK your wxWidgets is linked
|
||||||
|
|
|
@ -31,17 +31,6 @@ endif()
|
||||||
|
|
||||||
option(ENABLE_FAUDIO "Enable FAudio sound output for the wxWidgets port" OFF)
|
option(ENABLE_FAUDIO "Enable FAudio sound output for the wxWidgets port" OFF)
|
||||||
|
|
||||||
find_package(OpenAL)
|
|
||||||
|
|
||||||
if(OPENAL_FOUND)
|
|
||||||
set(ENABLE_OPENAL_DEFAULT ON)
|
|
||||||
else()
|
|
||||||
set(ENABLE_OPENAL_DEFAULT OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(ENABLE_OPENAL "Enable OpenAL for the wxWidgets port" ${ENABLE_OPENAL_DEFAULT})
|
|
||||||
|
|
||||||
if(ENABLE_OPENAL)
|
|
||||||
find_package(OpenAL REQUIRED)
|
find_package(OpenAL REQUIRED)
|
||||||
|
|
||||||
include_directories(${OPENAL_INCLUDE_DIR})
|
include_directories(${OPENAL_INCLUDE_DIR})
|
||||||
|
@ -51,9 +40,6 @@ if(ENABLE_OPENAL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND VBAM_LIBS ${OPENAL_LIBRARY})
|
list(APPEND VBAM_LIBS ${OPENAL_LIBRARY})
|
||||||
else()
|
|
||||||
add_definitions(-DNO_OAL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
add_definitions(-DwxMAC_USE_CORE_GRAPHICS)
|
add_definitions(-DwxMAC_USE_CORE_GRAPHICS)
|
||||||
|
@ -910,10 +896,8 @@ set(
|
||||||
list(APPEND ALL_SRC_WX openal.cpp)
|
list(APPEND ALL_SRC_WX openal.cpp)
|
||||||
list(APPEND ALL_HDR_WX openal.h)
|
list(APPEND ALL_HDR_WX openal.h)
|
||||||
|
|
||||||
if(ENABLE_OPENAL)
|
|
||||||
list(APPEND SRC_WX openal.cpp)
|
list(APPEND SRC_WX openal.cpp)
|
||||||
list(APPEND HDR_WX openal.h)
|
list(APPEND HDR_WX openal.h)
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND ALL_SRC_WX xaudio2.cpp)
|
list(APPEND ALL_SRC_WX xaudio2.cpp)
|
||||||
|
|
||||||
|
|
|
@ -712,7 +712,7 @@ RenderMethod StringToRenderMethod(const wxString& config_name,
|
||||||
return iter->second;
|
return iter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
int StringToAudioApi(const wxString& config_name, const wxString& input) {
|
int StringToAudioApi(const wxString& config_name, const wxString& input_) {
|
||||||
static std::map<wxString, AudioApi> kStringToAudioApi;
|
static std::map<wxString, AudioApi> kStringToAudioApi;
|
||||||
if (kStringToAudioApi.empty()) {
|
if (kStringToAudioApi.empty()) {
|
||||||
for (size_t i = 0; i < kNbAudioApis; i++) {
|
for (size_t i = 0; i < kNbAudioApis; i++) {
|
||||||
|
@ -722,6 +722,17 @@ int StringToAudioApi(const wxString& config_name, const wxString& input) {
|
||||||
assert(kStringToAudioApi.size() == kNbAudioApis);
|
assert(kStringToAudioApi.size() == kNbAudioApis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxString input = input_;
|
||||||
|
|
||||||
|
// sdl has been removed, rewrite to new default
|
||||||
|
if (input == "sdl") {
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
input = "xaudio2";
|
||||||
|
#else
|
||||||
|
input = "openal";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
const auto iter = kStringToAudioApi.find(input);
|
const auto iter = kStringToAudioApi.find(input);
|
||||||
if (iter == kStringToAudioApi.end()) {
|
if (iter == kStringToAudioApi.end()) {
|
||||||
wxLogWarning(_("Invalid value %s for option %s; valid values are %s"),
|
wxLogWarning(_("Invalid value %s for option %s; valid values are %s"),
|
||||||
|
|
|
@ -2696,6 +2696,8 @@ bool MainFrame::BindControls()
|
||||||
NULL, &sound_config_handler); \
|
NULL, &sound_config_handler); \
|
||||||
} while (0)
|
} while (0)
|
||||||
audapi_rb("SDL", AUD_SDL);
|
audapi_rb("SDL", AUD_SDL);
|
||||||
|
rb->Hide(); // currently disabled
|
||||||
|
|
||||||
audapi_rb("OpenAL", AUD_OPENAL);
|
audapi_rb("OpenAL", AUD_OPENAL);
|
||||||
#ifdef NO_OAL
|
#ifdef NO_OAL
|
||||||
rb->Hide();
|
rb->Hide();
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "config/game-control.h"
|
#include "config/game-control.h"
|
||||||
#include "config/shortcuts.h"
|
#include "config/shortcuts.h"
|
||||||
#include "config/user-input.h"
|
#include "config/user-input.h"
|
||||||
#include "wxutil.h"
|
#include "wxhead.h"
|
||||||
|
|
||||||
// Forward declaration.
|
// Forward declaration.
|
||||||
class wxFileHistory;
|
class wxFileHistory;
|
||||||
|
@ -52,7 +52,11 @@ extern struct opts_t {
|
||||||
int max_scale = 0;
|
int max_scale = 0;
|
||||||
|
|
||||||
/// Sound
|
/// Sound
|
||||||
int audio_api = 0;
|
#ifdef __WXMSW__
|
||||||
|
int audio_api = AUD_XAUDIO2;
|
||||||
|
#else
|
||||||
|
int audio_api = AUD_OPENAL;
|
||||||
|
#endif
|
||||||
// 10 fixes stuttering on mac with openal, as opposed to 5
|
// 10 fixes stuttering on mac with openal, as opposed to 5
|
||||||
// also should be better for modern hardware in general
|
// also should be better for modern hardware in general
|
||||||
int audio_buffers = 10;
|
int audio_buffers = 10;
|
||||||
|
|
|
@ -59,6 +59,16 @@ using std::int32_t;
|
||||||
|
|
||||||
#include "wxutil.h"
|
#include "wxutil.h"
|
||||||
|
|
||||||
|
// This enum must be kept in sync with the one in vbam-options-static.cpp.
|
||||||
|
// TODO: These 2 enums should be unified and a validator created for this enum.
|
||||||
|
enum audioapi {
|
||||||
|
AUD_SDL,
|
||||||
|
AUD_OPENAL,
|
||||||
|
AUD_DIRECTSOUND,
|
||||||
|
AUD_XAUDIO2,
|
||||||
|
AUD_FAUDIO
|
||||||
|
};
|
||||||
|
|
||||||
// wxrc helpers (for dynamic strings instead of constant)
|
// wxrc helpers (for dynamic strings instead of constant)
|
||||||
#define XRCID_D(str) wxXmlResource::GetXRCID(str)
|
#define XRCID_D(str) wxXmlResource::GetXRCID(str)
|
||||||
//#define XRCCTRL_D(win, id, type) (wxStaticCast((win).FindWindow(XRCID_D(id)), type))
|
//#define XRCCTRL_D(win, id, type) (wxStaticCast((win).FindWindow(XRCID_D(id)), type))
|
||||||
|
|
|
@ -426,16 +426,6 @@ enum showspeed {
|
||||||
SS_DETAILED
|
SS_DETAILED
|
||||||
};
|
};
|
||||||
|
|
||||||
// This enum must be kept in sync with the one in vbam-options-static.cpp.
|
|
||||||
// TODO: These 2 enums should be unified and a validator created for this enum.
|
|
||||||
enum audioapi {
|
|
||||||
AUD_SDL,
|
|
||||||
AUD_OPENAL,
|
|
||||||
AUD_DIRECTSOUND,
|
|
||||||
AUD_XAUDIO2,
|
|
||||||
AUD_FAUDIO
|
|
||||||
};
|
|
||||||
|
|
||||||
// an unfortunate legacy default; should have a non-digit preceding %d
|
// an unfortunate legacy default; should have a non-digit preceding %d
|
||||||
// the only reason to keep it is that user can set slotdir to old dir
|
// the only reason to keep it is that user can set slotdir to old dir
|
||||||
// otoh, we already make some name changes (double ext strip), and
|
// otoh, we already make some name changes (double ext strip), and
|
||||||
|
|
Loading…
Reference in New Issue