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
- type Action
- type Analog
- type AnalogMappingAction
- type AnalogMappingCC
- type AnalogMappingNote
- type CollisionMode
- type Colors
- type Config
- type ConfigMap
- type Deadzone
- type Defaults
- type DeviceConfig
- type DeviceConfigs
- type GyroDesc
- type GyroDescToml
- type GyroMode
- type Key
- type KeyMapping
- type MappingType
- type OpenRGB
- type TOMLDeviceConfig
- type YamlCustomMapping
- type YamlDeviceConfig
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" GyroX Action = "gyro_x" GyroY Action = "gyro_y" GyroZ Action = "gyro_z" 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 GyroHold GyroMode = "hold" GyroToggle GyroMode = "toggle" )
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 SupportedGyroActivationTypes = map[GyroMode]bool{ GyroHold: true, GyroToggle: true, }
View Source
var SupportedGyroMappingTypes = map[MappingType]bool{ AnalogPitchBend: true, AnalogCC: 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 ¶
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 Deadzone Deadzone Gyro map[evdev.EvCode][]GyroDesc 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 GyroDesc ¶
type GyroDescToml ¶
type GyroDescToml struct { Axis string `toml:"axis"` Type string `toml:"type"` CC int `toml:"cc"` ActivationKey string `toml:"activation_key"` ActivationMode string `toml:"activation_mode"` ResetOnDeactivation bool `toml:"reset_on_deactivation"` FlipAxis bool `toml:"flip_axis"` ValueMultiplier float64 `toml:"value_multiplier"` }
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"` } `toml:"defaults"` ActionMapping map[string]string `toml:"action_mapping"` Gyro []GyroDescToml `toml:"gyro"` 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"` Deadzone struct { Default float64 `toml:"default"` Deadzones map[string]float64 `toml:"deadzones"` } `toml:"deadzone,omitempty"` KeyMappings []struct { Name string `toml:"name"` KeyMapping map[string]string `toml:"keys"` AnalogMapping 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"` } `toml:"analog,omitempty"` } `toml:"mapping"` }
type YamlCustomMapping ¶
type YamlCustomMapping struct { MappingType string `yaml:"type"` CC string `yaml:"cc"` CCNegative string `yaml:"cc_negative"` Note string `yaml:"note"` NoteNegative string `yaml:"note_negative"` Action string `yaml:"action"` ActionNegative string `yaml:"action_negative"` FlipAxis bool `yaml:"flip_axis"` }
type YamlDeviceConfig ¶
type YamlDeviceConfig struct { Identifier struct { Bus uint16 `yaml:"bus"` Vendor uint16 `yaml:"vendor"` Product uint16 `yaml:"product"` Version uint16 `yaml:"version"` Uniq string `yaml:"uniq"` } `yaml:"identifier"` Defaults struct { Octave int `yaml:"octave"` Semitone int `yaml:"semitone"` Channel int `yaml:"channel"` Mapping string `yaml:"mapping"` } `yaml:"defaults"` CollisionMode string `yaml:"collision_mode"` Deadzones map[string]float64 `yaml:"deadzones"` DefaultDeadzone float64 `yaml:"default_deadzone"` ActionMapping map[string]string `yaml:"action_mapping"` KeyMappings []map[string]map[string]string `yaml:"midi_mappings"` ExitSequence []string `yaml:"exit_sequence"` OpenRGB struct { Colors struct { White int `yaml:"white"` Black int `yaml:"black"` C int `yaml:"c"` Unavailable int `yaml:"unavailable"` Other int `yaml:"other"` Active int `yaml:"active"` ActiveExternal int `yaml:"active_external"` } `yaml:"colors"` } `yaml:"open_rgb"` }
Click to show internal directories.
Click to hide internal directories.