mirror of
https://github.com/bitgapp/eqMac.git
synced 2024-11-23 06:42:02 +03:00
changes
This commit is contained in:
parent
1799e6fa9e
commit
ac2bb45c1b
@ -7,7 +7,7 @@
|
||||
<string>com.bitgapp.eqmac.xpc</string>
|
||||
</array>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>20A5354i</string>
|
||||
<string>19G2021</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
@ -45,17 +45,19 @@
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>11E708</string>
|
||||
<string>12A7300</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>macosx</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<string>10.15.6</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>19G68</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.15</string>
|
||||
<key>DTXcode</key>
|
||||
<string>1160</string>
|
||||
<string>1201</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>11E708</string>
|
||||
<string>12A7300</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.9</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
Binary file not shown.
@ -110,15 +110,27 @@ class Application {
|
||||
}
|
||||
|
||||
private static func checkDriver (_ completion: @escaping() -> Void) {
|
||||
if !Driver.isInstalled {
|
||||
Alert.confirm(
|
||||
title: "The eqMac Audio Driver is not installed", message: "For unknown reason the Audio Driver needed for eqMac to work corrently is not installed. Please try re-installing eqMac from our website.", okText: "Re-install eqMac", cancelText: "Quit") { restart in
|
||||
if restart {
|
||||
NSWorkspace.shared.open(Constants.WEBSITE_URL)
|
||||
return
|
||||
} else {
|
||||
return self.quit()
|
||||
if !Driver.isInstalled || Driver.isMismatched {
|
||||
let isJustMismatched = Driver.isInstalled && Driver.isMismatched
|
||||
let message = isJustMismatched ?
|
||||
"For unknown reason the version of Audio Driver needed for eqMac to work corrently is not correct. Try restarting your computer and run eqMac again. In that doesn't work, try re-installing eqMac from our website."
|
||||
: "For unknown reason the Audio Driver needed for eqMac to work corrently is not installed. Try restarting your computer and run eqMac again. In that doesn't work, try re-installing eqMac from our website."
|
||||
let title = isJustMismatched ? "The eqMac Audio Driver is Outdated" : "The eqMac Audio Driver is not installed"
|
||||
Alert.withButtons(
|
||||
title: title,
|
||||
message: message,
|
||||
buttons: ["Restart Mac", "Re-install eqMac", "Quit"]
|
||||
) { buttonPressed in
|
||||
Console.log(buttonPressed)
|
||||
switch NSApplication.ModalResponse(buttonPressed) {
|
||||
case .alertFirstButtonReturn:
|
||||
self.restartMac()
|
||||
break
|
||||
case .alertSecondButtonReturn:
|
||||
NSWorkspace.shared.open(Constants.WEBSITE_URL)
|
||||
default: break
|
||||
}
|
||||
return self.quit()
|
||||
}
|
||||
} else {
|
||||
completion()
|
||||
|
@ -24,7 +24,7 @@ class ApplicationDataBus: DataBus {
|
||||
"name": host.localizedName as AnyObject,
|
||||
"model": Sysctl.model as String,
|
||||
"version": Bundle.main.infoDictionary?["CFBundleVersion"] as Any,
|
||||
// "driverVersion": Driver.bundledVersion
|
||||
"driverVersion": Driver.installedVersion
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,10 @@ import AVFoundation
|
||||
class Output {
|
||||
|
||||
static func isDeviceAllowed(_ device: AudioDevice) -> Bool {
|
||||
return device.transportType != nil && Constants.SUPPORTED_TRANSPORT_TYPES.contains(device.transportType!) && !device.isInputOnlyDevice()
|
||||
return device.transportType != nil
|
||||
&& Constants.SUPPORTED_TRANSPORT_TYPES.contains(device.transportType!)
|
||||
&& !device.isInputOnlyDevice()
|
||||
&& !device.name.contains("CADefaultDeviceAggregate")
|
||||
}
|
||||
|
||||
static func autoSelect (_ device: AudioDevice) -> Bool {
|
||||
|
@ -25,6 +25,7 @@ enum CustomProperties: String {
|
||||
case kAudioDeviceCustomPropertyLatency = "cltc"
|
||||
case kAudioDeviceCustomPropertySafetyOffset = "csfo"
|
||||
case kAudioDeviceCustomPropertyShown = "shwn"
|
||||
case kAudioDeviceCustomPropertyVersion = "vrsn"
|
||||
}
|
||||
|
||||
class Driver {
|
||||
@ -55,13 +56,7 @@ class Driver {
|
||||
static var bundledVersion: String {
|
||||
return info["CFBundleVersion"] as! String
|
||||
}
|
||||
//
|
||||
// static var isOutdated: Bool {
|
||||
// get {
|
||||
// return bundledVersion != lastInstalledVersion
|
||||
// }
|
||||
// }
|
||||
//
|
||||
|
||||
static var sampleRates: [Double] {
|
||||
return [
|
||||
8_000,
|
||||
@ -190,10 +185,10 @@ class Driver {
|
||||
|
||||
var size: UInt32 = UInt32(MemoryLayout<CFBoolean>.size)
|
||||
|
||||
var shown = kCFBooleanFalse
|
||||
var shownBool = kCFBooleanFalse
|
||||
|
||||
checkErr(AudioObjectGetPropertyData(Driver.device!.id, &address, 0, nil, &size, &shown))
|
||||
return CFBooleanGetValue(shown!)
|
||||
checkErr(AudioObjectGetPropertyData(Driver.device!.id, &address, 0, nil, &size, &shownBool))
|
||||
return CFBooleanGetValue(shownBool!)
|
||||
}
|
||||
set {
|
||||
if Driver.device == nil { return }
|
||||
@ -205,12 +200,32 @@ class Driver {
|
||||
)
|
||||
|
||||
let size: UInt32 = UInt32(MemoryLayout<CFBoolean>.size)
|
||||
var shown: CFBoolean = newValue.cfBooleanValue
|
||||
var shownBool: CFBoolean = newValue.cfBooleanValue
|
||||
|
||||
checkErr(AudioObjectSetPropertyData(Driver.device!.id, &address, 0, nil, size, &shown))
|
||||
checkErr(AudioObjectSetPropertyData(Driver.device!.id, &address, 0, nil, size, &shownBool))
|
||||
}
|
||||
}
|
||||
|
||||
static var installedVersion: String? {
|
||||
if Driver.device == nil { return nil }
|
||||
var address = AudioObjectPropertyAddress(
|
||||
mSelector: getPropertySelectorFromString(CustomProperties.kAudioDeviceCustomPropertyVersion.rawValue),
|
||||
mScope: kAudioObjectPropertyScopeGlobal,
|
||||
mElement: kAudioObjectPropertyElementMaster
|
||||
)
|
||||
|
||||
var size: UInt32 = UInt32(MemoryLayout<CFString>.size)
|
||||
|
||||
var version: CFString? = nil
|
||||
|
||||
checkErr(AudioObjectGetPropertyData(Driver.device!.id, &address, 0, nil, &size, &version))
|
||||
return version as String?
|
||||
}
|
||||
|
||||
static var isMismatched: Bool {
|
||||
return bundledVersion != installedVersion
|
||||
}
|
||||
|
||||
static var hidden: Bool {
|
||||
get { return !shown }
|
||||
set { shown = !newValue }
|
||||
|
@ -25,11 +25,8 @@ class Alert {
|
||||
cancelText: String = "Cancel",
|
||||
callback: @escaping (Bool) -> Void
|
||||
) {
|
||||
DispatchQueue.main.async {
|
||||
let alert = getAlert(title, message)
|
||||
alert.addButton(withTitle: okText)
|
||||
alert.addButton(withTitle: cancelText)
|
||||
let result = alert.runModal() == .alertFirstButtonReturn
|
||||
withButtons(title: title, message: message, buttons: [okText, cancelText]) { buttonPressed in
|
||||
let result = NSApplication.ModalResponse(buttonPressed) == .alertFirstButtonReturn
|
||||
callback(result)
|
||||
}
|
||||
}
|
||||
@ -57,6 +54,23 @@ class Alert {
|
||||
|
||||
}
|
||||
|
||||
static func withButtons (
|
||||
title: String,
|
||||
message: String,
|
||||
buttons: [String],
|
||||
callback: @escaping (Int) -> Void
|
||||
) {
|
||||
DispatchQueue.main.async {
|
||||
let alert = getAlert(title, message)
|
||||
for text in buttons {
|
||||
alert.addButton(withTitle: text)
|
||||
}
|
||||
let result = alert.runModal()
|
||||
callback(result.rawValue)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static private func getAlert (_ title: String, _ message: String) -> NSAlert {
|
||||
let alert = NSAlert()
|
||||
alert.messageText = title
|
||||
|
@ -325,6 +325,7 @@ bool EQM_Device::Device_HasProperty(AudioObjectID inObjectID, pid_t inClientPID,
|
||||
case kAudioDeviceCustomPropertyLatency:
|
||||
case kAudioDeviceCustomPropertySafetyOffset:
|
||||
case kAudioDeviceCustomPropertyShown:
|
||||
case kAudioDeviceCustomPropertyVersion:
|
||||
theAnswer = true;
|
||||
break;
|
||||
|
||||
@ -360,6 +361,7 @@ bool EQM_Device::Device_IsPropertySettable(AudioObjectID inObjectID, pid_t inCli
|
||||
case kAudioObjectPropertyCustomPropertyInfoList:
|
||||
case kAudioDeviceCustomPropertyDeviceAudibleState:
|
||||
case kAudioDeviceCustomPropertyDeviceIsRunningSomewhereOtherThanEQMApp:
|
||||
case kAudioDeviceCustomPropertyVersion:
|
||||
theAnswer = false;
|
||||
break;
|
||||
|
||||
@ -457,7 +459,7 @@ UInt32 EQM_Device::Device_GetPropertyDataSize(AudioObjectID inObjectID, pid_t in
|
||||
break;
|
||||
|
||||
case kAudioObjectPropertyCustomPropertyInfoList:
|
||||
theAnswer = sizeof(AudioServerPlugInCustomPropertyInfo) * 9;
|
||||
theAnswer = sizeof(AudioServerPlugInCustomPropertyInfo) * 10;
|
||||
break;
|
||||
|
||||
case kAudioDeviceCustomPropertyDeviceAudibleState:
|
||||
@ -495,6 +497,10 @@ UInt32 EQM_Device::Device_GetPropertyDataSize(AudioObjectID inObjectID, pid_t in
|
||||
theAnswer = sizeof(CFBooleanRef);
|
||||
break;
|
||||
|
||||
case kAudioDeviceCustomPropertyVersion:
|
||||
theAnswer = sizeof(CFStringRef);
|
||||
break;
|
||||
|
||||
default:
|
||||
theAnswer = EQM_AbstractDevice::GetPropertyDataSize(inObjectID, inClientPID, inAddress, inQualifierDataSize, inQualifierData);
|
||||
break;
|
||||
@ -910,9 +916,9 @@ void EQM_Device::Device_GetPropertyData(AudioObjectID inObjectID, pid_t inClient
|
||||
theNumberItemsToFetch = inDataSize / sizeof(AudioServerPlugInCustomPropertyInfo);
|
||||
|
||||
// clamp it to the number of items we have
|
||||
if(theNumberItemsToFetch > 9)
|
||||
if(theNumberItemsToFetch > 10)
|
||||
{
|
||||
theNumberItemsToFetch = 9;
|
||||
theNumberItemsToFetch = 10;
|
||||
}
|
||||
|
||||
if(theNumberItemsToFetch > 0)
|
||||
@ -972,6 +978,13 @@ void EQM_Device::Device_GetPropertyData(AudioObjectID inObjectID, pid_t inClient
|
||||
((AudioServerPlugInCustomPropertyInfo*)outData)[6].mQualifierDataType = kAudioServerPlugInCustomPropertyDataTypeNone;
|
||||
}
|
||||
|
||||
if(theNumberItemsToFetch > 9)
|
||||
{
|
||||
((AudioServerPlugInCustomPropertyInfo*)outData)[7].mSelector = kAudioDeviceCustomPropertyVersion;
|
||||
((AudioServerPlugInCustomPropertyInfo*)outData)[7].mPropertyDataType = kAudioServerPlugInCustomPropertyDataTypeCFString;
|
||||
((AudioServerPlugInCustomPropertyInfo*)outData)[7].mQualifierDataType = kAudioServerPlugInCustomPropertyDataTypeNone;
|
||||
}
|
||||
|
||||
outDataSize = theNumberItemsToFetch * sizeof(AudioServerPlugInCustomPropertyInfo);
|
||||
break;
|
||||
|
||||
@ -1006,6 +1019,23 @@ void EQM_Device::Device_GetPropertyData(AudioObjectID inObjectID, pid_t inClient
|
||||
}
|
||||
break;
|
||||
|
||||
case kAudioDeviceCustomPropertyVersion:
|
||||
{
|
||||
ThrowIf(inDataSize < sizeof(CFStringRef), CAException(kAudioHardwareBadPropertySizeError), "EQM_Device::Device_GetPropertyData: not enough space for the return value of kAudioDeviceCustomPropertyVersion for the device");
|
||||
CAMutex::Locker theStateLocker(mStateMutex);
|
||||
|
||||
CFStringRef version = CFCopyDescription(
|
||||
CFBundleGetValueForInfoDictionaryKey(
|
||||
CFBundleGetBundleWithIdentifier(CFSTR(kEQMDriverBundleID)),
|
||||
kCFBundleVersionKey
|
||||
)
|
||||
);
|
||||
// DebugMsg("EQM_LOG: %s", CFStringGetCStringPtr(CFCopyDescription(CFBundleGetMainBundle()), kCFStringEncodingMacRoman));
|
||||
*reinterpret_cast<CFStringRef*>(outData) = version;
|
||||
outDataSize = sizeof(CFStringRef);
|
||||
}
|
||||
break;
|
||||
|
||||
case kAudioDeviceCustomPropertyDeviceIsRunningSomewhereOtherThanEQMApp:
|
||||
ThrowIf(inDataSize < sizeof(CFBooleanRef), CAException(kAudioHardwareBadPropertySizeError), "EQM_Device::Device_GetPropertyData: not enough space for the return value of kAudioDeviceCustomPropertyDeviceIsRunningSomewhereOtherThanEQMApp for the device");
|
||||
*reinterpret_cast<CFBooleanRef*>(outData) = mClients.ClientsOtherThanEQMAppRunningIO() ? kCFBooleanTrue : kCFBooleanFalse;
|
||||
|
@ -106,7 +106,8 @@ enum
|
||||
kAudioDeviceCustomPropertyEnabledOutputControls = 'bgct',
|
||||
kAudioDeviceCustomPropertyLatency = 'cltc',
|
||||
kAudioDeviceCustomPropertySafetyOffset = 'csfo',
|
||||
kAudioDeviceCustomPropertyShown = 'shwn'
|
||||
kAudioDeviceCustomPropertyShown = 'shwn',
|
||||
kAudioDeviceCustomPropertyVersion = 'vrsn'
|
||||
};
|
||||
|
||||
// The number of silent/audible frames before EQMDriver will change kAudioDeviceCustomPropertyDeviceAudibleState
|
||||
|
Loading…
Reference in New Issue
Block a user