Skip to content

Commit

Permalink
quadpro -> quad
Browse files Browse the repository at this point in the history
  • Loading branch information
nosuchtim committed Dec 29, 2023
1 parent 9adb05d commit 2a61b0d
Show file tree
Hide file tree
Showing 24 changed files with 246 additions and 186 deletions.
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@
"cwd": "${fileDirname}",
"args": []
},
{
"name": "GUI (FYNE) palette_gui.go",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${env:PALETTE_SOURCE}/cmd/palette_gui/palette_gui.go",
"env": {
"Path": "${env:Path};${workspaceFolder};c:/Users/me/Documents/github/vizicist/palette/SenselLib/x64;" },
"args": []
},
{
"name": "FYNE DEMO",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${env:PALETTE_SOURCE}/cmd/fyne_demo/fyne_demo.go",
"env": {
"Path": "${env:Path};${workspaceFolder};c:/Users/me/Documents/github/vizicist/palette/SenselLib/x64;" },
"args": []
},
{
"name": "ENGINE - palette_engine.go",
"type": "go",
Expand Down
73 changes: 34 additions & 39 deletions cmd/palette/palette.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ func CliCommand(args []string) (map[string]string, error) {
case "test":
switch arg1 {
case "":
return kit.EngineRemoteApi("quadpro.test", "ntimes", "40")
return kit.EngineRemoteApi("quad.test", "ntimes", "40")
case "long":
return kit.EngineRemoteApi("quadpro.test", "ntimes", "400")
return kit.EngineRemoteApi("quad.test", "ntimes", "400")
case "center":
return kit.EngineRemoteApi("quadpro.test", "ntimes", "1000", "testtype","center")
return kit.EngineRemoteApi("quad.test", "ntimes", "1000", "testtype", "center")
default:
return nil, fmt.Errorf("unknown test type - %s", arg1)
}
Expand Down Expand Up @@ -223,63 +223,57 @@ func CliCommand(args []string) (map[string]string, error) {
func StatusOutput() (statusOut string, numRunning int) {
s := ""
nrunning := 0
if kit.MonitorIsRunning() {
running, err := kit.MonitorIsRunning()
if err == nil && running {
s += "Monitor is running.\n"
nrunning++
}

if kit.IsRunning("engine") {
s += "Engine is running.\n"
nrunning++
}

if kit.IsRunning("gui") {
s += "GUI is running.\n"
nrunning++
}

if kit.IsRunning("bidule") {
s += "Bidule is running.\n"
nrunning++
}

if kit.IsRunning("obs") {
s += "OBS is running.\n"
nrunning++
type Runnable struct {
processName string
userName string
}

if kit.IsRunning("chat") {
s += "Chat monitor is running.\n"
nrunning++
var Runnables = []Runnable{
{"engine", "Engine"},
{"gui", "GUI"},
{"bidule", "Bidule"},
{"obs", "OBS"},
{"chat", "Chat monitor"},
{"resolume", "Resolume"},
}

if kit.IsRunning("resolume") {
s += "Resolume is running.\n"
nrunning++
for _, r := range Runnables {
running, err = kit.IsRunning(r.processName)
if err == nil && running {
s += (r.userName + " is running.\n")
nrunning++
}
}

/*
b, _ := kit.GetParamBool("global.keykitrun")
if b {
if kit.IsRunning("keykit") {
s += "Keykit is running.\n"
nrunning++
b, _ := kit.GetParamBool("global.keykitrun")
if b {
if kit.IsRunning("keykit") {
s += "Keykit is running.\n"
nrunning++
}
}
}
*/

mmtt := os.Getenv("PALETTE_MMTT")
if mmtt != "" {
if kit.IsRunning("mmtt") {
running, err := kit.IsRunning("mmtt")
if err == nil && running {
s += "MMTT is running.\n"
nrunning++
}
}

return s, nrunning
}

func doStartEngine() error {
if kit.IsRunning("engine") {
running, err := kit.IsRunning("engine")
if err == nil && running {
return fmt.Errorf("engine is already running")
}
fullexe := filepath.Join(kit.PaletteDir(), "bin", kit.EngineExe)
Expand All @@ -288,7 +282,8 @@ func doStartEngine() error {
}

func doStartMonitor() error {
if kit.MonitorIsRunning() {
running, err := kit.MonitorIsRunning()
if err == nil && running {
return fmt.Errorf("monitor is already running")
}
// palette_monitor.exe will restart the engine,
Expand Down
2 changes: 1 addition & 1 deletion cmd/palette_chat/palette_chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func StartTwitch() error {
category = words[1]
}
kit.LogInfo("randomize message", "category", category)
vals, err := kit.EngineRemoteApi("quadpro.loadrand", "category", category)
vals, err := kit.EngineRemoteApi("quad.loadrand", "category", category)
var reply string
if err != nil {
reply = fmt.Sprintf("err=%s", err.Error())
Expand Down
Binary file added cmd/palette_gui/palette_gui.exe
Binary file not shown.
32 changes: 32 additions & 0 deletions cmd/palette_gui/palette_gui.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package main

import (
"fyne.io/fyne/v2" // Import the base Fyne package
"fyne.io/fyne/v2/app" // Import the Fyne app package
"fyne.io/fyne/v2/container" // Import the Fyne container package for layouts
"fyne.io/fyne/v2/widget" // Import the Fyne widget package for widgets
)

func main() {
myApp := app.New() // Create a new app
myWindow := myApp.NewWindow("Hello") // Create a new window

myWindow.Resize(fyne.NewSize(300, 200)) // Resize the window

// Create a label (widget) with initial text
label := widget.NewLabel("Hello, Fyne!")

// Create a button (widget)
button := widget.NewButton("Click me!", func() {
label.SetText("Button clicked!") // Change the label text when the button is clicked
})

// Use a container to arrange the label and button vertically
content := container.NewVBox(
label,
button,
)

myWindow.SetContent(content) // Set the window content to be the container
myWindow.ShowAndRun() // Show and run the application
}
3 changes: 2 additions & 1 deletion cmd/palette_monitor/palette_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ func scheduler() {
func checkEngine() {
tick := time.NewTicker(time.Second * 15)
for {
if !kit.IsRunningExecutable(kit.EngineExe) {
running, err := kit.IsRunningExecutable(kit.EngineExe)
if err == nil && !running {
kit.LogInfo("checkEngine: engine is not running, killing everything, monitor should restart engine.")
kit.KillAllExceptMonitor()
kit.LogInfo("checkEngine: restarting engine")
Expand Down
2 changes: 1 addition & 1 deletion data/config/paramenums.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resolumepath": ["C:/Program Files/Resolume Avenue/Avenue.exe", "C:/Program Files/Resolume Arena/Arena.exe"],
"plugins": [ "", "quadpro" ],
"plugins": [ "", "quad" ],
"log": ["","cursor","midi","cursor,midi","cursor,midi,osc","osc","api","loop", "morph","mmtt", "quant", "transpose", "ffgl", "gesture"],
"pitchset": ["","stylusrmx"],
"guisize": ["small","medium","palette"],
Expand Down
2 changes: 1 addition & 1 deletion ffgl/source/lib/palette/LayerParams_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ LayerParams_InitializeTypes() {
LayerParams_resolumepathTypes.push_back("C:/Program Files/Resolume Arena/Arena.exe");

LayerParams_pluginsTypes.push_back("");
LayerParams_pluginsTypes.push_back("quadpro");
LayerParams_pluginsTypes.push_back("quad");

LayerParams_logTypes.push_back("");
LayerParams_logTypes.push_back("cursor");
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/vizicist/palette
go 1.19

require (
fyne.io/fyne/v2 v2.4.2
fyne.io/fyne/v2 v2.4.3
github.com/0xcafed00d/joystick v1.0.1
github.com/andreykaipov/goobs v0.12.1
github.com/gempir/go-twitch-irc/v3 v3.3.0
Expand Down Expand Up @@ -57,7 +57,7 @@ require (
golang.org/x/exp/shiny v0.0.0-20230210204819-062eb4c674ab // indirect
golang.org/x/mobile v0.0.0-20230531173138-3c911d8e3eda // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
fyne.io/fyne/v2 v2.4.2 h1:bt6/p/FTpcv0sZIN6msxto32JvKkgwKe/LzYxqv//B8=
fyne.io/fyne/v2 v2.4.2/go.mod h1:1h3BKxmQYRJlr2g+RGVxedzr6vLVQ/AJmFWcF9CJnoQ=
fyne.io/fyne/v2 v2.4.3 h1:v2wncjEAcwXZ8UNmTCWTGL9+sGyPc5RuzBvM96GcC78=
fyne.io/fyne/v2 v2.4.3/go.mod h1:1h3BKxmQYRJlr2g+RGVxedzr6vLVQ/AJmFWcF9CJnoQ=
fyne.io/systray v1.10.1-0.20231115130155-104f5ef7839e h1:Hvs+kW2VwCzNToF3FmnIAzmivNgrclwPgoUdVSrjkP8=
fyne.io/systray v1.10.1-0.20231115130155-104f5ef7839e/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE=
github.com/0xcafed00d/joystick v1.0.1 h1:r4p2cRp4MHJWu1gArhGtumbkPxmr3tcOUTFqybEhplM=
Expand Down Expand Up @@ -454,8 +454,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down
8 changes: 4 additions & 4 deletions kit/attract.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (am *AttractManager) setAttractMode(onoff bool) {
// am.attractMutex.Lock()
am.attractModeIsOn.Store(onoff)

if TheQuadPro != nil {
if TheQuad != nil {
for _, patch := range Patchs {
patch.clearGraphics()
patch.loopClear()
Expand Down Expand Up @@ -161,10 +161,10 @@ func (am *AttractManager) doAttractAction() {

dp := now.Sub(am.lastAttractChange).Seconds()
if dp > am.attractChangeInterval {
if TheQuadPro == nil {
LogWarn("No QuadPro to change for attract mode")
if TheQuad == nil {
LogWarn("No Quad to change for attract mode")
} else {
_, err := TheQuadPro.loadQuadRand("quad")
_, err := TheQuad.loadQuadRand("quad")
LogIfError(err)
}
am.lastAttractChange = now
Expand Down
2 changes: 1 addition & 1 deletion kit/cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func NewCursorClearEvent() CursorEvent {
// An ActiveCursor can be for a Button or a Patch area.
func NewActiveCursor(ce CursorEvent) *ActiveCursor {

patch, button := TheQuadPro.PatchForCursorEvent(ce)
patch, button := TheQuad.PatchForCursorEvent(ce)
if patch == nil && button == "" {
LogWarn("No Patch or Button for CursorEvent", "ce", ce)
return nil
Expand Down
10 changes: 5 additions & 5 deletions kit/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func InitEngine() {
TheRouter = NewRouter()
TheScheduler = NewScheduler()
TheAttractManager = NewAttractManager()
TheQuadPro = NewQuadPro()
TheQuad = NewQuad()
TheMidiIO = NewMidiIO()
TheErae = NewErae()

Expand All @@ -97,8 +97,8 @@ func InitEngine() {

EngineSubscribeNats()

for name := range(ParamDefs) {
if strings.HasPrefix(name,"global.") {
for name := range ParamDefs {
if strings.HasPrefix(name, "global.") {
ActivateGlobalParam(name)
}
}
Expand All @@ -108,7 +108,7 @@ func EngineSubscribeNats() {
err := TheNats.Connect()
LogIfError(err)
if err == nil {
subscribeTo := fmt.Sprintf("to_palette.%s.>",Hostname())
subscribeTo := fmt.Sprintf("to_palette.%s.>", Hostname())
err = TheNats.Subscribe(subscribeTo, natsRequestHandler)
LogIfError(err)
}
Expand Down Expand Up @@ -199,7 +199,7 @@ func (e *Engine) Start() {
InitMidiIO()
InitSynths()

TheQuadPro.Start()
TheQuad.Start()

go e.StartOscListener(OscPort)
go e.StartHttp(EngineHttpPort)
Expand Down
16 changes: 8 additions & 8 deletions kit/engineapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ func ExecuteApi(api string, apiargs map[string]string) (result string, err error
return ExecuteGlobalApi(apisuffix, apiargs)
case "saved":
return ExecuteSavedApi(apisuffix, apiargs)
case "quadpro":
if TheQuadPro != nil {
return TheQuadPro.Api(apisuffix, apiargs)
case "quad":
if TheQuad != nil {
return TheQuad.Api(apisuffix, apiargs)
}
return "", fmt.Errorf("no quadpro")
return "", fmt.Errorf("no quad")
case "patch":
patchName := ExtractAndRemoveValueOf("patch", apiargs)
if patchName == "" {
Expand Down Expand Up @@ -91,7 +91,7 @@ func ExecuteGlobalApi(api string, apiargs map[string]string) (result string, err
case "status":
uptime := fmt.Sprintf("%f", Uptime())
attractmode := fmt.Sprintf("%v", TheAttractManager.AttractModeIsOn())
if TheQuadPro == nil {
if TheQuad == nil {
result = JsonObject(
"uptime", uptime,
"attractmode", attractmode,
Expand Down Expand Up @@ -360,13 +360,13 @@ func ApplyGlobalParam(name string, value string) (err error) {
}

case "global.looping_override":
LogOfType("loop","global.looping_override needs handling")
LogOfType("loop", "global.looping_override needs handling")

case "global.looping_fade":
LogOfType("loop","global.looping_fade needs handling")
LogOfType("loop", "global.looping_fade needs handling")

case "global.looping_beats":
LogOfType("loop","global.looping_beats needs handling")
LogOfType("loop", "global.looping_beats needs handling")

case "global.midithru":
TheRouter.midithru = IsTrueValue(value)
Expand Down
6 changes: 3 additions & 3 deletions kit/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func SummarizeLog(fname string) error {
startdate = ""
}
if nloaded > 0 {
fmt.Printf("%s :: Previous session nloaded=%d\n",startdate,nloaded)
fmt.Printf("%s :: Previous session nloaded=%d\n", startdate, nloaded)
}
fmt.Printf("%s :: Starting Engine\n", startdate)
nloaded = 0
Expand Down Expand Up @@ -188,7 +188,7 @@ func SummarizeLog(fname string) error {
userMode = true
}
}
} else if strings.HasPrefix(msg, "QuadPro.Load") {
} else if strings.HasPrefix(msg, "Quad.Load") {
nloaded++
}
}
Expand Down Expand Up @@ -299,7 +299,7 @@ func LogWarn(msg string, keysAndValues ...any) {

func LogRaw(loglevel string, msg string, keysAndValues ...any) {
if (len(keysAndValues) % 2) != 0 {
LogWarn("LogRaw function given bad number of arguments","msg",msg)
LogWarn("LogRaw function given bad number of arguments", "msg", msg)
} else {
keysAndValues = appendExtraValues(keysAndValues)
keysAndValues = append(keysAndValues, "loglevel")
Expand Down
Loading

0 comments on commit 2a61b0d

Please sign in to comment.