Skip to content

Commit

Permalink
Improved audio device name
Browse files Browse the repository at this point in the history
  • Loading branch information
benbaker76 committed Feb 15, 2020
1 parent 1def64d commit 6219bc8
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 10 deletions.
8 changes: 4 additions & 4 deletions PinConfigurator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,15 @@
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0219;
CURRENT_PROJECT_VERSION = 0220;
ENABLE_STRICT_OBJC_MSGSEND = NO;
INFOPLIST_FILE = PinConfigurator/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.8;
MARKETING_VERSION = 2.1.9;
MARKETING_VERSION = 2.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.PinConfigurator;
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand All @@ -388,15 +388,15 @@
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0219;
CURRENT_PROJECT_VERSION = 0220;
ENABLE_STRICT_OBJC_MSGSEND = NO;
INFOPLIST_FILE = PinConfigurator/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.8;
MARKETING_VERSION = 2.1.9;
MARKETING_VERSION = 2.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.PinConfigurator;
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand Down
Binary file not shown.
3 changes: 2 additions & 1 deletion PinConfigurator/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTab
else if (outlineView == [self importIORegOutlineView])
{
AudioDevice *audioDevice = item;
NSString *deviceName = (audioDevice.codecID != 0 ? audioDevice.codecName : audioDevice.deviceName);

switch ([[tableColumn identifier] intValue])
{
Expand All @@ -683,7 +684,7 @@ - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTab
[cell setStringValue:(audioDevice.codecID != 0 ? [NSString stringWithFormat:@"0x%04X", audioDevice.codecRevisionID & 0xFFFF] : @"-")];
break;
case 7:
[cell setStringValue:(audioDevice.codecID != 0 ? audioDevice.codecName : audioDevice.deviceName)];
[cell setStringValue:(audioDevice.audioDeviceModelID != 0 ? audioDevice.audioDeviceName : deviceName)];
break;
}
}
Expand Down
7 changes: 6 additions & 1 deletion PinConfigurator/AudioDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@
@property uint32_t codecAddress;
@property uint32_t codecID;
@property uint32_t codecRevisionID;
@property uint32_t audioDeviceModelID;
@property (nonatomic, retain) NSString *audioDeviceName;
@property (nonatomic, retain) NSString *audioDeviceManufacturerName;
@property (nonatomic, retain) NSString *vendorName;
@property (nonatomic, retain) NSString *deviceName;
@property (nonatomic, retain) NSString *subVendorName;
@property (nonatomic, retain) NSString *subDeviceName;
@property (nonatomic, retain) NSString *codecVendorName;
@property (nonatomic, retain) NSString *codecName;
@property (nonatomic, retain) NSMutableArray *layoutIDArray;
Expand All @@ -37,7 +42,7 @@
@property uint32_t minKernel;
@property uint32_t maxKernel;

-(id) initWithDeviceBundleID:(NSString *)bundleID deviceClass:(NSString *)deviceClass deviceName:(NSString *)deviceName deviceID:(uint32_t)deviceID revisionID:(uint32_t)revisionID alcLayoutID:(uint32_t)alcLayoutID subDeviceID:(uint32_t)subDeviceID;
-(id) initWithDeviceBundleID:(NSString *)bundleID deviceClass:(NSString *)deviceClass audioDeviceName:(NSString *)audioDeviceName audioDeviceManufacturerName:(NSString *)audioDeviceManufacturerName audioDeviceModelID:(uint32_t)audioDeviceModelID deviceID:(uint32_t)deviceID revisionID:(uint32_t)revisionID alcLayoutID:(uint32_t)alcLayoutID subDeviceID:(uint32_t)subDeviceID;

@end

Expand Down
6 changes: 4 additions & 2 deletions PinConfigurator/AudioDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@

@implementation AudioDevice

