summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-03-04 13:33:22 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-03-04 13:33:22 +0100
commit1a7f694b40c5e99f5621646222cd075c0ddfbf84 (patch)
treea086e1baa07384aae75604b32bb6a4e2b9304683
parentd824b2c28e85a68caced8790da73c218fea7fd29 (diff)
parentd5a3a9aea6ce251df7a0334ac6e507672a4bab22 (diff)
downloadredot-engine-1a7f694b40c5e99f5621646222cd075c0ddfbf84.tar.gz
Merge pull request #89006 from LeonardoDemartino/ios_playandrecord_volume
Fix low volume sound output on iOS when Play and Record category is used
-rw-r--r--platform/ios/app_delegate.mm12
1 files changed, 7 insertions, 5 deletions
diff --git a/platform/ios/app_delegate.mm b/platform/ios/app_delegate.mm
index 32ebf7be44..5a0c57be93 100644
--- a/platform/ios/app_delegate.mm
+++ b/platform/ios/app_delegate.mm
@@ -105,11 +105,17 @@ static ViewController *mainViewController = nil;
// Initialize with default Ambient category.
AVAudioSessionCategory category = AVAudioSessionCategoryAmbient;
+ AVAudioSessionCategoryOptions options = 0;
+
+ if (GLOBAL_GET("audio/general/ios/mix_with_others")) {
+ options |= AVAudioSessionCategoryOptionMixWithOthers;
+ }
if (sessionCategorySetting == SESSION_CATEGORY_MULTI_ROUTE) {
category = AVAudioSessionCategoryMultiRoute;
} else if (sessionCategorySetting == SESSION_CATEGORY_PLAY_AND_RECORD) {
category = AVAudioSessionCategoryPlayAndRecord;
+ options |= AVAudioSessionCategoryOptionDefaultToSpeaker;
} else if (sessionCategorySetting == SESSION_CATEGORY_PLAYBACK) {
category = AVAudioSessionCategoryPlayback;
} else if (sessionCategorySetting == SESSION_CATEGORY_RECORD) {
@@ -118,11 +124,7 @@ static ViewController *mainViewController = nil;
category = AVAudioSessionCategorySoloAmbient;
}
- if (GLOBAL_GET("audio/general/ios/mix_with_others")) {
- [[AVAudioSession sharedInstance] setCategory:category withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
- } else {
- [[AVAudioSession sharedInstance] setCategory:category error:nil];
- }
+ [[AVAudioSession sharedInstance] setCategory:category withOptions:options error:nil];
return YES;
}