Documentation
¶
Index ¶
- Constants
- Variables
- func DetectDeviceConfigChanges(ctx context.Context) <-chan bool
- func NoteToOctave(note byte) int
- func NoteToPitch(note byte) string
- func StringToNote(note string) (byte, error)
- func StringToNoteUnsafe(note string) byte
- func TomlKeyToEvCode(key string, lookupTable map[string]evdev.EvCode) (evdev.EvCode, error)
- type Action
- type Analog
- type AnalogMappingAction
- type AnalogMappingCC
- type AnalogMappingNote
- type CollisionMode
- type Colors
- type Config
- type ConfigMap
- type Defaults
- type DeviceConfig
- type DeviceConfigs
- type Key
- type KeyMapping
- type MappingType
- type OpenRGB
- type TOMLDeviceConfig
Constants ¶
View Source
const ( MappingUp Action = "mapping_up" MappingDown Action = "mapping_down" Mapping Action = "mapping" // given with mapping number OctaveUp Action = "octave_up" OctaveDown Action = "octave_down" SemitoneUp Action = "semitone_up" SemitoneDown Action = "semitone_down" ChannelUp Action = "channel_up" ChannelDown Action = "channel_down" Channel Action = "channel" // given with number parameter 1-16 Multinote Action = "multinote" // holding this button and pressing midi keys sets multinote mode Panic Action = "panic" Learning Action = "cc_learning" Exit Action = "exit" AnalogPitchBend MappingType = "pitch_bend" AnalogCC MappingType = "cc" AnalogKeySim MappingType = "key" AnalogActionSim MappingType = "action" CollisionOff CollisionMode = "off" // always emit note_on/off events CollisionNoRepeat CollisionMode = "no_repeat" // emit note_on on first occurrence, note_off on last release CollisionInterrupt CollisionMode = "interrupt" // interrupt previous occurrence with note_off event first, note_off on last release CollisionRetrigger CollisionMode = "retrigger" // always emit note_on, note_off on last release )
Variables ¶
View Source
var SupportedActions = map[Action]bool{ MappingUp: true, MappingDown: true, Mapping: true, OctaveUp: true, OctaveDown: true, SemitoneUp: true, SemitoneDown: true, ChannelUp: true, ChannelDown: true, Channel: true, Multinote: true, Panic: true, Learning: true, Exit: true, }
View Source
var SupportedCollisionModes = map[CollisionMode]bool{ CollisionOff: true, CollisionNoRepeat: true, CollisionInterrupt: true, CollisionRetrigger: true, }
View Source
var SupportedMappingTypes = map[MappingType]bool{ AnalogPitchBend: true, AnalogCC: true, AnalogKeySim: true, AnalogActionSim: true, }
View Source
var (
UnsupportedDeviceType = errors.New("unsupported device type")
)
Functions ¶
func NoteToOctave ¶
func NoteToPitch ¶
func StringToNote ¶
func StringToNoteUnsafe ¶
func TomlKeyToEvCode ¶ added in v1.2.0
Types ¶
type AnalogMappingAction ¶
type AnalogMappingCC ¶
type AnalogMappingNote ¶
type CollisionMode ¶
type CollisionMode string
type Colors ¶
type Colors struct {
White, Black, C openrgb.Color
Other openrgb.Color
Active openrgb.Color
ActiveExternal openrgb.Color
}
type Config ¶
type Config struct { ID input.InputID Uniq string KeyMappings []KeyMapping ActionMapping map[evdev.EvCode]Action ExitSequence []evdev.EvCode CollisionMode CollisionMode Defaults Defaults OpenRGB OpenRGB }
type ConfigMap ¶
type ConfigMap map[input.InputID]DeviceConfig
type DeviceConfig ¶
type DeviceConfigs ¶
type DeviceConfigs struct { Factory struct { Keyboards ConfigMap Gamepads ConfigMap } User struct { Keyboards ConfigMap Gamepads ConfigMap } }
func LoadDeviceConfigs ¶
func (*DeviceConfigs) FindConfig ¶
func (c *DeviceConfigs) FindConfig(id input.InputID, devType input.DeviceType) (DeviceConfig, error)
type KeyMapping ¶
type MappingType ¶
type MappingType string
type TOMLDeviceConfig ¶
type TOMLDeviceConfig struct { CollisionMode string `toml:"collision_mode"` ExitSequence []string `toml:"exit_sequence"` Identifier struct { Bus uint16 `toml:"bus"` Vendor uint16 `toml:"vendor"` Product uint16 `toml:"product"` Version uint16 `toml:"version"` Uniq string `toml:"uniq"` } `toml:"identifier"` Defaults struct { Octave int `toml:"octave"` Semitone int `toml:"semitone"` Channel int `toml:"channel"` Mapping string `toml:"mapping"` Velocity int `toml:"velocity"` } `toml:"defaults"` ActionMapping map[string]string `toml:"action_mapping"` OpenRGB struct { White int `toml:"white"` Black int `toml:"black"` C int `toml:"c"` Unavailable int `toml:"unavailable"` Other int `toml:"other"` Active int `toml:"active"` ActiveExternal int `toml:"active_external"` } `toml:"open_rgb"` KeyMappings []struct { Name string `toml:"name"` KeyMapping []struct { SubHandler string `toml:"subhandler"` Map map[string]string `toml:"map"` } `toml:"keys"` AnalogMapping []struct { SubHandler string `toml:"subhandler"` DefaultDeadzone float64 `toml:"default_deadzone,omitempty"` Map map[string]struct { Type string `toml:"type"` CC *int `toml:"cc,omitempty"` CCNegative *int `toml:"cc_negative,omitempty"` Note *int `toml:"note,omitempty"` NoteNegative *int `toml:"note_negative,omitempty"` ChannelOffset int `toml:"channel_offset"` ChannelOffsetNegative int `toml:"channel_offset_negative"` Action *string `toml:"action,omitempty"` ActionNegative *string `toml:"action_negative,omitempty"` FlipAxis bool `toml:"flip_axis"` DeadzoneAtCenter bool `toml:"deadzone_at_center,omitempty"` } `toml:"map"` Deadzones map[string]float64 `toml:"deadzones,omitempty"` } `toml:"analog,omitempty"` } `toml:"mapping"` }
Click to show internal directories.
Click to hide internal directories.