     /// The name of the current output device, if available.
     @objc public static var outputDevice: AKDevice? {
         #if os(macOS)
-            if let dev = EZAudioDevice.currentOutput() {
-                return AKDevice(name: dev.name, deviceID: dev.deviceID)
-            }
-        #else
-            let devs = AVAudioSession.sharedInstance().currentRoute.outputs
-            if devs.isNotEmpty {
-                return AKDevice(name: devs[0].portName, deviceID: devs[0].uid)
-            }
+        if let dev = EZAudioDevice.currentOutput() {
+            return AKDevice(name: dev.name, deviceID: dev.deviceID)
+        }
+        #else
+        let devs = AVAudioSession.sharedInstance().currentRoute.outputs
+        if devs.isNotEmpty {
+            return AKDevice(name: devs[0].portName, deviceID: devs[0].uid)
+        }
 
         #endif
         return nil

    /// Change the preferred input device, giving it one of the names from the list of available inputs.
    @objc public static func setInputDevice(_ input: AKDevice) throws {
        #if os(macOS)
            try AKTry {
                var address = AudioObjectPropertyAddress(
                    mSelector: kAudioHardwarePropertyDefaultInputDevice,
                    mScope: kAudioObjectPropertyScopeGlobal,
                    mElement: kAudioObjectPropertyElementMaster)
                var devid = input.deviceID
                AudioObjectSetPropertyData(
                    AudioObjectID(kAudioObjectSystemObject),
                    &address, 0, nil, UInt32(MemoryLayout<AudioDeviceID>.size), &devid)
            }
        #else
            // Set the port description first eg iPhone Microphone / Headset Microphone etc
            guard let portDescription = input.portDescription else {
                throw AKError.DeviceNotFound
            }
            try AVAudioSession.sharedInstance().setPreferredInput(portDescription)

            // Set the data source (if any) eg. Back/Bottom/Front microphone
            guard let dataSourceDescription = input.dataSource else {
                return
            }
            try AVAudioSession.sharedInstance().setInputDataSource(dataSourceDescription)
        #endif
    }

    /// Change the preferred output device, giving it one of the names from the list of available output.
    @objc public static func setOutputDevice(_ output: AKDevice) throws {
        #if os(macOS)
            try AKTry {
                var id = output.deviceID
                if let audioUnit = AudioKit.engine.outputNode.audioUnit {
                    AudioUnitSetProperty(audioUnit,
                                         kAudioOutputUnitProperty_CurrentDevice,
                                         kAudioUnitScope_Global, 0,
                                         &id,
                                         UInt32(MemoryLayout<DeviceID>.size))
                }
            }
        #else
            // not available on ios
        #endif
    }


/// Top level AudioKit managing class
open class AudioKit: NSObject {
    #if !os(macOS)
    static let deviceSampleRate = AVAudioSession.sharedInstance().sampleRate
    #else
    static let deviceSampleRate: Double = 44_100
    #endif

    // MARK: - Internal audio engine mechanics
