Documentation
¶
Overview ¶
The actions module implements actions that nanokongo can trigger in response to MIDI control change messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ActionMap map[string]ActionConstructor = make(map[string]ActionConstructor)
var Kbd uinput.Keyboard
var Mouse uinput.Mouse
Functions ¶
func RegisterAction ¶
func RegisterAction(name string, constructor ActionConstructor)
RegisterAction associates an Action constructor with the specified name.
func RegisterActions ¶
func RegisterActions()
Types ¶
type Action ¶
func NewCommandAction ¶
func NewSendKeysAction ¶
func NewSendMidiAction ¶
func NewSendMouseAction ¶
type ActionConstructor ¶
func LookupAction ¶
func LookupAction(want string) ActionConstructor
LookUpAction looks for a named action in the list of registered actions and returns the appropriate constructor.
type CommandAction ¶
type CommandAction struct {
Args []string
}
The command action allows you to execute commands in response to MIDI events.
A command is specified as a list of strings. Any occurrences of {value} will be replaced by the value of the MIDI control change message that triggered the event.
Example configuration:
controls: 0: type: knob scaleRange: [0, 100] onChange: - command: [amixer, set, Master, '{value}%']
func (CommandAction) Act ¶
func (action CommandAction) Act(value, lastvalue int) error
type ControlChangeSpec ¶
type SendKeysAction ¶
The sendKeys action allows you to send keystrokes in response to MIDI control change events.
See https://github.com/bendahl/uinput/blob/master/keycodes.go for a list of valid keycodes. Remove the "Key" part of the name, and convert the rest to lower case, so "KeyA" -> "a", and "KeyLeftshift" -> "leftshift".
Example configuration:
controls: 41: type: button onRelease: - sendKeys: keys: [leftshift+o, o, d, d, b, i, t] delay: 100
func (SendKeysAction) Act ¶
func (action SendKeysAction) Act(value, lastvalue int) error
type SendMidiAction ¶
type SendMidiAction struct { DeviceName string `yaml:"device"` ChannelNumber uint8 `yaml:"channel"` Port *midi.Out `yaml:"-"` Messages []ControlChangeSpec }
The sendMidi actions lets you send MIDI control change messages in response to midi control change events.
Example configuration:
controls: 48: type: button onRelease: - sendMidi: device: nanoKONTROL2 channel: 0 messages: - control: 0x30 value: 0x7f
func (SendMidiAction) Act ¶
func (action SendMidiAction) Act(value, lastvalue int) error
type SendMouseAction ¶
type SendMouseAction struct { Click string Press string Release string X int Y int WheelX int WheelY int }
The sendMouse action lets you send mouse inputs in reaction to MIDI control change messages.
Supported attributes are:
- click: name of a button to click (one of "left", "right") - press: name of a button to press - release: name of a button to release - x: relative x movement - y: relative y movement - wheelx: relative horizontal wheel movement - wheely: relative vertical wheel movement
Example config:
controls: 58: type: button onRelease: - sendMouse: click: left
func (SendMouseAction) Act ¶
func (action SendMouseAction) Act(value, lastvalue int) error