1
1
mirror of https://github.com/bitgapp/eqMac.git synced 2024-12-12 06:43:07 +03:00
eqMac/native/app/Source/Extensions/AVAudioEngine.swift
2020-04-04 19:15:38 +01:00

42 lines
864 B
Swift

//
// AVAudioEngine.swift
// eqMac
//
// Created by Romans Kisils on 29/12/2019.
// Copyright © 2019 Romans Kisils. All rights reserved.
//
import Foundation
import AVFoundation
import AMCoreAudio
extension AVAudioEngine {
func setInputDevice (_ device: AudioDevice) {
var id = device.id
checkErr(
AudioUnitSetProperty(
inputNode.audioUnit!,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Input,
0,
&id,
UInt32(MemoryLayout<AudioDeviceID>.size)
)
)
}
func setOutputDevice (_ device: AudioDevice) {
var id = device.id
checkErr(
AudioUnitSetProperty(
outputNode.audioUnit!,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Output,
0,
&id,
UInt32(MemoryLayout<AudioDeviceID>.size)
)
)
}
}