feat(config): Added config.yaml support

This commit is contained in:
2025-08-04 21:00:18 +02:00
parent cc7f355629
commit d0d8330191
6 changed files with 175 additions and 6 deletions

View File

@@ -5,7 +5,6 @@ import (
"time"
"gitlab.com/gomidi/midi/v2"
"github.com/bendahl/uinput"
)
func must[T any](obj T, err error) T {
@@ -20,11 +19,9 @@ func main() {
defer midi.CloseDriver()
log.Println("Starting...")
controller := must(NewController("DJControl Inpulse 500 MIDI 1", 0x45e, 0x285)) // mimics xbox 360 controller
defer controller.Stop()
controller.AddMapping(ButtonMapping{"Play left", 1, 7, uinput.ButtonSouth})
controller.AddMapping(ControlMapping{"Volume left", 1, 0, LeftY, false})
config := must(ParseConfig("config.yaml"))
controllerList := must(config.Construct())
defer controllerList.Stop()
time.Sleep(time.Second * 20)
}