feat: full WSL2 audio support and Windows audio stability fix

This commit is contained in:
Jose Luis Montañes Ojados
2026-01-17 01:38:13 +01:00
parent c1bb24473e
commit c81f64d9ca
12 changed files with 492 additions and 75 deletions

View File

@@ -56,6 +56,9 @@ func main() {
}
}
// Silence noise (ALSA/PortAudio) on Linux or if debugFile is set
redirectStderr(debugFile)
// Create the TUI model
m := NewModel(*serverAddr, *nickname)

23
cmd/tui/noise_linux.go Normal file
View File

@@ -0,0 +1,23 @@
//go:build linux
package main
import (
"os"
"syscall"
)
func redirectStderr(f *os.File) {
if f == nil {
// Silence altogether if no debug file
null, err := os.OpenFile(os.DevNull, os.O_WRONLY, 0)
if err == nil {
syscall.Dup2(int(null.Fd()), int(os.Stderr.Fd()))
}
return
}
// Redirect fd 2 (stderr) to our debug file
// This captures C-level library noise (ALSA, PortAudio) into the log
syscall.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
}

12
cmd/tui/noise_other.go Normal file
View File

@@ -0,0 +1,12 @@
//go:build !linux
package main
import (
"os"
)
func redirectStderr(f *os.File) {
// No-op on other platforms for now
// Windows doesn't have the ALSA noise problem
}