1
1
mirror of https://github.com/bitgapp/eqMac.git synced 2024-12-12 16:24:12 +03:00
eqMac/native/app/Source/Extensions/AVAudioEngine.swift

42 lines
864 B
Swift
Raw Normal View History

2020-04-04 21:15:38 +03:00
//
// 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)
)
)
}
}