mirror of https://bitbucket.org/ausocean/av.git
cmd/treatment: remove build tags for treatment
This was done because I don't know why this wouldn't build on circleci with the standard pi audio command in pi.go. cmd/treatment: merge pi.go into main.go There's no need for two files Approved-by: Alan Noble
This commit is contained in:
parent
2dd2c464c6
commit
9f56bee095
|
@ -1,34 +0,0 @@
|
|||
// +build !pi3
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
circleci.go defines a dummy initialisation command for running on circleci.
|
||||
|
||||
AUTHORS
|
||||
Ella Pietraroia <ella@ausocean.org>
|
||||
Scott Barnard <scott@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 main
|
||||
|
||||
import "bitbucket.org/ausocean/utils/logging"
|
||||
|
||||
const audioCmd = ""
|
||||
|
||||
func initCommand(log logging.Logger) {}
|
|
@ -81,17 +81,21 @@ const (
|
|||
// Channel modes.
|
||||
const (
|
||||
modeStereo = "Stereo"
|
||||
modeLeft = "LeftMono"
|
||||
modeRight = "RightMono"
|
||||
modeMute = "Mute"
|
||||
modeLeft = "LeftMono"
|
||||
modeRight = "RightMono"
|
||||
modeMute = "Mute"
|
||||
)
|
||||
|
||||
// Variable map to send to netreceiver/vidgrind.
|
||||
var varMap = map[string]string{
|
||||
"SpeakerMode": "enum:"+strings.Join([]string{modeStereo, modeLeft, modeRight, modeMute}, ","),
|
||||
"AudioFilePath": "string",
|
||||
"SpeakerMode": "enum:" + strings.Join([]string{modeStereo, modeLeft, modeRight, modeMute}, ","),
|
||||
"AudioFilePath": "string",
|
||||
}
|
||||
|
||||
const audioCmd = "aplay"
|
||||
|
||||
func initCommand(l logging.Logger) { checkPath(audioCmd, l) }
|
||||
|
||||
func main() {
|
||||
mts.Meta = meta.NewWith([][2]string{{metaPreambleKey, metaPreambleData}})
|
||||
|
||||
|
@ -214,15 +218,15 @@ func run(rv *revid.Revid, ns *netsender.Sender, file *string, l logging.Logger,
|
|||
|
||||
// setChannels handles the muting of one, both, or neither of the channels. It takes in SpeakerMode
|
||||
// and sets the relevant volumes.
|
||||
func setChannels(mode string, l logging.Logger) error {
|
||||
func setChannels(mode string, l logging.Logger) error {
|
||||
l.Info("mode is", "mode", mode)
|
||||
|
||||
// Set the volume of each channel.
|
||||
vols := map[string]string{
|
||||
modeStereo: "100%,100%",
|
||||
modeLeft: "0%,100%",
|
||||
modeRight: "100%,0%",
|
||||
modeMute: "0%,0%",
|
||||
modeLeft: "0%,100%",
|
||||
modeRight: "100%,0%",
|
||||
modeMute: "0%,0%",
|
||||
}[mode]
|
||||
if vols == "" {
|
||||
l.Warning("invalid SpeakeMode", "SpeakerMode", mode)
|
||||
|
@ -231,7 +235,7 @@ func setChannels(mode string, l logging.Logger) error {
|
|||
|
||||
// Create the command to change the channel volumes.
|
||||
cmd := exec.Command("amixer", "sset", "Speaker", vols)
|
||||
|
||||
|
||||
// Pipe the output to stdout and stderr.
|
||||
outPipe, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
|
@ -274,7 +278,6 @@ func setChannels(mode string, l logging.Logger) error {
|
|||
return fmt.Errorf("channel set command failed: %s", &errBuff)
|
||||
}
|
||||
|
||||
|
||||
l.Info("mode set to", "mode", mode)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
// +build pi3
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
pi3.go defines an initialisation function for use when running on the
|
||||
Raspberry Pi 3.
|
||||
|
||||
AUTHORS
|
||||
Ella Pietraroia <ella@ausocean.org>
|
||||
Scott Barnard <scott@ausocean.org>
|
||||
Saxon Nelson-Milton <saxon@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 main
|
||||
|
||||
import (
|
||||
"bitbucket.org/ausocean/utils/logging"
|
||||
)
|
||||
|
||||
const audioCmd = "aplay"
|
||||
|
||||
func initCommand(l logging.Logger) { checkPath(audioCmd, l) }
|
Loading…
Reference in New Issue