From 4c7eb5a0dc4b146b36142d74def31bcf9dfb4fb2 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 9 Feb 2019 19:55:58 +0100 Subject: added basic state machine --- cmd/dolmetschctld/dolmetschctld.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'cmd/dolmetschctld/dolmetschctld.go') diff --git a/cmd/dolmetschctld/dolmetschctld.go b/cmd/dolmetschctld/dolmetschctld.go index 6cd74bb..783358d 100644 --- a/cmd/dolmetschctld/dolmetschctld.go +++ b/cmd/dolmetschctld/dolmetschctld.go @@ -25,7 +25,6 @@ package main import ( "log" "os" - "time" "spreadspace.org/dolmetschctl/pkg/mixer" ) @@ -48,15 +47,15 @@ func main() { log.Println("Error initializeing the mixer: %v", err) os.Exit(1) } - log.Printf("mixer successfully initialized!") - // TODO: implement state machine - m.UnMute(0x24) - m.SetLevel(0x24, 42) - time.Sleep(2 * time.Second) - m.Mute(0x24) - m.SetLevel(0x24, mixer.FaderLevel0db) + var sm *StateMachine + if sm, err = NewStateMachine(m); err != nil { + log.Printf("state machone successfully initialized!") + } + + sm.Start() + defer sm.Shutdown() log.Printf("exiting.") } -- cgit v1.2.3