summaryrefslogtreecommitdiff
path: root/cmd/dolmetschctld/dolmetschctld.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/dolmetschctld/dolmetschctld.go')
-rw-r--r--cmd/dolmetschctld/dolmetschctld.go39
1 files changed, 35 insertions, 4 deletions
diff --git a/cmd/dolmetschctld/dolmetschctld.go b/cmd/dolmetschctld/dolmetschctld.go
index 4c31dbf..cc75319 100644
--- a/cmd/dolmetschctld/dolmetschctld.go
+++ b/cmd/dolmetschctld/dolmetschctld.go
@@ -40,6 +40,9 @@ func addLanguage(sm *StateMachine, name Language, original, interpreter mixer.Ch
func main() {
log.Println("hello world.")
+ // *************************************
+ // * initialize core
+
m, err := mixer.NewMixer(mixer.Config{DevIn: "ESI MIDIMATE eX MIDI 2", DevOut: "ESI MIDIMATE eX MIDI 1"})
if err != nil {
log.Printf("Error opening the mixer: %v", err)
@@ -71,16 +74,44 @@ func main() {
sm.Start()
defer sm.Shutdown()
+ // *************************************
+ // * initialize control interfaces
+
var telnet *TelnetInterface
if telnet, err = NewTelnetInterface("127.0.0.1:1234", sm); err != nil {
- log.Printf("creating telnet control interface failed: %v", err)
+ log.Printf("creating telnet interface failed: %v", err)
os.Exit(1)
}
log.Printf("telnet interface successfully initialized!")
- if err = telnet.Run(); err != nil {
- log.Printf("running telnet interface failed: %v", err)
+ var web *WebInterface
+ if web, err = NewWebInterface("127.0.0.1:8234", sm); err != nil {
+ log.Printf("creating web interface failed: %v", err)
+ os.Exit(1)
}
+ log.Printf("web interface successfully initialized!")
+
+ // *************************************
+ // * run control interfaces
+
+ stop := make(chan bool)
+
+ go func() {
+ log.Printf("starting telnet interface")
+ if err = telnet.Run(); err != nil {
+ log.Printf("running telnet interface failed: %v", err)
+ }
+ stop <- true
+ }()
+
+ go func() {
+ log.Printf("starting web interface")
+ if err = web.Run(); err != nil {
+ log.Printf("running web interface failed: %v", err)
+ }
+ stop <- true
+ }()
- log.Printf("exiting.")
+ <-stop
+ log.Printf("at least one control interface has stopped - bringing down the whole process")
}