chaimp
chaimp

Reputation: 17847

Module 'AudioKit' has no member named 'inputDevices'

This is my whole application so far, using AudioKit 4 and the documentation and AudioKit's website:

import SwiftUI
import AudioKit

struct ContentView: View {
    var body: some View {
        VStack(content: {
            Button("test", action: {
                if let inputs = AudioKit.inputDevices {
                    try! AudioKit.setInputDevice(inputs[0])
                }
            }).padding()
        })
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

The line AudioKit.inputDevices fails with:

Module 'AudioKit' has no member named 'inputDevices'

I searched and found that I should (apparently) be using AudioKit 5, and AudioEngine. Ok, here goes:

                if let inputs = AudioEngine.inputDevices {
                    let device: AudioKit.Device = inputs[0]
                    try! AudioEngine.setInputDevice(device)
                }

That fails with:

Module 'AudioEngine' has no member named 'setInputDevice'

Looking, there is apparently only setDevice and it is for the output device.

Why does the documentation suggest that there is a setInputDevice function?

I have tried the latest version 4, as well as version 5, both releases.

What am I missing?

Upvotes: 0

Views: 180

Answers (1)

user3086509
user3086509

Reputation: 135

Use AKManager instead of AudioKit I can't tell why they changed it but it was a few versions ago.

Upvotes: 2

Related Questions