diff --git a/PinConfigurator.xcodeproj/project.xcworkspace/xcuserdata/headsoft.xcuserdatad/UserInterfaceState.xcuserstate b/PinConfigurator.xcodeproj/project.xcworkspace/xcuserdata/headsoft.xcuserdatad/UserInterfaceState.xcuserstate index b02a170..3cacde6 100755 Binary files a/PinConfigurator.xcodeproj/project.xcworkspace/xcuserdata/headsoft.xcuserdatad/UserInterfaceState.xcuserstate and b/PinConfigurator.xcodeproj/project.xcworkspace/xcuserdata/headsoft.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PinConfigurator/AudioNode.h b/PinConfigurator/AudioNode.h index 5b86359..716c9b7 100755 --- a/PinConfigurator/AudioNode.h +++ b/PinConfigurator/AudioNode.h @@ -14,6 +14,8 @@ #define LONIBBLE(n) ((char)(n) & 0xF) #define HINIBBLE(n) ((char)(((char)(n) >> 4) & 0xF)) +#define HDA_EAPD_BTL_ENABLE_EAPD 0x00000002 + enum { kHdaPinCapabilitiesImpendance = (1 << 0), diff --git a/PinConfigurator/AudioNode.m b/PinConfigurator/AudioNode.m index 6ac2c3e..473b1fb 100755 --- a/PinConfigurator/AudioNode.m +++ b/PinConfigurator/AudioNode.m @@ -9,8 +9,6 @@ #import "AudioNode.h" #import "NSString+Pin.h" #import "NSColor+Pin.h" -#import "HdaVerbs.h" -#import "HdaCodec.h" #import @implementation AudioNode @@ -250,14 +248,7 @@ - (NSColor *)jackColor - (NSString *)directionString { - NSString *pinDirection = @"--"; - - if ([self isOut]) - pinDirection = @"Out"; - else if ([self isIn]) - pinDirection = @"In"; - - return pinDirection; + return [NSString pinDirection:_device]; } @end diff --git a/PinConfigurator/NSString+Pin.h b/PinConfigurator/NSString+Pin.h index 2cb77bd..d5c8e63 100755 --- a/PinConfigurator/NSString+Pin.h +++ b/PinConfigurator/NSString+Pin.h @@ -12,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN @interface NSString (Pin) ++ (NSString *)pinDirection:(uint8_t)value; + (NSString *)pinColor:(uint8_t)value; + (NSString *)pinMisc:(uint8_t)value; + (NSString *)pinDefaultDevice:(uint8_t)value; diff --git a/PinConfigurator/NSString+Pin.m b/PinConfigurator/NSString+Pin.m index 96082c8..d2b7b76 100755 --- a/PinConfigurator/NSString+Pin.m +++ b/PinConfigurator/NSString+Pin.m @@ -7,9 +7,13 @@ // #import "NSString+Pin.h" +#import "AudioNode.h" @implementation NSString (Pin) +#define GetLocalizedString(key) \ +[[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil] + const char *gPinColorArray[] = { "Unknown", "Black", "Gray", "Blue", "Green", "Red", "Orange", "Yellow", "Purple", "Pink", "Reserved1", "Unknown", "Unknown", "Reserved2", "White", "Other" }; const char *gPinMisc[] = { "Jack Detect Override", "Reserved", "Reserved", "Reserved" }; const char *gPinDefaultDeviceArray[] = { "Line Out", "Speaker", "HP Out", "CD", "SPDIF Out", "Digital Other Out", "Modem Line Side", "Modem Handset Side", "Line In", "AUX", "Mic In", "Telephony", "SPDIF In", "Digital Other In", "Reserved", "Other" }; @@ -22,51 +26,63 @@ @implementation NSString (Pin) const char *gPinGrossSpecial9[] = { "Special", "ATAPI", "Special", "Special" }; const char *gPinEAPD[] = { "BTL", "EAPD", "L/R Swap" }; ++ (NSString *)pinDirection:(uint8_t)value; +{ + NSString *pinDirection = @"--"; + + if (value <= kHdaConfigDefaultDeviceModemHandset) + pinDirection = GetLocalizedString(@"Out"); + else if (value > kHdaConfigDefaultDeviceModemHandset && value <= kHdaConfigDefaultDeviceOtherDigitalIn) + pinDirection = GetLocalizedString(@"In"); + + return pinDirection; +} + + (NSString *)pinColor:(uint8_t)value { - return [NSString stringWithUTF8String:gPinColorArray[value & 0xF]]; + return GetLocalizedString([NSString stringWithUTF8String:gPinColorArray[value & 0xF]]); } + (NSString *)pinMisc:(uint8_t)value { - return [NSString stringWithUTF8String:gPinMisc[value & 0x3]]; + return GetLocalizedString([NSString stringWithUTF8String:gPinMisc[value & 0x3]]); } + (NSString *)pinDefaultDevice:(uint8_t)value { - return [NSString stringWithUTF8String:gPinDefaultDeviceArray[value & 0xF]]; + return GetLocalizedString([NSString stringWithUTF8String:gPinDefaultDeviceArray[value & 0xF]]); } + (NSString *)pinConnector:(uint8_t)value { - return [NSString stringWithUTF8String:gPinConnector[value & 0xF]]; + return GetLocalizedString([NSString stringWithUTF8String:gPinConnector[value & 0xF]]); } + (NSString *)pinPort:(uint8_t)value { - return [NSString stringWithUTF8String:gPinPort[value & 0x3]]; + return GetLocalizedString([NSString stringWithUTF8String:gPinPort[value & 0x3]]); } + (NSString *)pinGrossLocation:(uint8_t)value; { - return [NSString stringWithUTF8String:gPinGrossLocation[value]]; + return GetLocalizedString([NSString stringWithUTF8String:gPinGrossLocation[value]]); } + (NSString *)pinLocation:(uint8_t)grossLocation geometricLocation:(uint8_t)geometricLocation; { if (geometricLocation == 0x7) - return [NSString stringWithUTF8String:gPinGrossSpecial7[grossLocation]]; + return GetLocalizedString([NSString stringWithUTF8String:gPinGrossSpecial7[grossLocation]]); else if (geometricLocation == 0x8) - return [NSString stringWithUTF8String:gPinGrossSpecial8[grossLocation]]; + return GetLocalizedString([NSString stringWithUTF8String:gPinGrossSpecial8[grossLocation]]); else if (geometricLocation == 0x9) - return [NSString stringWithUTF8String:gPinGrossSpecial9[grossLocation]]; + return GetLocalizedString([NSString stringWithUTF8String:gPinGrossSpecial9[grossLocation]]); - return [NSString stringWithUTF8String:gPinGeometricLocation[geometricLocation]]; + return GetLocalizedString([NSString stringWithUTF8String:gPinGeometricLocation[geometricLocation]]); } + (NSString *)pinEAPD:(uint8_t)value; { - return [NSString stringWithUTF8String:gPinEAPD[value & 0x7]]; + return GetLocalizedString([NSString stringWithUTF8String:gPinEAPD[value & 0x7]]); } + (NSString *)pinConfigDescription:(uint8_t *)value