SDL: Add UI to reset audio device at runtime.
This commit is contained in:
parent
8751316051
commit
c30bc4ee7d
5 changed files with 164 additions and 79 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "base/display.h" // Only to check screen aspect ratio with pixel_yres/pixel_xres
|
||||
|
||||
#include "base/colorutil.h"
|
||||
#include "base/stringutil.h"
|
||||
#include "base/timeutil.h"
|
||||
#include "math/curves.h"
|
||||
#include "net/resolve.h"
|
||||
|
@ -491,6 +492,13 @@ void GameSettingsScreen::CreateViews() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDL)
|
||||
std::vector<std::string> audioDeviceList;
|
||||
SplitString(System_GetProperty(SYSPROP_AUDIO_DEVICE_LIST), '\0', audioDeviceList);
|
||||
PopupMultiChoiceDynamic *audioDevice = audioSettings->Add(new PopupMultiChoiceDynamic(&g_Config.sAudioDevice, a->T("Device"), audioDeviceList, nullptr, screenManager()));
|
||||
audioDevice->OnChoice.Handle(this, &GameSettingsScreen::OnAudioDevice);
|
||||
#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), gr->GetName(), screenManager()));
|
||||
lowAudio->SetEnabledPtr(&g_Config.bEnableSound);
|
||||
|
@ -1180,6 +1188,11 @@ UI::EventReturn GameSettingsScreen::OnRenderingDevice(UI::EventParams &e) {
|
|||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnAudioDevice(UI::EventParams &e) {
|
||||
System_SendMessage("audio_resetDevice", "");
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnChangeNickname(UI::EventParams &e) {
|
||||
#if PPSSPP_PLATFORM(WINDOWS) || defined(USING_QT_UI)
|
||||
const size_t name_len = 256;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue