summaryrefslogtreecommitdiff
path: root/cmd/dolmetschctld/telnet.go
diff options
context:
space:
mode:
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)