From 9be7b52cd4f42217846a50213c07eb704c27910b Mon Sep 17 00:00:00 2001
From: Florent <florent.gluck@hesge.ch>
Date: Thu, 2 Jan 2025 21:46:10 +0100
Subject: [PATCH] server: updated qemu audio configuration to work with QEMU
 above and below version 7

---
 src/server/exec/QemuSystem.go | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/server/exec/QemuSystem.go b/src/server/exec/QemuSystem.go
index a76c4a8..92bfb1e 100644
--- a/src/server/exec/QemuSystem.go
+++ b/src/server/exec/QemuSystem.go
@@ -123,8 +123,9 @@ func NewQemuSystem(qgaSock string, cpus, ram int, nic string, usbDevs []string,
 	args = append(args, "-device", "virtio-serial", "-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0", "-chardev", "socket,path="+qgaSock+",server=on,wait=off,id=qga0")
 	// USB redirection
 	args = append(args, usb...)
-	// No sound support for now as we want to keep compatibility with recent and older qemu versions without introducing audio backends, etc.
-	// args = append(args, "-device", "intel-hda", "-device", "hda-duplex")
+
+	// Audio support
+	args = append(args, "-audiodev", "pa,id=myaudio,out.mixing-engine=off", "-device", "intel-hda", "-device", "hda-output,audiodev=myaudio")
 
 	// To share a folder with the host:
 	// - Add QEMU args: virtfs local,path=/tmp/pipo,mount_tag=sharedfs,security_model=none
-- 
GitLab