summaryrefslogtreecommitdiff
path: root/cmd/dolmetschctld/telnet.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-02-10 21:38:17 +0100
committerChristian Pointner <equinox@spreadspace.org>2019-02-10 21:38:17 +0100
commit390f67a115551cb51069155cdcc032dc841fc978 (patch)
tree4eb69829c47656359433fc6928696c1c8493b3d3 /cmd/dolmetschctld/telnet.go
parentimproved fader movement (diff)
added telnet command to set main-to-voice ratio
Diffstat (limited to 'cmd/dolmetschctld/telnet.go')
-rw-r--r--cmd/dolmetschctld/telnet.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/cmd/dolmetschctld/telnet.go b/cmd/dolmetschctld/telnet.go
index d2f7fc3..19e0a26 100644
--- a/cmd/dolmetschctld/telnet.go
+++ b/cmd/dolmetschctld/telnet.go
@@ -23,7 +23,7 @@
package main
import (
- "fmt"
+ "strconv"
"github.com/spreadspace/telgo"
)
@@ -42,7 +42,24 @@ func telnetCmdLang(c *telgo.Client, args []string, sm *StateMachine) bool {
lang = ""
}
if err := sm.SelectLanguage(Language(lang)); err != nil {
- c.Sayln(fmt.Sprintf("selecting language failed: %v", err))
+ c.Sayln("selecting language failed: %v", err)
+ }
+ return false
+}
+
+func telnetCmdRatio(c *telgo.Client, args []string, sm *StateMachine) bool {
+ if len(args) != 2 {
+ c.Sayln("usage: ratio <ratio>")
+ return false
+ }
+ r, err := strconv.ParseFloat(args[1], 32)
+ if err != nil {
+ c.Sayln("invalid ratio: %v", err)
+ return false
+ }
+
+ if err := sm.SetMain2VoiceRatio(float32(r)); err != nil {
+ c.Sayln("setting ratio failed: %v", err)
}
return false
}
@@ -60,6 +77,7 @@ func NewTelnetInterface(addr string, sm *StateMachine) (telnet *TelnetInterface,
cmdlist := make(telgo.CmdList)
cmdlist["lang"] = func(c *telgo.Client, args []string) bool { return telnetCmdLang(c, args, sm) }
+ cmdlist["ratio"] = func(c *telgo.Client, args []string) bool { return telnetCmdRatio(c, args, sm) }
cmdlist["quit"] = telnetQuit
telnet.server, err = telgo.NewServer(addr, "dolmetschctl> ", cmdlist, nil)