From 3265f7c19561a68f4acae531fa3b00bcc8339454 Mon Sep 17 00:00:00 2001 From: Trek H Date: Tue, 11 Aug 2020 21:17:21 +0930 Subject: [PATCH] soundcheck: builds --- cmd/soundcheck/main.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/cmd/soundcheck/main.go b/cmd/soundcheck/main.go index 880f86e7..086b27bd 100644 --- a/cmd/soundcheck/main.go +++ b/cmd/soundcheck/main.go @@ -26,27 +26,26 @@ import ( "flag" "fmt" "log" - "os" "os/exec" + "time" ) func main() { - pTime := flag.Duration("ptime", 60, "duration to play audio") - rTime := flag.Duration("rtime", 20, "duration to record audio") - path := flag.String("path", "", "path to sound file we wish to play") + var pTime time.Duration + var rTime time.Duration + var path string + flag.DurationVar(&pTime, "ptime", 60, "duration to play audio") + flag.DurationVar(&rTime, "rtime", 20, "duration to record audio") + flag.StringVar(&path, "path", "", "path to sound file we wish to play") flag.Parse() - if _, err := os.Stat(path); os.IsNotExist(err) { - log.Fatal(err) - } - - loopCmd := exec.Command("./looper", path) - rvCmd := exec.Command("./rv") + loopCmd := exec.Command("../looper/looper", path) + rvCmd := exec.Command("../rv/rv") for { if err := loopCmd.Start(); err != nil { log.Fatal(err) } - time.sleep(pTime) + time.Sleep(pTime) if err := loopCmd.Process.Kill(); err != nil { fmt.Println("failed to kill process: ", err) } @@ -54,7 +53,7 @@ func main() { if err := rvCmd.Start(); err != nil { log.Fatal(err) } - time.sleep(rTime) + time.Sleep(rTime) if err := rvCmd.Process.Kill(); err != nil { fmt.Println("failed to kill process: ", err) }