jl303
jl303

Reputation: 1609

How To Get AudioKit Output Devices?

I'm using AudioKit v5-main, Swift 5, XCode 12.3, MacOS 10.15.7.

What's the proper way to go through available output devices on AudioKit v5-main?

When I try to get engine.outputDevices, I get "Static member 'outputDevices' cannot be used on instance of type 'AudioEngine'.

import AudioKit

class Player {

    let engine = AudioEngine()

    func setOutput() {
        if let devices = engine.outputDevices {
            // ...
        }
    }

}

Upvotes: 1

Views: 477

Answers (1)

Thomas
Thomas

Reputation: 503

import AudioKit

class Player {

    let engine = AudioEngine() // you don't need to set this if you just need the list of outputDevices

    func setOutput() {
        if let devices = AudioEngine.outputDevices { // outputDevices is static, so you call the AudioEngine type directly, not thru an instance.
            // ...
        }
    }
}

Upvotes: 1

Related Questions