mirror of https://bitbucket.org/ausocean/av.git
cmd/audio-player/looper: use a command line flag for choosing audio file path
This commit is contained in:
parent
8cbc7e700c
commit
c5fb58e70c
|
@ -28,6 +28,7 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"flag"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -38,8 +39,9 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
// Constants.
|
||||
const soundFile = "/home/pi/48khz.wav"
|
||||
// Command line flags.
|
||||
var soundFilePtr = flag.String("path", "", "Location of sound file")
|
||||
flag.Parse()
|
||||
|
||||
// Logging constants.
|
||||
const (
|
||||
|
@ -71,7 +73,7 @@ func main() {
|
|||
numPlays++
|
||||
log.Log(logger.Debug, "playing audio", "play number", numPlays)
|
||||
|
||||
cmd := exec.Command(audioCmd, soundFile)
|
||||
cmd := exec.Command(audioCmd, *soundFilePtr)
|
||||
|
||||
var stdoutBuf, stderrBuf bytes.Buffer
|
||||
stdoutIn, _ := cmd.StdoutPipe()
|
||||
|
|
Loading…
Reference in New Issue