mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Implement the option for auto audio devices switching for Windows too
(previously SDL-only)
This commit is contained in:
@@ -634,16 +634,20 @@ void GameSettingsScreen::CreateViews() {
|
||||
MicChoice->OnChoice.Handle(this, &GameSettingsScreen::OnMicDeviceChange);
|
||||
}
|
||||
|
||||
bool sdlAudio = false;
|
||||
#if defined(SDL)
|
||||
std::vector<std::string> audioDeviceList;
|
||||
SplitString(System_GetProperty(SYSPROP_AUDIO_DEVICE_LIST), '\0', audioDeviceList);
|
||||
audioDeviceList.insert(audioDeviceList.begin(), a->T("Auto"));
|
||||
PopupMultiChoiceDynamic *audioDevice = audioSettings->Add(new PopupMultiChoiceDynamic(&g_Config.sAudioDevice, a->T("Device"), audioDeviceList, nullptr, screenManager()));
|
||||
audioDevice->OnChoice.Handle(this, &GameSettingsScreen::OnAudioDevice);
|
||||
|
||||
audioSettings->Add(new CheckBox(&g_Config.bAutoAudioDevice, a->T("Switch on new audio device")));
|
||||
sdlAudio = true;
|
||||
#endif
|
||||
|
||||
if (sdlAudio || g_Config.iAudioBackend == AUDIO_BACKEND_WASAPI) {
|
||||
audioSettings->Add(new CheckBox(&g_Config.bAutoAudioDevice, a->T("Use new audio devices automatically")));
|
||||
}
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
CheckBox *extraAudio = audioSettings->Add(new CheckBox(&g_Config.bExtraAudioBuffering, a->T("AudioBufferingForBluetooth", "Bluetooth-friendly buffer (slower)")));
|
||||
extraAudio->SetEnabledPtr(&g_Config.bEnableSound);
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
deviceChanged_ = false;
|
||||
}
|
||||
|
||||
bool HasDeviceChanged() {
|
||||
bool HasDefaultDeviceChanged() const {
|
||||
return deviceChanged_;
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ void WASAPIAudioThread::Run() {
|
||||
}
|
||||
|
||||
// Check if we should use a new device.
|
||||
if (notificationClient_ && notificationClient_->HasDeviceChanged()) {
|
||||
if (notificationClient_ && notificationClient_->HasDefaultDeviceChanged() && g_Config.bAutoAudioDevice) {
|
||||
hresult = audioInterface_->Stop();
|
||||
ShutdownAudioDevice();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user