Add option to choose Audio backend, as WASAPI does not seem to be ideal for everyone..

Default to WASAPI though (Auto)
This commit is contained in:
Henrik Rydgard 2015-01-24 13:50:27 +01:00
parent 4ebdf49fb6
commit 790024c829
5 changed files with 17 additions and 7 deletions

View File

@ -470,6 +470,7 @@ static ConfigSetting graphicsSettings[] = {
static ConfigSetting soundSettings[] = {
ConfigSetting("Enable", &g_Config.bEnableSound, true, true, true),
ConfigSetting("AudioBackend", &g_Config.iAudioBackend, 0, true, true),
ConfigSetting("AudioLatency", &g_Config.iAudioLatency, 1, true, true),
ConfigSetting("SoundSpeedHack", &g_Config.bSoundSpeedHack, false, true, true),

View File

@ -50,6 +50,12 @@ enum {
GPU_BACKEND_DIRECT3D9 = 1,
};
enum AudioBackendType {
AUDIO_BACKEND_AUTO,
AUDIO_BACKEND_DSOUND,
AUDIO_BACKEND_WASAPI,
};
// For iIOTimingMethod.
enum IOTimingMethods {
IOTIMING_FAST = 0,
@ -186,6 +192,7 @@ public:
// Sound
bool bEnableSound;
int iAudioLatency; // 0 = low , 1 = medium(default) , 2 = high
int iAudioBackend;
// Audio Hack
bool bSoundSpeedHack;

View File

@ -325,6 +325,13 @@ void GameSettingsScreen::CreateViews() {
audioSettings->Add(new ItemHeader(ms->T("Audio")));
audioSettings->Add(new CheckBox(&g_Config.bEnableSound, a->T("Enable Sound")));
#ifdef _WIN32
static const char *backend[] = { "Auto", "WASAPI (fast)", "DirectSound (compatible)" };
PopupMultiChoice *audioBackend = audioSettings->Add(new PopupMultiChoice(&g_Config.iAudioBackend, a->T("Audio backend"), backend, 0, ARRAY_SIZE(backend), a, screenManager()));
audioBackend->SetEnabledPtr(&g_Config.bEnableSound);
#endif
static const char *latency[] = { "Low", "Medium", "High" };
PopupMultiChoice *lowAudio = audioSettings->Add(new PopupMultiChoice(&g_Config.iAudioLatency, a->T("Audio Latency"), latency, 0, ARRAY_SIZE(latency), gs, screenManager()));
lowAudio->SetEnabledPtr(&g_Config.bEnableSound);

View File

@ -577,7 +577,7 @@ void NativeInitGraphics() {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
#ifdef _WIN32
winAudioBackend = CreateAudioBackend(AUDIO_BACKEND_AUTO);
winAudioBackend = CreateAudioBackend((AudioBackendType)g_Config.iAudioBackend);
winAudioBackend->Init(MainWindow::GetHWND(), &Win32Mix, 44100);
#endif
}

View File

@ -1,6 +1,7 @@
#pragma once
#include "Common/CommonWindows.h"
#include "Core/Config.h"
typedef int (*StreamCallback)(short *buffer, int numSamples, int bits, int rate, int channels);
@ -15,11 +16,5 @@ public:
virtual int GetSampleRate() = 0;
};
enum AudioBackendType {
AUDIO_BACKEND_DSOUND,
AUDIO_BACKEND_WASAPI,
AUDIO_BACKEND_AUTO
};
// Factory
WindowsAudioBackend *CreateAudioBackend(AudioBackendType type);