mirror of https://bitbucket.org/ausocean/av.git
soundcheck: add basic structure of sound check procedure
This commit is contained in:
parent
7fb61edb0d
commit
73e1007edd
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
AUTHORS
|
||||
Trek Hopton <trek@ausocean.org>
|
||||
|
||||
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"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
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")
|
||||
flag.Parse()
|
||||
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
loopCmd := exec.Command("./looper", path)
|
||||
rvCmd := exec.Command("./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)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue