/* AUTHORS Trek Hopton LICENSE Copyright (C) 2020 the Australian Ocean Lab (AusOcean) It is free software: you can redistribute it and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License in gpl.txt. If not, see http://www.gnu.org/licenses. */ // Package soundcheck is a program for switching a transducer from playing to recording audio. package main import ( "flag" "fmt" "log" "os/exec" "time" ) func main() { 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() loopCmd := exec.Command("../looper/looper", path) rvCmd := exec.Command("../rv/rv") for { if err := loopCmd.Start(); err != nil { log.Fatal(err) } time.Sleep(pTime) if err := loopCmd.Process.Kill(); err != nil { fmt.Println("failed to kill process: ", err) } if err := rvCmd.Start(); err != nil { log.Fatal(err) } time.Sleep(rTime) if err := rvCmd.Process.Kill(); err != nil { fmt.Println("failed to kill process: ", err) } } }