Updated barnard to use openal for sound by default. This should bring with it pipewire or pulseaudio support.
This commit is contained in:
12
README.md
12
README.md
@@ -141,6 +141,18 @@ Pass the -list_devices parameter to barnard to be given a list of audio input an
|
||||
Copy lines from the above list into inputdevice and outputdevice as desired.
|
||||
To clear your inputdevice or outputdevice options and set them to defaults, set them to "" or delete them entirely.
|
||||
|
||||
### Audio Backends (ALSA, PipeWire, PulseAudio)
|
||||
|
||||
Barnard uses OpenAL Soft for audio. By default it will pick the first available backend (often ALSA), but you can force a specific driver:
|
||||
|
||||
- Command line: `./barnard --audio-driver pipewire` (or `pulse`, `alsa`, `jack`)
|
||||
- Config file: add `audiodriver = "pipewire"` to your `~/.barnard.toml`
|
||||
- Environment: `ALSOFT_DRIVERS=pipewire ./barnard` (takes precedence over config)
|
||||
|
||||
If PipeWire or PulseAudio support is missing, install OpenAL Soft with the corresponding backend enabled (e.g., `libopenal1` or `openal-soft` packages built with PipeWire). After changing drivers, rerun with `--list_devices` to confirm the desired devices appear.
|
||||
|
||||
Leaving `audiodriver` empty in the config keeps the OpenAL default ordering (PipeWire/Pulse first if available, then ALSA).
|
||||
|
||||
## Keystrokes
|
||||
|
||||
You can see the below keystrokes in your config file.
|
||||
|
||||
@@ -2,9 +2,9 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.stormux.org/storm/barnard/gumble/gumble"
|
||||
"git.stormux.org/storm/barnard/uiterm"
|
||||
"github.com/pelletier/go-toml/v2"
|
||||
"git.stormux.org/storm/barnard/gumble/gumble"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
@@ -19,6 +19,7 @@ type Config struct {
|
||||
|
||||
type exportableConfig struct {
|
||||
Hotkeys *Hotkeys
|
||||
AudioDriver *string
|
||||
MicVolume *float32
|
||||
InputDevice *string
|
||||
OutputDevice *string
|
||||
@@ -98,6 +99,10 @@ func (c *Config) LoadConfig() {
|
||||
micvol := float32(1.0)
|
||||
jc.MicVolume = &micvol
|
||||
}
|
||||
if c.config.AudioDriver == nil {
|
||||
driver := string("")
|
||||
jc.AudioDriver = &driver
|
||||
}
|
||||
if c.config.InputDevice == nil {
|
||||
idev := string("")
|
||||
jc.InputDevice = &idev
|
||||
@@ -203,6 +208,13 @@ func (c *Config) GetNotifyCommand() *string {
|
||||
return c.config.NotifyCommand
|
||||
}
|
||||
|
||||
func (c *Config) GetAudioDriver() string {
|
||||
if c.config.AudioDriver == nil {
|
||||
return ""
|
||||
}
|
||||
return *c.config.AudioDriver
|
||||
}
|
||||
|
||||
func (c *Config) GetInputDevice() *string {
|
||||
return c.config.InputDevice
|
||||
}
|
||||
|
||||
18
main.go
18
main.go
@@ -15,15 +15,15 @@ import (
|
||||
//"github.com/google/shlex"
|
||||
"crypto/tls"
|
||||
"flag"
|
||||
"github.com/alessio/shellescape"
|
||||
"git.stormux.org/storm/barnard/audio"
|
||||
"git.stormux.org/storm/barnard/config"
|
||||
"git.stormux.org/storm/barnard/noise"
|
||||
"github.com/alessio/shellescape"
|
||||
|
||||
"git.stormux.org/storm/barnard/gumble/go-openal/openal"
|
||||
"git.stormux.org/storm/barnard/gumble/gumble"
|
||||
_ "git.stormux.org/storm/barnard/gumble/opus"
|
||||
"git.stormux.org/storm/barnard/uiterm"
|
||||
"git.stormux.org/storm/barnard/gumble/go-openal/openal"
|
||||
)
|
||||
|
||||
func show_devs(name string, args []string) {
|
||||
@@ -109,6 +109,7 @@ func main() {
|
||||
insecure := flag.Bool("insecure", false, "skip server certificate verification")
|
||||
certificate := flag.String("certificate", "", "PEM encoded certificate and private key")
|
||||
cfgfn := flag.String("config", "~/.barnard.toml", "Path to TOML formatted configuration file")
|
||||
audioDriver := flag.String("audio-driver", "", "preferred OpenAL backend (pipewire, pulse, alsa, jack)")
|
||||
list_devices := flag.Bool("list_devices", false, "do not connect; instead, list available audio devices and exit")
|
||||
fifo := flag.String("fifo", "", "path of a FIFO from which to read commands")
|
||||
serverSet := false
|
||||
@@ -149,6 +150,19 @@ func main() {
|
||||
certificate = userConfig.GetCertificate()
|
||||
}
|
||||
|
||||
driver := strings.TrimSpace(*audioDriver)
|
||||
if driver == "" {
|
||||
// Environment variable takes precedence over config
|
||||
if envDriver := os.Getenv("ALSOFT_DRIVERS"); envDriver != "" {
|
||||
driver = envDriver
|
||||
} else {
|
||||
driver = strings.TrimSpace(userConfig.GetAudioDriver())
|
||||
}
|
||||
}
|
||||
if driver != "" {
|
||||
os.Setenv("ALSOFT_DRIVERS", driver)
|
||||
}
|
||||
|
||||
if os.Getenv("ALSOFT_LOGLEVEL") == "" {
|
||||
os.Setenv("ALSOFT_LOGLEVEL", "0")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user