The impact of MicrophoneMode on my Mac application.

I have a 4-input, 4-output hardware device and an 8-input, 8-output virtual device, which I combine into an aggregate device. I am using the SimplyCoreAudio library to get the channel count. The code is as follows:

aggregationDevice!.channels(scope: .input) =>> 12 aggregationDevice!.channels(scope: .output) =>> 12

When the program's MicrophoneMode is set to standard, the channel count is correct. However, when I set the MicrophoneMode to voiceIsolation, the channel count is incorrect:

aggregationDevice!.channels(scope: .input) =>> 4 aggregationDevice!.channels(scope: .output) =>> 12

Below is the code for creating the aggregate device:

func createAggregateDevice(mainDevice: AudioDevice, secondDevice: AudioDevice?, named name: String, uid: String) -> AudioDevice? { guard let mainDeviceUID = mainDevice.uid else { return nil }

    var deviceList: [[String: Any]] = [
        [
            kAudioSubDeviceUIDKey: mainDeviceUID,
            kAudioSubDeviceDriftCompensationKey:1
        ]
    ]

    // make sure same device isn't added twice
    if let secondDeviceUID = secondDevice?.uid, secondDeviceUID != mainDeviceUID {
        deviceList.append([
            kAudioSubDeviceUIDKey: secondDeviceUID,
            kAudioSubDeviceDriftCompensationKey:1,
            kAudioSubDeviceInputChannelsKey:8
        ])
    }

    let desc: [String: Any] = [
        kAudioAggregateDeviceNameKey: name,
        kAudioAggregateDeviceUIDKey: uid,
        kAudioAggregateDeviceSubDeviceListKey: deviceList,
        kAudioAggregateDeviceMainSubDeviceKey: mainDeviceUID,
        kAudioAggregateDeviceIsPrivateKey:false,
    ]

    var deviceID: AudioDeviceID = 0
    let error = AudioHardwareCreateAggregateDevice(desc as CFDictionary, &deviceID)

    guard error == noErr else {
        return nil
    }

    return AudioDevice.lookup(by: deviceID)
}

I hope someone can tell me the reason Thank you!

The impact of MicrophoneMode on my Mac application.
 
 
Q