Output: Add System Default Output option, rather than adjusting the listing to display the current system default only the first time
parent
554dde4e91
commit
ed8a5763ab
|
@ -83,7 +83,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
|
|||
OSStatus err;
|
||||
|
||||
if (deviceID == -1) {
|
||||
DLog(@"DEVICE IS -1");
|
||||
UInt32 size = sizeof(AudioDeviceID);
|
||||
AudioObjectPropertyAddress theAddress = {
|
||||
.mSelector = kAudioHardwarePropertyDefaultOutputDevice,
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
[self removeObjects:[self arrangedObjects]];
|
||||
|
||||
[self setSelectsInsertedObjects:NO];
|
||||
|
||||
NSDictionary *defaultDeviceInfo = @{
|
||||
@"name": @"System Default Device",
|
||||
@"deviceID": @(-1),
|
||||
};
|
||||
[self addObject:defaultDeviceInfo];
|
||||
|
||||
NSDictionary *defaultDevice = [[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"outputDevice"];
|
||||
NSString *defaultDeviceName = defaultDevice[@"name"];
|
||||
|
@ -23,7 +29,7 @@
|
|||
};
|
||||
[self addObject:deviceInfo];
|
||||
|
||||
if (defaultDevice) {
|
||||
if (defaultDevice && defaultDeviceID != -1) {
|
||||
if ((deviceID == defaultDeviceID) ||
|
||||
([deviceName isEqualToString:defaultDeviceName])) {
|
||||
[self setSelectedObjects:[NSArray arrayWithObject:deviceInfo]];
|
||||
|
@ -31,14 +37,9 @@
|
|||
[[NSUserDefaults standardUserDefaults] setObject:deviceInfo forKey:@"outputDevice"];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (deviceID == systemDefaultID) {
|
||||
[self setSelectedObjects:[NSArray arrayWithObject:deviceInfo]];
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
if (!defaultDevice) {
|
||||
if (!defaultDevice || defaultDeviceID == -1) {
|
||||
[self setSelectionIndex:0];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue