diff --git a/config.yaml b/config.yaml index f62e3a1..3cb31ba 100644 --- a/config.yaml +++ b/config.yaml @@ -3,11 +3,13 @@ controller: vendorID: 0x45e productID: 0x285 mappings: - - type: button + - comment: Play left + type: button midiChannel: 1 midiKey: 7 button: south - - type: control + - comment: Volume left + type: control midiChannel: 1 midiController: 0 axis: left-y diff --git a/mapping.go b/mapping.go index adca5a5..a5aa9fd 100644 --- a/mapping.go +++ b/mapping.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "log" "gitlab.com/gomidi/midi/v2" "github.com/bendahl/uinput" @@ -35,8 +36,10 @@ func (m ButtonMapping) TriggerIfMatch(msg midi.Message, virtGamepad uinput.Gamep if m.Is(msg) { switch msg.Type() { case midi.NoteOnMsg: + log.Printf("%s: Button down\n", m.comment) return virtGamepad.ButtonDown(m.gamepadKey) case midi.NoteOffMsg: + log.Printf("%s: Button up\n", m.comment) return virtGamepad.ButtonUp(m.gamepadKey) default: return fmt.Errorf("Invalid message type triggered ButtonMapping") @@ -93,6 +96,8 @@ func (m ControlMapping) TriggerIfMatch(msg midi.Message, virtGamepad uinput.Game valueNormalised -= 1 } + log.Printf("%s: value %v\n", m.comment, valueNormalised) + switch m.axis { case LeftX: return virtGamepad.LeftStickMoveX(valueNormalised)