feat: mute in background switch

This commit is contained in:
TrueZhuanjia
2025-11-03 16:18:21 +08:00
parent a3f9e07cf7
commit e0c556da10
17 changed files with 158 additions and 25 deletions
@@ -792,6 +792,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self addSetting:self.useBuiltinMicStack ofId:@"useBuiltinMicStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
[self addSetting:self.micVolumeStack ofId:@"micVolumeStack" withInfoTag:NO withDynamicLabel:YES to:audioSection];
[self addSetting:self.duckOtherAppStack ofId:@"duckOtherAppStack" withInfoTag:NO withDynamicLabel:NO to:audioSection];
[self addSetting:self.muteInBackgroundStack ofId:@"muteInBackgroundStack" withInfoTag:NO withDynamicLabel:NO to:audioSection];
// [self addSetting:self.audioEngineStack ofId:@"audioEngineStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
// cancel audio engine selector due to system engine is unable to playback multi-channel audio
[self addSetting:self.audioConfigStack ofId:@"audioConfigStack" withInfoTag:NO withDynamicLabel:NO to:audioSection];
@@ -1718,6 +1719,9 @@ BOOL isCustomResolution(int resolutionSelected) {
[self.duckOtherAppSwitch setOn:self->tempSettings.duckOtherApps];
[self.muteInBackgroundSwitch setOn:tempSettings.muteInBackground];
[self.muteInBackgroundSwitch addTarget:self action:@selector(muteInBackgroundSwitchFlipped:) forControlEvents:UIControlEventValueChanged];
[self.micVolumeSlider setValue:self->tempSettings.micVolume.floatValue*100];
[self.micVolumeSlider addTarget:self action:@selector(micVolumeSliderMoved:) forControlEvents:UIControlEventValueChanged];
[self micVolumeSliderMoved:self.self.micVolumeSlider];
@@ -2387,6 +2391,10 @@ BOOL isCustomResolution(int resolutionSelected) {
});
}
- (void)muteInBackgroundSwitchFlipped:(UISwitch* )sender{
Connection.muteInBackground = sender.isOn;
}
- (void)redirectMicSwitchFlipped:(UISwitch* )sender{
if(sender.isOn) [self checkAndRequestMicPermission];
[self setHidden:!sender.isOn forStack:_useBuiltinMicStack];
@@ -2875,6 +2883,7 @@ BOOL isCustomResolution(int resolutionSelected) {
NSInteger audioEngine = self.audioEngineSelector.selectedSegmentIndex;
BOOL appendLeftClick = self.appendLeftClickSwitch.isOn;
BOOL duckOtherApps = self.duckOtherAppSwitch.isOn;
BOOL muteInBackground = self.muteInBackgroundSwitch.isOn;
NSInteger backgroundSessionTimer = self.backgroundSessionTimerSlider.value == self.backgroundSessionTimerSlider.maximumValue ? (uint32_t) INT16_MAX : (uint32_t)self.backgroundSessionTimerSlider.value;
[dataMan saveSettingsWithBitrate:_bitrate
@@ -2932,6 +2941,7 @@ BOOL isCustomResolution(int resolutionSelected) {
audioEngine:audioEngine
appendLeftClick:appendLeftClick
duckOtherApps:duckOtherApps
muteInBackground:muteInBackground
backgroundSessionTimer:backgroundSessionTimer];
}