1
1
mirror of https://github.com/bitgapp/eqMac.git synced 2024-11-22 13:07:26 +03:00

comit before trying to remove box

This commit is contained in:
Nodeful 2021-08-24 20:45:07 +03:00
parent ba96430510
commit be702d13d1
5 changed files with 23 additions and 9 deletions

View File

@ -35,7 +35,7 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
debugAsWhichUser = "root"
launchStyle = "1"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"

View File

@ -12,7 +12,7 @@ import CoreAudio.AudioServerPlugIn
class EQMBox: EQMObject {
static let id = AudioObjectID(kBoxUID)!
static var name: String? = kBoxDefaultName
static var acquired = false
static var acquired = true
static func hasProperty (objectID: AudioObjectID? = nil, address: AudioObjectPropertyAddress) -> Bool {
switch address.mSelector {

View File

@ -301,7 +301,7 @@ class EQMControl: EQMObject {
// case, only that number of items will be returned
// eqMac only has 1 Source
return .integer(0)
return .integerList([0])
case kAudioSelectorControlPropertyItemName:
// This returns the user-readable name for the selector item in the qualifier
return .string(kDeviceName as CFString)

View File

@ -18,6 +18,7 @@ func EQM_QueryInterface (inDriver: UnsafeMutableRawPointer?, inUUID: REFIID, out
// gAudioServerPlugInDriverInterfacePtr regardless of which one is asked for.
guard EQMDriver.validateDriver(inDriver) else { return kAudioHardwareBadObjectError }
log("Invoked EQM_QueryInterface()")
let uuid = CFUUIDCreateFromUUIDBytes(nil, inUUID)
if uuid == nil || outInterface == nil {
return kAudioHardwareIllegalOperationError
@ -28,20 +29,28 @@ func EQM_QueryInterface (inDriver: UnsafeMutableRawPointer?, inUUID: REFIID, out
EQMDriver.refCounter.increment()
outInterface!.pointee = UnsafeMutableRawPointer(EQMDriver.ref)
log("EQM_QueryInterface() -> \(String(describing: EQMDriver.ref))")
return HRESULT.ok
}
func EQM_AddRef (inDriver: UnsafeMutableRawPointer?) -> ULONG {
// This call returns the resulting reference count after the increment.
guard EQMDriver.validateDriver(inDriver) else { return ULONG(kAudioHardwareBadObjectError) }
log("Invoked EQM_AddRef()")
EQMDriver.refCounter.increment()
log("EQM_AddRef() -> \(EQMDriver.refCounter.value)")
return EQMDriver.refCounter.value
}
func EQM_Release (inDriver: UnsafeMutableRawPointer?) -> ULONG {
// This call returns the resulting reference count after the decrement.
guard EQMDriver.validateDriver(inDriver) else { return ULONG(kAudioHardwareBadObjectError) }
log("Invoked EQM_Release()")
EQMDriver.refCounter.decrement()
log("EQM_Release() -> \(EQMDriver.refCounter.value)")
return EQMDriver.refCounter.value
}
@ -56,6 +65,8 @@ func EQM_Initialize (inDriver: AudioServerPlugInDriverRef, inHost: AudioServerPl
// execution of this method.
guard EQMDriver.validateDriver(inDriver) else { return kAudioHardwareBadObjectError }
log("Invoked EQM_Initialize()")
EQMDriver.host = inHost
// initialize the box acquired property from the settings
@ -87,6 +98,8 @@ func EQM_Initialize (inDriver: AudioServerPlugInDriverRef, inHost: AudioServerPl
EQMDriver.calculateHostTicksPerFrame()
log("EQM_Initialize() - Host: \(String(describing: EQMDriver.host)) | EQMBox.acquired = \(EQMBox.acquired) | EQMBox.name = \(String(describing: EQMBox.name)) | hostTicksPerFrame = \(String(describing: EQMDriver.hostTicksPerFrame))")
return noErr
}
@ -145,12 +158,14 @@ func EQM_PerformDeviceConfigurationChange (inDriver: AudioServerPlugInDriverRef,
// change, the new sample rate is passed in the inChangeAction argument.
guard EQMDriver.validateDriver(inDriver) else { return kAudioHardwareBadObjectError }
log("Invoked EQM_PerformDeviceConfigurationChange()")
if !kSupportedSamplingRates.contains(where: { UInt64($0) == inChangeAction }) { return kAudioHardwareBadObjectError }
EQMDevice.sampleRate = Float64(inChangeAction)
EQMDriver.calculateHostTicksPerFrame()
log("EQM_PerformDeviceConfigurationChange() - EQMDevice.sampleRate = \(EQMDevice.sampleRate) | hostTicksPerFrame = \(String(describing: EQMDriver.hostTicksPerFrame))")
return noErr
}
@ -234,7 +249,8 @@ func EQM_GetPropertyData (inDriver: AudioServerPlugInDriverRef, inObjectID: Audi
return kAudioHardwareBadObjectError
}
log("Invoking: \(EQMDriver.getEQMObjectClassName(from: inObjectID)).getPropertyData(\(inAddress.pointee.mSelector.code))")
log("Invoking: \(EQMDriver.getEQMObjectClassName(from: inObjectID)).getPropertyData(\(inAddress.pointee.mSelector.code)) - Size requested: \(inDataSize)")
let data = ({ () -> EQMObjectProperty? in
if let obj = EQMDriver.getEQMObject(from: inObjectID) {
return obj.getPropertyData(objectID: inObjectID, address: inAddress.pointee, inData: inQualifierData)

View File

@ -23,8 +23,7 @@ class EQMPlugIn: EQMObject {
kAudioPlugInPropertyTranslateUIDToBox,
kAudioPlugInPropertyDeviceList,
kAudioPlugInPropertyTranslateUIDToDevice,
kAudioPlugInPropertyResourceBundle,
kAudioObjectPropertyCustomPropertyInfoList: return true
kAudioPlugInPropertyResourceBundle: return true
default:
return false
}
@ -58,7 +57,6 @@ class EQMPlugIn: EQMObject {
}
case kAudioPlugInPropertyTranslateUIDToDevice: return sizeof(AudioObjectID.self)
case kAudioPlugInPropertyResourceBundle: return sizeof(CFString.self)
case kAudioObjectPropertyCustomPropertyInfoList: return sizeof(AudioServerPlugInCustomPropertyInfo.self) * 0
default: return nil
}
}
@ -73,7 +71,7 @@ class EQMPlugIn: EQMObject {
return .audioClassID(kAudioPlugInClassID)
case kAudioObjectPropertyOwner:
// The plug-in doesn't have an owning object
return .audioClassID(kAudioObjectUnknown)
return .integer(kAudioObjectUnknown)
case kAudioObjectPropertyManufacturer:
// This is the human readable name of the maker of the plug-in.
return .string(kDeviceManufacturer as CFString)