mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 06:32:48 +00:00
Set audio session category to ambient so sound does not get cut off on interruption (phone call/playing back audio)
This commit is contained in:
parent
843503e92a
commit
a85ed986de
@ -37,6 +37,8 @@
|
|||||||
#include "../../menu/menu_setting.h"
|
#include "../../menu/menu_setting.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#import <AVFoundation/AVFoundation.h>
|
||||||
|
|
||||||
static char msg_old[PATH_MAX_LENGTH];
|
static char msg_old[PATH_MAX_LENGTH];
|
||||||
#ifdef HAVE_COCOA_METAL
|
#ifdef HAVE_COCOA_METAL
|
||||||
id<ApplePlatform> apple_platform;
|
id<ApplePlatform> apple_platform;
|
||||||
@ -355,6 +357,12 @@ enum
|
|||||||
[self pushViewController:self.mainmenu animated:NO];
|
[self pushViewController:self.mainmenu animated:NO];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
NSError *error;
|
||||||
|
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:&error];
|
||||||
|
if (error) {
|
||||||
|
NSLog(@"Could not set audio session category: %@",error.localizedDescription);
|
||||||
|
}
|
||||||
|
|
||||||
[self refreshSystemConfig];
|
[self refreshSystemConfig];
|
||||||
[self showGameView];
|
[self showGameView];
|
||||||
|
|
||||||
@ -394,14 +402,6 @@ enum
|
|||||||
[self showGameView];
|
[self showGameView];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillResignActive:(UIApplication *)application
|
|
||||||
{
|
|
||||||
dispatch_async(dispatch_get_main_queue(),
|
|
||||||
^{
|
|
||||||
ui_companion_cocoatouch_event_command(NULL, CMD_EVENT_MENU_SAVE_CURRENT_CONFIG);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
|
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
|
||||||
{
|
{
|
||||||
NSString *filename = (NSString*)url.path.lastPathComponent;
|
NSString *filename = (NSString*)url.path.lastPathComponent;
|
||||||
@ -435,7 +435,9 @@ enum
|
|||||||
[[UIApplication sharedApplication] setIdleTimerDisabled:true];
|
[[UIApplication sharedApplication] setIdleTimerDisabled:true];
|
||||||
[self.window setRootViewController:[CocoaView get]];
|
[self.window setRootViewController:[CocoaView get]];
|
||||||
|
|
||||||
ui_companion_cocoatouch_event_command(NULL, CMD_EVENT_AUDIO_START);
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||||
|
command_event(CMD_EVENT_AUDIO_START, NULL);
|
||||||
|
});
|
||||||
rarch_disable_ui();
|
rarch_disable_ui();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user