Feat[audio]: separate allow microphone input from silent switch mode

This commit is contained in:
khanhduytran0 committed 2025-04-13 17:22:52 +07:00
1 parent 68ee5d09cd
commit 0a13331cdc
4 files changed
+26 -6

No files matched your search

@@ -215,6 +215,11 @@
@"icon": @"speaker.zzz",
@"type": self.typeSwitch
},
@{@"key": @"allow_microphone",
@"hasDetail": @YES,
@"icon": @"mic",
@"type": self.typeSwitch
},
], @[
// Control settings
@{@"icon": @"gamecontroller"},
@@ -399,6 +404,12 @@
if (self.navigationController == nil) {
self.tableView.alpha = 0.9;
}
if (NSProcessInfo.processInfo.isMacCatalystApp) {
UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeClose];
closeButton.frame = CGRectOffset(closeButton.frame, 10, 10);
[closeButton addTarget:self action:@selector(actionClose) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:closeButton];
}
}
- (void)viewWillDisappear:(BOOL)animated {
@@ -408,6 +419,10 @@
}
}
- (void)actionClose {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark UITableView
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {
+2 -1
View File
@@ -24,7 +24,8 @@
@"performance_hud": @NO,
@"fullscreen_airplay": @YES,
@"silence_other_audio": @NO,
@"silence_with_switch": @NO
@"silence_with_switch": @NO,
@"allow_microphone": @NO
}.mutableCopy,
@"control": @{
@"default_ctrl": @"default.json",
+5 -3
View File
@@ -292,11 +292,13 @@ static GameSurfaceView* pojavWindow;
NSError *sessionError = nil;
AVAudioSessionCategory category;
AVAudioSessionCategoryOptions options = 0;
if(getPrefBool(@"video.silence_with_switch")) {
if(getPrefBool(@"video.allow_microphone")) {
category = AVAudioSessionCategoryPlayAndRecord;
options |= AVAudioSessionCategoryOptionAllowAirPlay | AVAudioSessionCategoryOptionAllowBluetoothA2DP | AVAudioSessionCategoryOptionDefaultToSpeaker;
} else if(getPrefBool(@"video.silence_with_switch")) {
category = AVAudioSessionCategorySoloAmbient;
} else {
category = AVAudioSessionCategoryPlayAndRecord;
options |= AVAudioSessionCategoryOptionAllowAirPlay | AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionAllowBluetoothA2DP | AVAudioSessionCategoryOptionDefaultToSpeaker;
category = AVAudioSessionCategoryPlayback;
}
if(!getPrefBool(@"video.silence_other_audio")) {
options |= AVAudioSessionCategoryOptionMixWithOthers;
@@ -196,8 +196,10 @@
"preference.detail.fullscreen_airplay" = "Allows presenting fullscreen game window on the external display rather than mirroring everything on screen.";
"preference.title.silence_other_audio" = "Pause audio when game opens";
"preference.detail.silence_other_audio" = "Enable to allow PojavLauncher to pause audio from other apps, such as Music, when launching the game.";
"preference.title.silence_with_switch" = "Disable audio with silent switch and deny microphone input";
"preference.detail.silence_with_switch" = "Enable to disable audio when Silent Mode is on, and deny microphone input. Headphones and external speakers are not affected.";
"preference.title.silence_with_switch" = "Disable audio with silent switch";
"preference.detail.silence_with_switch" = "Enable to disable audio when Silent Mode is on. Headphones and external speakers are not affected.";
"preference.title.allow_microphone" = "Allow microphone input";
"preference.detail.allow_microphone" = "Enable this only if you are using voice chat mod. Silent switch option will be ignored, and audio quality from other apps will be affected.";
"preference.title.default_gamepad_ctrl" = "Controller configuration";
"preference.title.hardware_hide" = "Hide controls when hardware is connected";
"preference.detail.hardware_hide" = "Enable the behaviour of automatically disabling the on-screen control overlay when a mouse or game controller is connected.";