Initial noise suppression added.

This commit is contained in:
Storm Dragon
2025-08-16 21:29:52 -04:00
parent 657ff1dbef
commit df7159bad1
9 changed files with 236 additions and 0 deletions

View File

@@ -26,6 +26,8 @@ type exportableConfig struct {
DefaultServer *string
Username *string
NotifyCommand *string
NoiseSuppressionEnabled *bool
NoiseSuppressionThreshold *float32
}
type server struct {
@@ -75,6 +77,7 @@ func (c *Config) LoadConfig() {
SwitchViews: key(uiterm.KeyTab),
ScrollUp: key(uiterm.KeyPgup),
ScrollDown: key(uiterm.KeyPgdn),
NoiseSuppressionToggle: key(uiterm.KeyF9),
}
if fileExists(c.fn) {
var data []byte
@@ -112,6 +115,14 @@ func (c *Config) LoadConfig() {
ncmd := string("")
jc.NotifyCommand = &ncmd
}
if c.config.NoiseSuppressionEnabled == nil {
enabled := false
jc.NoiseSuppressionEnabled = &enabled
}
if c.config.NoiseSuppressionThreshold == nil {
threshold := float32(0.02)
jc.NoiseSuppressionThreshold = &threshold
}
}
func (c *Config) findServer(address string) *server {
@@ -197,6 +208,30 @@ func (c *Config) GetUsername() *string {
return c.config.Username
}
func (c *Config) GetNoiseSuppressionEnabled() bool {
if c.config.NoiseSuppressionEnabled == nil {
return false
}
return *c.config.NoiseSuppressionEnabled
}
func (c *Config) SetNoiseSuppressionEnabled(enabled bool) {
c.config.NoiseSuppressionEnabled = &enabled
c.SaveConfig()
}
func (c *Config) GetNoiseSuppressionThreshold() float32 {
if c.config.NoiseSuppressionThreshold == nil {
return 0.02
}
return *c.config.NoiseSuppressionThreshold
}
func (c *Config) SetNoiseSuppressionThreshold(threshold float32) {
c.config.NoiseSuppressionThreshold = &threshold
c.SaveConfig()
}
func (c *Config) UpdateUser(u *gumble.User) {
var j *eUser
var uc *gumble.Client