Configuring audio in apple virtualization framework

I have a virtual machine using apple's sample code on their developer page but i have no audio. How do i create and setup an audio device for the vm?

You need to add a VZVirtioSoundDeviceConfiguration to your configuration with streams for input and output. Something like this:

let inputStream = VZVirtioSoundDeviceInputStreamConfiguration()
inputStream.source = VZHostAudioInputStreamSource()

let outputStream = VZVirtioSoundDeviceOutputStreamConfiguration()
outputStream.sink = VZHostAudioOutputStreamSink()

let soundDeviceConfiguration = VZVirtioSoundDeviceConfiguration()
soundDeviceConfiguration.streams = [inputStream, outputStream]

configuration.audioDevices = [soundDeviceConfiguration]
Configuring audio in apple virtualization framework
 
 
Q