soundcheck: builds

This commit is contained in:
Trek H 2020-08-11 21:17:21 +09:30
parent 73e1007edd
commit 3265f7c195
1 changed files with 11 additions and 12 deletions

View File

@ -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)
}