treatment: restart audio when path changed

This commit is contained in:
Trek H 2021-02-11 13:25:04 +10:30
parent 8b4e28a944
commit e3f8af1e78
1 changed files with 8 additions and 7 deletions

View File

@ -184,13 +184,6 @@ func run(rv *revid.Revid, ns *netsender.Sender, file *string, l *logger.Logger,
}
l.Log(logger.Info, "revid successfully reconfigured")
l.Log(logger.Debug, "checking audio file path")
f := vars["audioFilePath"]
if f != "" && *file != f {
file = &f
l.Log(logger.Info, "updated audio file path", "audioFilePath", f)
}
l.Log(logger.Debug, "checking mode")
switch ns.Mode() {
case modePaused:
@ -198,6 +191,14 @@ func run(rv *revid.Revid, ns *netsender.Sender, file *string, l *logger.Logger,
l.Log(logger.Info, "mode is Paused, stopping revid")
rv.Stop()
case modeTreatment:
l.Log(logger.Debug, "checking audio file path")
f := vars["audioFilePath"]
if f != "" && *file != f {
file = &f
l.Log(logger.Info, "updated audio file path", "audioFilePath", f)
l.Log(logger.Info, "stopping audio")
stopAudio(&wg, &treating, audioQuit)
}
if !treating {
l.Log(logger.Info, "starting audio treatment")
rv.Stop()