-(id) initWithDeviceBundleID:(NSString *)bundleID deviceClass:(NSString *)deviceClass deviceName:(NSString *)deviceName deviceID:(uint32_t)deviceID revisionID:(uint32_t)revisionID alcLayoutID:(uint32_t)alcLayoutID subDeviceID:(uint32_t)subDeviceID
-(id) initWithDeviceBundleID:(NSString *)bundleID deviceClass:(NSString *)deviceClass audioDeviceName:(NSString *)audioDeviceName audioDeviceManufacturerName:(NSString *)audioDeviceManufacturerName audioDeviceModelID:(uint32_t)audioDeviceModelID deviceID:(uint32_t)deviceID revisionID:(uint32_t)revisionID alcLayoutID:(uint32_t)alcLayoutID subDeviceID:(uint32_t)subDeviceID
{
if (self = [super init])
{
self.bundleID = bundleID;
self.deviceClass = deviceClass;
self.deviceName = deviceName;
self.audioDeviceName = audioDeviceName;
self.audioDeviceManufacturerName = audioDeviceManufacturerName;
self.audioDeviceModelID = audioDeviceModelID;
self.deviceID = deviceID;
self.revisionID = revisionID;
self.alcLayoutID = alcLayoutID;
Expand Down
27 changes: 25 additions & 2 deletions PinConfigurator/IORegTools.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,30 @@ bool getIORegAudioDeviceArray(NSMutableArray **audioDeviceArray)
NSMutableDictionary *propertyDictionary = (__bridge NSMutableDictionary *)propertyDictionaryRef;

NSString *bundleID = [propertyDictionary objectForKey:@"CFBundleIdentifier"];
NSString *deviceName = [propertyDictionary objectForKey:@"IOAudioDeviceName"];
NSString *audioDeviceName = [propertyDictionary objectForKey:@"IOAudioDeviceName"];
NSString *audioDeviceModelID = [propertyDictionary objectForKey:@"IOAudioDeviceModelID"];
NSString *audioDeviceManufacturerName = [propertyDictionary objectForKey:@"IOAudioDeviceManufacturerName"];
uint32_t audioDeviceDeviceID = 0, audioDeviceVendorID = 0;
uint32_t audioDeviceDeviceIDNew = 0;

if (audioDeviceModelID != nil)
{
NSArray *modelIDArray = [audioDeviceModelID componentsSeparatedByString:@":"];

if ([modelIDArray count] == 3)
{
NSScanner *deviceIDScanner = [NSScanner scannerWithString:[modelIDArray objectAtIndex:1]];
NSScanner *productIDScanner = [NSScanner scannerWithString:[modelIDArray objectAtIndex:2]];

[deviceIDScanner setScanLocation:0];
[deviceIDScanner scanHexInt:&audioDeviceVendorID];

[productIDScanner setScanLocation:0];
[productIDScanner scanHexInt:&audioDeviceDeviceID];

audioDeviceDeviceIDNew = (audioDeviceVendorID << 16) | audioDeviceDeviceID;
}
}

io_service_t parentDevice;

Expand All @@ -144,7 +167,7 @@ bool getIORegAudioDeviceArray(NSMutableArray **audioDeviceArray)
uint32_t deviceIDNew = (vendorID << 16) | deviceID;
uint32_t subDeviceIDNew = (subSystemVendorID << 16) | subSystemID;

AudioDevice *audioDevice = [[AudioDevice alloc] initWithDeviceBundleID:bundleID deviceClass:[NSString stringWithUTF8String:className] deviceName:deviceName deviceID:deviceIDNew revisionID:revisionID alcLayoutID:alcLayoutID subDeviceID:subDeviceIDNew];
AudioDevice *audioDevice = [[AudioDevice alloc] initWithDeviceBundleID:bundleID deviceClass:[NSString stringWithUTF8String:className] audioDeviceName:audioDeviceName audioDeviceManufacturerName:audioDeviceManufacturerName audioDeviceModelID:audioDeviceDeviceIDNew deviceID:deviceIDNew revisionID:revisionID alcLayoutID:alcLayoutID subDeviceID:subDeviceIDNew];

io_service_t codecDevice;

Expand Down

0 comments on commit 6219bc8

Please sign in to comment.