From 4f9c58ec4a11e61e3d3941ad236138d114f5b942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wei=C3=9F?= Date: Mon, 17 Feb 2020 13:47:16 +0100 Subject: [PATCH 1/3] Remove DevelopmentTeam that slipped through. --- Cog.xcodeproj/project.pbxproj | 1 - 1 file changed, 1 deletion(-) diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index 70aa9bdb8..685912537 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -1943,7 +1943,6 @@ LastUpgradeCheck = 1100; TargetAttributes = { 8D1107260486CEB800E47090 = { - DevelopmentTeam = 4S876G9VCD; ProvisioningStyle = Automatic; }; }; -- 2.45.2 From f01915ed809cb13fe38f8d4ba64384f9a95415f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wei=C3=9F?= Date: Mon, 17 Feb 2020 17:06:48 +0100 Subject: [PATCH 2/3] Project touched by Xcode. --- Cog.xcodeproj/project.pbxproj | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index 685912537..993d09425 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -329,6 +329,20 @@ remoteGlobalIDString = 8D5B49AC048680CD000E48DA; remoteInfo = General; }; + 3D2C77DC23FABECD00B3FAEC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83E6B750181612FD00D4576D /* Sparkle.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = EA4311EA229D651300A5503D; + remoteInfo = bsdiff; + }; + 3D2C77DE23FABECD00B3FAEC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83E6B750181612FD00D4576D /* Sparkle.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = EA4311A0229D5FBC00A5503D; + remoteInfo = ed25519; + }; 566D321A0D538550004466A5 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 566D32160D538550004466A5 /* APL.xcodeproj */; @@ -1758,6 +1772,8 @@ 8319A68B1F79E99300C168D6 /* generate_appcast */, 835C888622CC1853001B4B3F /* generate_keys */, 835C888822CC1853001B4B3F /* sign_update */, + 3D2C77DD23FABECD00B3FAEC /* libbsdiff.a */, + 3D2C77DF23FABECD00B3FAEC /* libed25519.a */, ); name = Products; sourceTree = ""; @@ -2151,6 +2167,20 @@ remoteRef = 17F5622D0C3BD8FB0019975C /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 3D2C77DD23FABECD00B3FAEC /* libbsdiff.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libbsdiff.a; + remoteRef = 3D2C77DC23FABECD00B3FAEC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3D2C77DF23FABECD00B3FAEC /* libed25519.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libed25519.a; + remoteRef = 3D2C77DE23FABECD00B3FAEC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 566D321B0D538550004466A5 /* APL.bundle */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; -- 2.45.2 From da775ce8a654eeae6d94c9bf45fc34d093e48020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wei=C3=9F?= Date: Mon, 17 Feb 2020 18:20:48 +0100 Subject: [PATCH 3/3] Clean up output device code. --- Audio/Output/OutputCoreAudio.h | 3 +- Audio/Output/OutputCoreAudio.m | 41 +++++++++++++------- Preferences/General/OutputsArrayController.m | 11 ++++-- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/Audio/Output/OutputCoreAudio.h b/Audio/Output/OutputCoreAudio.h index 3765357d5..4169e58b7 100644 --- a/Audio/Output/OutputCoreAudio.h +++ b/Audio/Output/OutputCoreAudio.h @@ -26,7 +26,8 @@ - (id)initWithController:(OutputNode *)c; - (BOOL)setup; -- (BOOL)setOutputDevice:(AudioDeviceID)outputDevice; +- (OSStatus)setOutputDeviceByID:(AudioDeviceID)deviceID; +- (BOOL)setOutputDeviceWithDeviceDict:(NSDictionary *)deviceDict; - (void)start; - (void)pause; - (void)resume; diff --git a/Audio/Output/OutputCoreAudio.m b/Audio/Output/OutputCoreAudio.m index 243e8ddbd..357beb204 100644 --- a/Audio/Output/OutputCoreAudio.m +++ b/Audio/Output/OutputCoreAudio.m @@ -71,7 +71,8 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc } -- (OSStatus)setOutputDeviceByID:(AudioDeviceID)deviceID { +- (OSStatus)setOutputDeviceByID:(AudioDeviceID)deviceID +{ OSStatus err; if (deviceID == -1) { @@ -85,10 +86,13 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &theAddress, 0, NULL, &size, &deviceID); if (err != noErr) { - ALog(@"THERE'S NO DEFAULT OUTPUT DEVICE"); + DLog(@"THERE'S NO DEFAULT OUTPUT DEVICE"); return err; } + else { + outputDeviceID = deviceID; + } } printf("DEVICE: %i\n", deviceID); @@ -101,6 +105,12 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc &deviceID, sizeof(AudioDeviceID)); + if (err != noErr) { + DLog(@"No output device with ID %d could be found.", deviceID); + + return err; + } + return err; } @@ -114,23 +124,26 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc if (err != noErr) { // Try matching by name. NSString *userDeviceName = deviceDict[@"name"]; + [self enumerateAudioOutputsUsingBlock: ^(NSString *deviceName, AudioDeviceID deviceID, AudioDeviceID systemDefaultID, BOOL *stop) { - if ([deviceName isEqualToString:userDeviceName]) { - err = [self setOutputDeviceByID:deviceID]; - + if ([deviceName isEqualToString:userDeviceName]) { + err = [self setOutputDeviceByID:deviceID]; + #if 0 - // Disable. Would cause loop by triggering `-observeValueForKeyPath:ofObject:change:context:` above. - // Update `outputDevice`, in case the ID has changed. - NSDictionary *deviceInfo = @{ - @"name": deviceName, - @"deviceID": [NSNumber numberWithUnsignedInt:deviceID], - }; - [[NSUserDefaults standardUserDefaults] setObject:deviceInfo forKey:@"outputDevice"]; + // Disable. Would cause loop by triggering `-observeValueForKeyPath:ofObject:change:context:` above. + // Update `outputDevice`, in case the ID has changed. + NSDictionary *deviceInfo = @{ + @"name": deviceName, + @"deviceID": @(deviceID), + }; + [[NSUserDefaults standardUserDefaults] setObject:deviceInfo forKey:@"outputDevice"]; #endif - return; - } + DLog(@"Found output device: \"%@\" (%d).", deviceName, deviceID); + + *stop = YES; + } }]; } diff --git a/Preferences/General/OutputsArrayController.m b/Preferences/General/OutputsArrayController.m index c6ac0139a..5477edd40 100644 --- a/Preferences/General/OutputsArrayController.m +++ b/Preferences/General/OutputsArrayController.m @@ -9,18 +9,21 @@ [self setSelectsInsertedObjects:NO]; NSDictionary *defaultDevice = [[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"outputDevice"]; - + NSString *defaultDeviceName = defaultDevice[@"name"]; + NSNumber *defaultDeviceIDNum = defaultDevice[@"deviceID"]; + AudioDeviceID defaultDeviceID = [defaultDeviceIDNum unsignedIntValue]; + [self enumerateAudioOutputsUsingBlock: ^(NSString *deviceName, AudioDeviceID deviceID, AudioDeviceID systemDefaultID, BOOL *stop) { NSDictionary *deviceInfo = @{ @"name": deviceName, - @"deviceID": [NSNumber numberWithUnsignedInt:deviceID], + @"deviceID": @(deviceID), }; [self addObject:deviceInfo]; if (defaultDevice) { - if (([[defaultDevice objectForKey:@"deviceID"] isEqualToNumber:[deviceInfo objectForKey:@"deviceID"]]) || - ([[defaultDevice objectForKey:@"name"] isEqualToString:[deviceInfo objectForKey:@"name"]])) { + if ((deviceID == defaultDeviceID) || + ([deviceName isEqualToString:defaultDeviceName])) { [self setSelectedObjects:[NSArray arrayWithObject:deviceInfo]]; // Update `outputDevice`, in case the ID has changed. [[NSUserDefaults standardUserDefaults] setObject:deviceInfo forKey:@"outputDevice"]; -- 2.45.2