feat: full WSL2 audio support and Windows audio stability fix
This commit is contained in:
@@ -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
23
cmd/tui/noise_linux.go
Normal 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
12
cmd/tui/noise_other.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user