Skip to content

Commit

Permalink
activate all global parameters at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
nosuchtim committed Dec 17, 2023
1 parent f4ed1b1 commit cc6f7fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
20 changes: 6 additions & 14 deletions kit/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"path/filepath"
"runtime/debug"
"strconv"
"strings"
"sync"
"sync/atomic"

Expand Down Expand Up @@ -94,20 +95,11 @@ func InitEngine() {

TheEngine = e

// Now we do things that need to be done after parameters are loaded

enabled, err := GetParamBool("global.attractenabled")
LogIfError(err)
TheAttractManager.SetAttractEnabled(enabled)

// CheckAutorestartProcesses()

nats, err := GetParamBool("global.nats")
LogIfError(err)
if nats {
EngineSubscribeNats()
for name := range(ParamDefs) {
if strings.HasPrefix(name,"global.") {
ActivateGlobalParam(name)
}
}

}

func EngineSubscribeNats() {
Expand Down Expand Up @@ -561,7 +553,7 @@ func (e *Engine) advanceTransposeTo(newclick Clicks) {
e.autoTransposeIndex = (e.autoTransposeIndex + 1) % len(e.autoTransposeValues)
transpose := TheEngine.autoTransposeValues[TheEngine.autoTransposeIndex]
e.SetTranspose(transpose)
LogOfType("transpose","TransposeTo","index",e.autoTransposeIndex,"transpose",transpose,"newclick",newclick)
LogOfType("transpose", "TransposeTo", "index", e.autoTransposeIndex, "transpose", transpose, "newclick", newclick)
// TheScheduler.SendAllPendingNoteoffs()
}

Expand Down
12 changes: 10 additions & 2 deletions kit/engineapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@ func GetInt(value string, i *int64) bool {
}
}

func ActivateGlobalParam(name string) {
val, err := GetParam(name)
LogIfError(err)
err = ApplyGlobalParam(name,val)
LogIfError(err)

}

func ApplyGlobalParam(name string, value string) (err error) {

_, ok := ParamDefs[name]
Expand Down Expand Up @@ -404,8 +412,8 @@ func ApplyGlobalParam(name string, value string) (err error) {
err := ObsCommand("streamstart")
LogIfError(err)
} else {
err := ObsCommand("streamstop")
LogIfError(err)
// Ignore errors, since it may not be running at all
_ = ObsCommand("streamstop")
}
}
return nil
Expand Down
Binary file modified release/palette_7.87_win_setup.exe
Binary file not shown.

0 comments on commit cc6f7fe

Please sign in to comment.