mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
switch to WebMIDI driver when building JS
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
#editor-container {
|
#output-container {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
#log-container {
|
#log-container {
|
||||||
@@ -50,11 +50,8 @@
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="editor-container">
|
<div id="output-container">
|
||||||
<button id="button1">Button 1</button>
|
<div id="output"></div>
|
||||||
<button id="button2">Button 2</button>
|
|
||||||
<div id="output1"></div>
|
|
||||||
<div id="output2"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="log-container">
|
<div id="log-container">
|
||||||
|
|||||||
@@ -23,76 +23,26 @@ func main() {
|
|||||||
},
|
},
|
||||||
Modules: []config.ModuleConfig{
|
Modules: []config.ModuleConfig{
|
||||||
{
|
{
|
||||||
Id: "timer",
|
Id: "midi",
|
||||||
Type: "time.interval",
|
Type: "midi.input",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"duration": 1000,
|
"port": "Launchpad S",
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Id: "button1",
|
|
||||||
Type: "web.onclick",
|
|
||||||
Params: map[string]any{
|
|
||||||
"id": "button1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Id: "button2",
|
|
||||||
Type: "web.onclick",
|
|
||||||
Params: map[string]any{
|
|
||||||
"id": "button2",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Routes: []config.RouteConfig{
|
Routes: []config.RouteConfig{
|
||||||
{
|
{
|
||||||
Input: "timer",
|
Input: "midi",
|
||||||
Processors: []config.ProcessorConfig{
|
Processors: []config.ProcessorConfig{
|
||||||
{
|
{
|
||||||
Type: "debug.log",
|
Type: "debug.log",
|
||||||
},
|
},
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Input: "button1",
|
|
||||||
Processors: []config.ProcessorConfig{
|
|
||||||
{
|
|
||||||
Type: "string.create",
|
|
||||||
Params: map[string]any{
|
|
||||||
"template": "{{.Payload.UnixMilli}}",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Type: "debug.log",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Type: "web.set",
|
Type: "web.set",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"id": "output1",
|
"id": "output",
|
||||||
"property": "innerText",
|
"property": "textContent",
|
||||||
"value": "Button1 Pressed @ {{.Payload}}",
|
"value": "{{.Payload}}",
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Input: "button2",
|
|
||||||
Processors: []config.ProcessorConfig{
|
|
||||||
{
|
|
||||||
Type: "string.create",
|
|
||||||
Params: map[string]any{
|
|
||||||
"template": "{{.Payload.UnixMilli}}",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Type: "debug.log",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Type: "web.set",
|
|
||||||
Params: map[string]any{
|
|
||||||
"id": "output2",
|
|
||||||
"property": "innerText",
|
|
||||||
"value": "Button2 Pressed @ {{.Payload}}",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
7
internal/module/desktop.go
Normal file
7
internal/module/desktop.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
//go:build cgo
|
||||||
|
|
||||||
|
package module
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "gitlab.com/gomidi/midi/v2/drivers/rtmididrv"
|
||||||
|
)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build cgo
|
//go:build cgo || js
|
||||||
|
|
||||||
package module
|
package module
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/jwetzell/showbridge-go/internal/common"
|
"github.com/jwetzell/showbridge-go/internal/common"
|
||||||
"github.com/jwetzell/showbridge-go/internal/config"
|
"github.com/jwetzell/showbridge-go/internal/config"
|
||||||
"gitlab.com/gomidi/midi/v2"
|
"gitlab.com/gomidi/midi/v2"
|
||||||
_ "gitlab.com/gomidi/midi/v2/drivers/rtmididrv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type MIDIInput struct {
|
type MIDIInput struct {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build cgo
|
//go:build cgo || js
|
||||||
|
|
||||||
package module
|
package module
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/jwetzell/showbridge-go/internal/common"
|
"github.com/jwetzell/showbridge-go/internal/common"
|
||||||
"github.com/jwetzell/showbridge-go/internal/config"
|
"github.com/jwetzell/showbridge-go/internal/config"
|
||||||
"gitlab.com/gomidi/midi/v2"
|
"gitlab.com/gomidi/midi/v2"
|
||||||
_ "gitlab.com/gomidi/midi/v2/drivers/rtmididrv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type MIDIOutput struct {
|
type MIDIOutput struct {
|
||||||
|
|||||||
7
internal/module/web.go
Normal file
7
internal/module/web.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
//go:build js
|
||||||
|
|
||||||
|
package module
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "gitlab.com/gomidi/midi/v2/drivers/webmididrv"
|
||||||
|
)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build cgo
|
//go:build cgo || js
|
||||||
|
|
||||||
package processor
|
package processor
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build cgo
|
//go:build cgo || js
|
||||||
|
|
||||||
package processor
|
package processor
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build cgo
|
//go:build cgo || js
|
||||||
|
|
||||||
package processor
|
package processor
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build cgo
|
//go:build cgo || js
|
||||||
|
|
||||||
package processor
|
package processor
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user