feat: audio engine selector

This commit is contained in:
TrueZhuanjia
2025-10-28 23:33:42 +08:00
parent e050c914bb
commit 071e2a764a
13 changed files with 237 additions and 17 deletions
@@ -35,6 +35,7 @@
NSInteger _bitrate;
NSInteger _lastSelectedResolutionIndex;
bool settingsViewJustLoaded;
bool settingsViewJustExpanded;
uint16_t oswLayoutFingers;
CustomEdgeSlideGestureRecognizer *slideToCloseSettingsViewRecognizer;
NSMutableDictionary *_settingStackDict;
@@ -399,6 +400,8 @@ BOOL isCustomResolution(int resolutionSelected) {
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:NO];
settingsViewJustExpanded = true;
/*
[self checkAndRequestMicPermission];
self.micHandler = [MicHandler new];
@@ -458,6 +461,8 @@ BOOL isCustomResolution(int resolutionSelected) {
[self.customResolutionSwitch setOn: isCustomResolution(self->tempSettings.resolutionSelected.intValue)];
[self.resolutionSelector setEnabled:!self.customResolutionSwitch.isOn];
[self touchModeChanged:self.touchModeSelector]; // a special fix for iOS 14 to set hidden for the "enableOswStack"
settingsViewJustExpanded = false;
}
- (void)viewWillDisappear:(BOOL)animated{
@@ -785,6 +790,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self addSetting:self.redirectMicStack ofId:@"redirectMicStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
[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.audioEngineStack ofId:@"audioEngineStack" withInfoTag:YES withDynamicLabel:NO to:audioSection];
[self addSetting:self.audioConfigStack ofId:@"audioConfigStack" withInfoTag:NO withDynamicLabel:NO to:audioSection];
[audioSection addToParentStack:_parentStack];
// [audioSection setExpanded:NO];
@@ -1534,6 +1540,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self.view addGestureRecognizer:self->slideToCloseSettingsViewRecognizer];
self->settingsViewJustLoaded = true;
self->settingsViewJustExpanded = true;
// Always run settings in dark mode because we want the light fonts
if (@available(iOS 13.0, tvOS 13.0, *)) {
@@ -1739,7 +1746,9 @@ BOOL isCustomResolution(int resolutionSelected) {
[self.graphOpacityStepper setValue:(int)self->tempSettings.graphOpacity.intValue];
[self.graphOpacityStepper addTarget:self action:@selector(graphOpacityStepperTapped:) forControlEvents:UIControlEventValueChanged];
[self graphOpacityStepperTapped:self.graphOpacityStepper];
self.audioEngineSelector.selectedSegmentIndex = self->tempSettings.audioEngine.intValue;
if (@available(iOS 18.0, tvOS 18.0, *)) {}else{
[self.audioConfigSelector removeSegmentAtIndex:1 animated:false];
[self.audioConfigSelector removeSegmentAtIndex:1 animated:false]; // segment 2 goes away when you remove index 2
@@ -1865,7 +1874,7 @@ BOOL isCustomResolution(int resolutionSelected) {
self->motionControlSection.expandable = [self isCustomOswEnabled];
[self->motionControlSection setExpanded:[self isCustomOswEnabled]];
// [self->motionControlSection setExpanded:[self isCustomOswEnabled]];
__weak typeof(self) weakSelf = self;
self->motionControlSection.lockedSectionHandler = ^{
[CountdownAlertController showAlertIn:weakSelf
@@ -1958,8 +1967,7 @@ BOOL isCustomResolution(int resolutionSelected) {
- (bool)isCustomOswEnabled{
bool customOswEnabled = [self isOswEnabled] && self.onScreenWidgetSelector.selectedSegmentIndex == OnScreenControlsLevelCustom;
motionControlSection.expandable = customOswEnabled;
if(!settingsViewJustLoaded) [motionControlSection setExpanded:customOswEnabled];
NSLog(@"isCustomOswEnabled %d, %f",customOswEnabled, CACurrentMediaTime());
if(!(settingsViewJustExpanded || settingsViewJustLoaded)) [motionControlSection setExpanded:customOswEnabled];
return customOswEnabled;
}
@@ -2079,12 +2087,12 @@ BOOL isCustomResolution(int resolutionSelected) {
}
bool customOscEnabled = [self isCustomOswEnabled];
NSLog(@"customOscEnabled %d", customOscEnabled);
// NSLog(@"customOscEnabled %d", customOscEnabled);
UILabel* oswDynamicLabel = [self findDynamicLabelFromStack:self.onScreenWidgetStack];
NSString* labelText = customOscEnabled ? [LocalizationHelper localizedStringForKey:@"%d finger tap", self->oswLayoutFingers] : @"";
oswDynamicLabel.text = [NSString stringWithFormat:@" %@ ", labelText];
oswDynamicLabel.hidden = !customOscEnabled;
NSLog(@"oswDynamicLabel.hidden %d", oswDynamicLabel.hidden);
// NSLog(@"oswDynamicLabel.hidden %d", oswDynamicLabel.hidden);
[self handleOswGestureChange];
if(customOscEnabled && !settingsViewJustLoaded && !self.mainFrameViewController.settingsExpandedInStreamView) {
// [self.keyboardToggleFingerNumSlider setValue:3.0];
@@ -2851,6 +2859,7 @@ BOOL isCustomResolution(int resolutionSelected) {
CGFloat singleTapSensitivity = self.singleTapSensitivitySlider.value;
NSInteger hapticEngine = self.hapticEngineSelector.selectedSegmentIndex;
CGFloat edgeSlidingSensitivity = self.edgeSlidingSensitivitySlider.value;
NSInteger audioEngine = self.audioEngineSelector.selectedSegmentIndex;
NSInteger backgroundSessionTimer = self.backgroundSessionTimerSlider.value == self.backgroundSessionTimerSlider.maximumValue ? (uint32_t) INT16_MAX : (uint32_t)self.backgroundSessionTimerSlider.value;
[dataMan saveSettingsWithBitrate:_bitrate
@@ -2905,6 +2914,7 @@ BOOL isCustomResolution(int resolutionSelected) {
singleTapSensitivy:singleTapSensitivity
hapticEngine:hapticEngine
edgeSlidingSensitivity:edgeSlidingSensitivity
audioEngine:audioEngine
backgroundSessionTimer:backgroundSessionTimer];
}