mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Implement UI for setting up the iOS audio modes
This commit is contained in:
parent
07b6938de1
commit
35c40196d4
@ -382,7 +382,7 @@ bool VulkanMayBeAvailable() {
|
||||
#if PPSSPP_PLATFORM(IOS)
|
||||
g_vulkanAvailabilityChecked = true;
|
||||
g_vulkanMayBeAvailable = System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 13;
|
||||
INFO_LOG(SYSTEM, "VulkanMayBeAvailable: Detected version: %d", System_GetPropertyInt(SYSPROP_SYSTEMVERSION));
|
||||
INFO_LOG(SYSTEM, "VulkanMayBeAvailable: Detected version: %d", (int)System_GetPropertyInt(SYSPROP_SYSTEMVERSION));
|
||||
return g_vulkanMayBeAvailable;
|
||||
#else
|
||||
// Unsupported in VR at the moment
|
||||
|
@ -230,6 +230,7 @@ enum class SystemNotification {
|
||||
KEEP_SCREEN_AWAKE,
|
||||
ACTIVITY,
|
||||
UI_STATE_CHANGED,
|
||||
AUDIO_MODE_CHANGED,
|
||||
};
|
||||
|
||||
// I guess it's not super great architecturally to centralize this, since it's not general - but same with a lot of
|
||||
|
@ -700,6 +700,8 @@ static const ConfigSetting soundSettings[] = {
|
||||
ConfigSetting("AchievementSoundVolume", &g_Config.iAchievementSoundVolume, 6, CfgFlag::PER_GAME),
|
||||
ConfigSetting("AudioDevice", &g_Config.sAudioDevice, "", CfgFlag::DEFAULT),
|
||||
ConfigSetting("AutoAudioDevice", &g_Config.bAutoAudioDevice, true, CfgFlag::DEFAULT),
|
||||
ConfigSetting("AudioMixWithOthers", &g_Config.bAudioMixWithOthers, true, CfgFlag::DEFAULT),
|
||||
ConfigSetting("AudioRespectSilentMode", &g_Config.bAudioRespectSilentMode, false, CfgFlag::DEFAULT),
|
||||
ConfigSetting("UseNewAtrac", &g_Config.bUseNewAtrac, false, CfgFlag::DEFAULT),
|
||||
};
|
||||
|
||||
|
@ -280,6 +280,10 @@ public:
|
||||
bool bAutoAudioDevice;
|
||||
bool bUseNewAtrac;
|
||||
|
||||
// iOS only for now
|
||||
bool bAudioMixWithOthers;
|
||||
bool bAudioRespectSilentMode;
|
||||
|
||||
// UI
|
||||
bool bShowDebuggerOnLoad;
|
||||
int iShowStatusFlags;
|
||||
|
@ -618,6 +618,22 @@ void GameSettingsScreen::CreateAudioSettings(UI::ViewGroup *audioSettings) {
|
||||
|
||||
audioSettings->Add(new ItemHeader(ms->T("Audio")));
|
||||
CheckBox *enableSound = audioSettings->Add(new CheckBox(&g_Config.bEnableSound,a->T("Enable Sound")));
|
||||
|
||||
#if PPSSPP_PLATFORM(IOS)
|
||||
CheckBox *respectSilentMode = audioSettings->Add(new CheckBox(&g_Config.bAudioRespectSilentMode, a->T("Respect silent mode")));
|
||||
respectSilentMode->OnClick.Add([=](EventParams &e) {
|
||||
System_Notify(SystemNotification::AUDIO_MODE_CHANGED);
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
respectSilentMode->SetEnabledPtr(&g_Config.bEnableSound);
|
||||
CheckBox *mixWithOthers = audioSettings->Add(new CheckBox(&g_Config.bAudioMixWithOthers, a->T("Mix audio with other apps")));
|
||||
mixWithOthers->OnClick.Add([=](EventParams &e) {
|
||||
System_Notify(SystemNotification::AUDIO_MODE_CHANGED);
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
mixWithOthers->SetEnabledPtr(&g_Config.bEnableSound);
|
||||
#endif
|
||||
|
||||
PopupSliderChoice *volume = audioSettings->Add(new PopupSliderChoice(&g_Config.iGlobalVolume, VOLUME_OFF, VOLUME_FULL, VOLUME_FULL, a->T("Global volume"), screenManager()));
|
||||
volume->SetEnabledPtr(&g_Config.bEnableSound);
|
||||
volume->SetZeroLabel(a->T("Mute"));
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
#import "DisplayManager.h"
|
||||
#import "iOSCoreAudio.h"
|
||||
#import "ViewController.h"
|
||||
#import "AppDelegate.h"
|
||||
#include "Common/System/Display.h"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "iOSCoreAudio.h"
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Core/Config.h"
|
||||
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
@ -38,6 +39,8 @@ void iOSCoreAudioUpdateSession() {
|
||||
} else {
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:&error];
|
||||
}
|
||||
|
||||
INFO_LOG(AUDIO, "RespectSilentMode: %d MixWithOthers: %d", g_Config.bAudioRespectSilentMode, g_Config.bAudioMixWithOthers);
|
||||
}
|
||||
|
||||
void iOSCoreAudioSetDisplayConnected(bool connected) {
|
||||
@ -80,6 +83,8 @@ OSStatus iOSCoreAudioCallback(void *inRefCon,
|
||||
|
||||
void iOSCoreAudioInit()
|
||||
{
|
||||
iOSCoreAudioUpdateSession();
|
||||
|
||||
NSError *error = nil;
|
||||
AVAudioSession *session = [AVAudioSession sharedInstance];
|
||||
if (![session setActive:YES error:&error]) {
|
||||
|
@ -24,6 +24,7 @@
|
||||
#import "AppDelegate.h"
|
||||
#import "PPSSPPUIApplication.h"
|
||||
#import "ViewController.h"
|
||||
#import "iOSCoreAudio.h"
|
||||
|
||||
#include "Common/MemoryUtil.h"
|
||||
#include "Common/System/NativeApp.h"
|
||||
@ -393,6 +394,11 @@ void System_Notify(SystemNotification notification) {
|
||||
}
|
||||
});
|
||||
break;
|
||||
case SystemNotification::AUDIO_MODE_CHANGED:
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
iOSCoreAudioUpdateSession();
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user