@gamepadly/sdk
此内容尚不支持你的语言。
@gamepadly/sdk — Headless Web Controller, Adaptive Triggers, HD Rumble & Haptics SDK
Subpath exports:
@gamepadly/sdk— Core multi-controller hub, WebHID/Gamepad protocols, Action Map & cross-brand haptics@gamepadly/sdk/audio— Optional sample-driven audio & 4ch VCM haptics bank (any AudioContext)@gamepadly/sdk/mic— Optional microphone blow sensor@gamepadly/sdk/link— Optional 3-layer audio engine & Gamepadly Link 4-channel WASAPI client@gamepadly/sdk/game— Optional portable mini-game contract, reference host & test mock@gamepadly/sdk/diagnostics— Optional tester toolkit: circularity, drift, bounce & telemetry@gamepadly/sdk/bridge— Optional declarative Key/Mouse bridge for adapting open-source H5 games@gamepadly/sdk/loop— Optional lightweight DPR canvas stage, fixed-step loop & disposables
Classes
Section titled “Classes”ControllerManager
Section titled “ControllerManager”Defined in: hid/index.ts:654
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ControllerManager(
options?):ControllerManager
Defined in: hid/index.ts:657
Parameters
Section titled “Parameters”options?
Section titled “options?”DualSenseControllerManagerOptions = {}
Returns
Section titled “Returns”Accessors
Section titled “Accessors”device
Section titled “device”Get Signature
Section titled “Get Signature”get device():
HIDDevice|null
Defined in: hid/index.ts:698
Active slot’s WebHID device (null if active slot is a Gamepad API controller or disconnected).
Returns
Section titled “Returns”HIDDevice | null
firmwareInfo
Section titled “firmwareInfo”Get Signature
Section titled “Get Signature”get firmwareInfo():
DualSenseFirmwareInfo|undefined
Defined in: hid/index.ts:713
Active slot’s read-only DualSense firmware metadata, if available.
Returns
Section titled “Returns”DualSenseFirmwareInfo | undefined
hidDeviceCount
Section titled “hidDeviceCount”Get Signature
Section titled “Get Signature”get hidDeviceCount():
number
Defined in: hid/index.ts:718
Count of currently open WebHID sessions (multi-DualSense support).
Returns
Section titled “Returns”number
transport
Section titled “transport”Get Signature
Section titled “Get Signature”get transport():
TransportType
Defined in: hid/index.ts:708
Active slot’s WebHID transport (or ‘disconnected’ when active slot is not WebHID).
Returns
Section titled “Returns”Methods
Section titled “Methods”attachHidHotplug()
Section titled “attachHidHotplug()”attachHidHotplug():
void
Defined in: hid/index.ts:741
Listens for previously authorized DualSense / Switch Pro devices re-connecting over USB or Bluetooth while the page is open, automatically re-attaching WebHID with zero browser prompts.
Returns
Section titled “Returns”void
attachKeyboardFallback()
Section titled “attachKeyboardFallback()”attachKeyboardFallback():
void
Defined in: hid/index.ts:762
Returns
Section titled “Returns”void
connect()
Section titled “connect()”connect():
Promise<boolean>
Defined in: hid/index.ts:984
Opens the browser WebHID device picker to connect (or append) a DualSense / DualSense Edge or Nintendo Switch Pro controller. Existing connected controllers remain active and untouched.
Returns
Section titled “Returns”Promise<boolean>
detachHidHotplug()
Section titled “detachHidHotplug()”detachHidHotplug():
void
Defined in: hid/index.ts:747
Returns
Section titled “Returns”void
detachKeyboardFallback()
Section titled “detachKeyboardFallback()”detachKeyboardFallback():
void
Defined in: hid/index.ts:770
Returns
Section titled “Returns”void
disconnect()
Section titled “disconnect()”disconnect(
slotId?,options?):Promise<void>
Defined in: hid/index.ts:1535
Disconnects a specific WebHID controller slot, or the active WebHID slot when slotId is omitted.
With forget: true the browser permission is revoked too (HIDDevice.forget()), so the controller
is not silently re-attached by reconnectAuthorized() on the next visit.
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
options?
Section titled “options?”forget?
Section titled “forget?”boolean
Returns
Section titled “Returns”Promise<void>
disconnectAll()
Section titled “disconnectAll()”disconnectAll():
Promise<void>
Defined in: hid/index.ts:1588
Returns
Section titled “Returns”Promise<void>
emergencyReset()
Section titled “emergencyReset()”emergencyReset():
void
Defined in: hid/index.ts:2456
Fire-and-forget safety reset across ALL connected WebHID and Gamepad controllers
used inside pagehide / beforeunload so no controller ever stays stuck with stiff triggers or rumble.
Returns
Section titled “Returns”void
flushOutput()
Section titled “flushOutput()”flushOutput(
opts?):Promise<boolean>
Defined in: hid/index.ts:2380
Parameters
Section titled “Parameters”includeAudioConfig?
Section titled “includeAudioConfig?”boolean
includeLeds?
Section titled “includeLeds?”boolean
includeTriggers?
Section titled “includeTriggers?”boolean
Returns
Section titled “Returns”Promise<boolean>
getActiveGamepad()
Section titled “getActiveGamepad()”getActiveGamepad():
ExtendedGamepad|null
Defined in: hid/index.ts:958
Returns
Section titled “Returns”ExtendedGamepad | null
getActiveSlotId()
Section titled “getActiveSlotId()”getActiveSlotId():
string|null
Defined in: hid/index.ts:899
Returns
Section titled “Returns”string | null
getCapabilityMatrix()
Section titled “getCapabilityMatrix()”getCapabilityMatrix(
opts?):Record<CapabilityId,CapabilityStatus>
Defined in: hid/index.ts:2072
Parameters
Section titled “Parameters”has4ChAudio?
Section titled “has4ChAudio?”boolean
hasControllerSpeaker?
Section titled “hasControllerSpeaker?”boolean
Returns
Section titled “Returns”Record<CapabilityId, CapabilityStatus>
getCapabilityMatrixForSlot()
Section titled “getCapabilityMatrixForSlot()”getCapabilityMatrixForSlot(
slotId?,opts?):Record<CapabilityId,CapabilityStatus>
Defined in: hid/index.ts:1880
Computes a real-time capability matrix for the active controller slot (or a specific slotId).
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
has4ChAudio?
Section titled “has4ChAudio?”boolean
hasControllerSpeaker?
Section titled “hasControllerSpeaker?”boolean
Returns
Section titled “Returns”Record<CapabilityId, CapabilityStatus>
getConnectedControllers()
Section titled “getConnectedControllers()”getConnectedControllers():
ControllerSlotInfo[]
Defined in: hid/index.ts:824
Returns all connected controllers across WebHID and Gamepad API, automatically deduplicating DualSense and Switch Pro controllers that appear in both APIs simultaneously.
Returns
Section titled “Returns”getGamepadActuatorEffects()
Section titled “getGamepadActuatorEffects()”getGamepadActuatorEffects(
slotId?): readonlystring[]
Defined in: hid/index.ts:962
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”readonly string[]
getHidDevice()
Section titled “getHidDevice()”getHidDevice(
slotId?):HIDDevice|null
Defined in: hid/index.ts:703
WebHID device behind a slot (default: active slot), or null for Gamepad API / unknown slots.
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”HIDDevice | null
getInputState()
Section titled “getInputState()”getInputState(
slotId?):UnifiedInputState
Defined in: hid/index.ts:1814
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”getInputStateForSlot()
Section titled “getInputStateForSlot()”getInputStateForSlot(
slotId):UnifiedInputState
Defined in: hid/index.ts:1797
Returns a live input snapshot for a specific controller slot (e.g. hid-1 or gp-0).
Returns a disconnected empty snapshot when that slot is not currently connected.
Parameters
Section titled “Parameters”slotId
Section titled “slotId”string
Returns
Section titled “Returns”hasDualRumbleSupport()
Section titled “hasDualRumbleSupport()”hasDualRumbleSupport(
slotId?):boolean
Defined in: hid/index.ts:975
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”boolean
hasTriggerRumbleSupport()
Section titled “hasTriggerRumbleSupport()”hasTriggerRumbleSupport(
slotId?):boolean
Defined in: hid/index.ts:971
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”boolean
onStatusChange()
Section titled “onStatusChange()”onStatusChange(
fn): () =>void
Defined in: hid/index.ts:779
Parameters
Section titled “Parameters”(evt) => void
Returns
Section titled “Returns”() => void
playDualRumble()
Section titled “playDualRumble()”playDualRumble(
weakMagnitude,strongMagnitude,durationMs,slotId?):Promise<boolean>
Defined in: hid/index.ts:2224
Standard Gamepad API dual-rumble for Xbox / Switch / Generic controllers. Automatically uses true HD Rumble when the targeted slot is a WebHID Switch Pro.
Parameters
Section titled “Parameters”weakMagnitude
Section titled “weakMagnitude”number
strongMagnitude
Section titled “strongMagnitude”number
durationMs
Section titled “durationMs”number
slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”Promise<boolean>
playSwitchHdRumble()
Section titled “playSwitchHdRumble()”playSwitchHdRumble(
spec,slotId?):Promise<boolean>
Defined in: hid/index.ts:2082
Drives Nintendo Switch Pro dual-band HD Rumble (LRA) over WebHID Report 0x10.
Automatically returns both motors to neutral off after durationMs.
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”Promise<boolean>
playSwitchHdRumbleSequence()
Section titled “playSwitchHdRumbleSequence()”playSwitchHdRumbleSequence(
steps,slotId?):Promise<boolean>
Defined in: hid/index.ts:2107
Plays a timed sequence of Switch Pro HD Rumble steps (e.g., ice-cube sweep or L/R stereo pulse).
Parameters
Section titled “Parameters”(SwitchHdRumbleSpec & object)[]
slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”Promise<boolean>
playTriggerRumble()
Section titled “playTriggerRumble()”playTriggerRumble(
leftTrigger,rightTrigger,durationMs,weakMagnitude?,strongMagnitude?,slotId?):Promise<boolean>
Defined in: hid/index.ts:2165
Native Xbox Series Impulse Triggers (Chrome/Edge 126+, zero WebHID / zero install). Automatically maps to HD Rumble when the targeted slot is a WebHID Switch Pro.
Parameters
Section titled “Parameters”leftTrigger
Section titled “leftTrigger”number
rightTrigger
Section titled “rightTrigger”number
durationMs
Section titled “durationMs”number
weakMagnitude?
Section titled “weakMagnitude?”number = 0
strongMagnitude?
Section titled “strongMagnitude?”number = 0
slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”Promise<boolean>
pulseLegacyRumble()
Section titled “pulseLegacyRumble()”pulseLegacyRumble(
left?,right?,durationMs?,slotId?):Promise<boolean>
Defined in: hid/index.ts:2509
Parameters
Section titled “Parameters”number = 200
right?
Section titled “right?”number = 200
durationMs?
Section titled “durationMs?”number = 250
slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”Promise<boolean>
reconnectAuthorized()
Section titled “reconnectAuthorized()”reconnectAuthorized():
Promise<boolean>
Defined in: hid/index.ts:1010
Silently re-attaches all previously authorized DualSense & Switch Pro WebHID devices (zero browser prompts).
Returns
Section titled “Returns”Promise<boolean>
resetTriggers()
Section titled “resetTriggers()”resetTriggers(
slotId?):Promise<boolean>
Defined in: hid/index.ts:2432
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”Promise<boolean>
setActiveSlot()
Section titled “setActiveSlot()”setActiveSlot(
slotId):boolean
Defined in: hid/index.ts:904
Parameters
Section titled “Parameters”slotId
Section titled “slotId”string
Returns
Section titled “Returns”boolean
setAudioConfig()
Section titled “setAudioConfig()”setAudioConfig(
cfg):Promise<boolean>
Defined in: hid/index.ts:2390
Parameters
Section titled “Parameters”audioRoute?
Section titled “audioRoute?”headphoneVolume?
Section titled “headphoneVolume?”number
speakerPreamp?
Section titled “speakerPreamp?”number
speakerVolume?
Section titled “speakerVolume?”number
Returns
Section titled “Returns”Promise<boolean>
setGamepadMappings()
Section titled “setGamepadMappings()”setGamepadMappings(
rules):void
Defined in: hid/index.ts:662
Replace the custom Gamepad API layouts (first matching rule wins).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
setLightbar()
Section titled “setLightbar()”setLightbar(
r,g,b,slotId?):Promise<boolean>
Defined in: hid/index.ts:2476
Parameters
Section titled “Parameters”number
number
number
slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”Promise<boolean>
setMuteLed()
Section titled “setMuteLed()”setMuteLed(
mode,slotId?):Promise<boolean>
Defined in: hid/index.ts:2502
Controls the DualSense / DualSense Edge orange microphone mute button LED ('off' | 'on' | 'pulse').
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”Promise<boolean>
setPlayerLeds()
Section titled “setPlayerLeds()”setPlayerLeds(
mask,slotId?):Promise<boolean>
Defined in: hid/index.ts:2488
Sets the player indicator LED bitmask over WebHID:
- DualSense / DualSense Edge: 5 white LEDs below touchpad (
0x00..0x1f, e.g.0x04= center,0x1f= all 5). - Switch Pro: 4 green LEDs on bottom edge (
0x00..0x0f, e.g.0x01,0x03,0x07,0x0f).
Parameters
Section titled “Parameters”number
slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”Promise<boolean>
setTriggers()
Section titled “setTriggers()”setTriggers(
left?,right?,slotId?):Promise<boolean>
Defined in: hid/index.ts:2405
Parameters
Section titled “Parameters”right?
Section titled “right?”slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”Promise<boolean>
stopGamepadRumble()
Section titled “stopGamepadRumble()”stopGamepadRumble(
slotId?):void
Defined in: hid/index.ts:2257
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”void
stopSwitchHdRumble()
Section titled “stopSwitchHdRumble()”stopSwitchHdRumble(
slotId?):void
Defined in: hid/index.ts:2145
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”void
triggerGamepadRumbleFallback()
Section titled “triggerGamepadRumbleFallback()”triggerGamepadRumbleFallback(
weakMagnitude,strongMagnitude,durationMs,slotId?):void
Defined in: hid/index.ts:2278
Backwards-compatible helper used when 4ch VCM audio is not active.
Parameters
Section titled “Parameters”weakMagnitude
Section titled “weakMagnitude”number
strongMagnitude
Section titled “strongMagnitude”number
durationMs
Section titled “durationMs”number
slotId?
Section titled “slotId?”string
Returns
Section titled “Returns”void
isGamepadSupported()
Section titled “isGamepadSupported()”
staticisGamepadSupported():boolean
Defined in: hid/index.ts:726
Returns
Section titled “Returns”boolean
isWebHIDSupported()
Section titled “isWebHIDSupported()”
staticisWebHIDSupported():boolean
Defined in: hid/index.ts:722
Returns
Section titled “Returns”boolean
SlotAutoSwitcher
Section titled “SlotAutoSwitcher”Defined in: input/slotSwitcher.ts:41
Tracks multi-controller activity to:
- Auto-switch the active tester tab to whichever controller is intentionally operated.
- Detect intentional input on any controller (single or multi) to scroll the tester into view. Ignores static stick drift, micro-noise, and stick spring-back to center.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SlotAutoSwitcher():
SlotAutoSwitcher
Returns
Section titled “Returns”Methods
Section titled “Methods”detectTargetSlot()
Section titled “detectTargetSlot()”detectTargetSlot(
samples,activeSlotId,now):string|null
Defined in: input/slotSwitcher.ts:136
Parameters
Section titled “Parameters”samples
Section titled “samples”activeSlotId
Section titled “activeSlotId”string | null
number
Returns
Section titled “Returns”string | null
evaluate()
Section titled “evaluate()”evaluate(
samples,activeSlotId,now):SlotActivityResult
Defined in: input/slotSwitcher.ts:50
Parameters
Section titled “Parameters”samples
Section titled “samples”activeSlotId
Section titled “activeSlotId”string | null
number
Returns
Section titled “Returns”notifyManualSelect()
Section titled “notifyManualSelect()”notifyManualSelect(
samples,now):void
Defined in: input/slotSwitcher.ts:45
Parameters
Section titled “Parameters”samples
Section titled “samples”number
Returns
Section titled “Returns”void
TriggerFeedbackController
Section titled “TriggerFeedbackController”Defined in: haptics/triggerWrites.ts:26
Tracks DualSense adaptive-trigger preset writes and cleanup responsibility so
failed preset switches, failed “Off” clears, rapid clicks, or mid-write unmounts
never drop the obligation to call hid.resetTriggers() on teardown.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TriggerFeedbackController():
TriggerFeedbackController
Returns
Section titled “Returns”Accessors
Section titled “Accessors”hasActiveTrigger
Section titled “hasActiveTrigger”Get Signature
Section titled “Get Signature”get hasActiveTrigger():
boolean
Defined in: haptics/triggerWrites.ts:44
Returns
Section titled “Returns”boolean
leftPreset
Section titled “leftPreset”Get Signature
Section titled “Get Signature”get leftPreset():
string
Defined in: haptics/triggerWrites.ts:36
Returns
Section titled “Returns”string
needsCleanup
Section titled “needsCleanup”Get Signature
Section titled “Get Signature”get needsCleanup():
boolean
Defined in: haptics/triggerWrites.ts:53
Returns
Section titled “Returns”boolean
rightPreset
Section titled “rightPreset”Get Signature
Section titled “Get Signature”get rightPreset():
string
Defined in: haptics/triggerWrites.ts:40
Returns
Section titled “Returns”string
Methods
Section titled “Methods”applyPreset()
Section titled “applyPreset()”applyPreset(
hid,target,presetId,spec):Promise<TriggerApplyResult>
Defined in: haptics/triggerWrites.ts:65
Parameters
Section titled “Parameters”target
Section titled “target”presetId
Section titled “presetId”string
Returns
Section titled “Returns”Promise<TriggerApplyResult>
cleanupOnSlotChange()
Section titled “cleanupOnSlotChange()”cleanupOnSlotChange(
hid):boolean
Defined in: haptics/triggerWrites.ts:174
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
cleanupOnUnmount()
Section titled “cleanupOnUnmount()”cleanupOnUnmount(
hid):boolean
Defined in: haptics/triggerWrites.ts:163
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
markMounted()
Section titled “markMounted()”markMounted():
void
Defined in: haptics/triggerWrites.ts:57
Returns
Section titled “Returns”void
markRumbleActive()
Section titled “markRumbleActive()”markRumbleActive():
void
Defined in: haptics/triggerWrites.ts:61
Returns
Section titled “Returns”void
Interfaces
Section titled “Interfaces”ActionBindings
Section titled “ActionBindings”Defined in: input/actions.ts:64
The bindings of an action map, as plain JSON-safe data (for saving and restoring player remaps).
Type Parameters
Section titled “Type Parameters”TActions
Section titled “TActions”TActions extends string = string
TAxes extends string = string
Properties
Section titled “Properties”actions
Section titled “actions”actions:
Record<TActions,ActionBinding[]>
Defined in: input/actions.ts:65
axes:
Record<TAxes,AxisActionSpec>
Defined in: input/actions.ts:66
ActionMapSpec
Section titled “ActionMapSpec”Defined in: input/actions.ts:33
Type Parameters
Section titled “Type Parameters”TActions
Section titled “TActions”TActions extends string = string
TAxes extends string = string
Properties
Section titled “Properties”actions?
Section titled “actions?”
optionalactions?:Record<TActions,ActionBinding[]>
Defined in: input/actions.ts:37
analogThreshold?
Section titled “analogThreshold?”
optionalanalogThreshold?:number
Defined in: input/actions.ts:40
Analog threshold (0..1) above which a trigger or stick direction counts as pressed. Default 0.45.
attachWindowListeners?
Section titled “attachWindowListeners?”
optionalattachWindowListeners?:boolean
Defined in: input/actions.ts:42
Attach window keyboard/mouse listeners automatically when window exists. Default true.
optionalaxes?:Record<TAxes,AxisActionSpec>
Defined in: input/actions.ts:38
ignoreHeldOnStart?
Section titled “ignoreHeldOnStart?”
optionalignoreHeldOnStart?:boolean
Defined in: input/actions.ts:60
Keep actions whose inputs are already held when the map is created released until they are let
go, so the button that closed a menu or started the game does not also fire a game action.
Default false.
mouseTarget?
Section titled “mouseTarget?”
optionalmouseTarget?:EventTarget
Defined in: input/actions.ts:44
Optional DOM element for mouse button tracking (defaults to window).
preventDefaultKeys?
Section titled “preventDefaultKeys?”
optionalpreventDefaultKeys?:boolean
Defined in: input/actions.ts:49
Call preventDefault() on bound navigation/scroll keys (Space, Arrow*, Tab) when focus
is not inside a form field. Default true.
repeat?
Section titled “repeat?”
optionalrepeat?:object
Defined in: input/actions.ts:54
Timing for repeated(), for menus that keep moving while a direction is held: the first repeat
comes delayMs after the press, then one every intervalMs. Default { delayMs: 400, intervalMs: 100 }.
delayMs?
Section titled “delayMs?”
optionaldelayMs?:number
intervalMs?
Section titled “intervalMs?”
optionalintervalMs?:number
ActionState
Section titled “ActionState”Defined in: input/actions.ts:69
Properties
Section titled “Properties”heldMs
Section titled “heldMs”heldMs:
number
Defined in: input/actions.ts:73
justPressed
Section titled “justPressed”justPressed:
boolean
Defined in: input/actions.ts:71
justReleased
Section titled “justReleased”justReleased:
boolean
Defined in: input/actions.ts:72
pressed
Section titled “pressed”pressed:
boolean
Defined in: input/actions.ts:70
repeated
Section titled “repeated”repeated:
boolean
Defined in: input/actions.ts:75
True on the press, then once per repeat interval while held (see ActionMapSpec.repeat).
value:
number
Defined in: input/actions.ts:77
Analog intensity 0..1 (e.g. R2 pull depth, stick tilt magnitude, or 1 when digital key pressed).
ActionTracker
Section titled “ActionTracker”Defined in: input/actions.ts:80
Type Parameters
Section titled “Type Parameters”TActions
Section titled “TActions”TActions extends string = string
TAxes extends string = string
Methods
Section titled “Methods”action()
Section titled “action()”action(
name):ActionState
Defined in: input/actions.ts:87
Digital + edge state for a declared action.
Parameters
Section titled “Parameters”TActions
Returns
Section titled “Returns”axis()
Section titled “axis()”axis(
name):number
Defined in: input/actions.ts:98
Combined -1..+1 axis value fusing gamepad stick, buttons, and keyboard keys.
Parameters
Section titled “Parameters”TAxes
Returns
Section titled “Returns”number
dispose()
Section titled “dispose()”dispose():
void
Defined in: input/actions.ts:122
Clears all held states and detaches any window/DOM listeners.
Returns
Section titled “Returns”void
getBindings()
Section titled “getBindings()”getBindings():
ActionBindings<TActions,TAxes>
Defined in: input/actions.ts:100
A copy of the current bindings, safe to JSON.stringify() and pass back to setBindings().
Returns
Section titled “Returns”ActionBindings<TActions, TAxes>
isPressed()
Section titled “isPressed()”isPressed(
name):boolean
Defined in: input/actions.ts:89
Convenience boolean checks.
Parameters
Section titled “Parameters”TActions
Returns
Section titled “Returns”boolean
justPressed()
Section titled “justPressed()”justPressed(
name):boolean
Defined in: input/actions.ts:90
Parameters
Section titled “Parameters”TActions
Returns
Section titled “Returns”boolean
justReleased()
Section titled “justReleased()”justReleased(
name):boolean
Defined in: input/actions.ts:91
Parameters
Section titled “Parameters”TActions
Returns
Section titled “Returns”boolean
lastPressed()
Section titled “lastPressed()”lastPressed():
ActionBinding|null
Defined in: input/actions.ts:117
The input that went down during the latest update(), as a binding: a controller button
(position names such as 'south' for face buttons), 'l2' / 'r2', a stick direction, a
KeyboardEvent.code or a mouse button. null when nothing new was pressed. For “press a button
for Jump” screens.
Returns
Section titled “Returns”ActionBinding | null
repeated()
Section titled “repeated()”repeated(
name):boolean
Defined in: input/actions.ts:96
True on the update the action is pressed, then again every repeat interval while it stays held. Use it to move through menus with a held direction.
Parameters
Section titled “Parameters”TActions
Returns
Section titled “Returns”boolean
setBindings()
Section titled “setBindings()”setBindings(
bindings):void
Defined in: input/actions.ts:107
Replaces the bindings of the listed actions and axes; the others keep theirs. Names the map does not declare are ignored, so bindings saved by an older version of the game load safely. A rebound action stays released until its inputs are released, so the press used to pick a binding does not also trigger the action.
Parameters
Section titled “Parameters”bindings
Section titled “bindings”actions?
Section titled “actions?”Partial<Record<TActions, ActionBinding[]>>
Partial<Record<TAxes, AxisActionSpec>>
Returns
Section titled “Returns”void
setKeyDown()
Section titled “setKeyDown()”setKeyDown(
code,down):void
Defined in: input/actions.ts:119
Marks a keyboard code as held or released, as a keydown / keyup would (useful in tests).
Parameters
Section titled “Parameters”string
boolean
Returns
Section titled “Returns”void
setMouseButton()
Section titled “setMouseButton()”setMouseButton(
button,down):void
Defined in: input/actions.ts:120
Parameters
Section titled “Parameters”button
Section titled “button”boolean
Returns
Section titled “Returns”void
update()
Section titled “update()”update(
input,nowMs?):void
Defined in: input/actions.ts:85
Poll once per frame with the latest UnifiedInputState and timestamp (ms).
Parameters
Section titled “Parameters”nowMs?
Section titled “nowMs?”number
Returns
Section titled “Returns”void
AxisActionSpec
Section titled “AxisActionSpec”Defined in: input/actions.ts:23
Properties
Section titled “Properties”deadzone?
Section titled “deadzone?”
optionaldeadzone?:number
Defined in: input/actions.ts:25
invert?
Section titled “invert?”
optionalinvert?:boolean
Defined in: input/actions.ts:30
negativeButtons?
Section titled “negativeButtons?”
optionalnegativeButtons?:ButtonInput[]
Defined in: input/actions.ts:26
negativeKeys?
Section titled “negativeKeys?”
optionalnegativeKeys?:string[]
Defined in: input/actions.ts:28
positiveButtons?
Section titled “positiveButtons?”
optionalpositiveButtons?:ButtonInput[]
Defined in: input/actions.ts:27
positiveKeys?
Section titled “positiveKeys?”
optionalpositiveKeys?:string[]
Defined in: input/actions.ts:29
stick?
Section titled “stick?”
optionalstick?:"lx"|"ly"|"rx"|"ry"
Defined in: input/actions.ts:24
BatteryStatus
Section titled “BatteryStatus”Defined in: hid/index.ts:116
Properties
Section titled “Properties”charging
Section titled “charging”charging:
boolean
Defined in: hid/index.ts:118
full:
boolean
Defined in: hid/index.ts:119
known:
boolean
Defined in: hid/index.ts:120
percent
Section titled “percent”percent:
number
Defined in: hid/index.ts:117
CapabilitiesChangeEvent
Section titled “CapabilitiesChangeEvent”Defined in: hub.ts:156
Properties
Section titled “Properties”active
Section titled “active”active:
PlayerCapabilities
Defined in: hub.ts:158
slots:
ControllerSlotInfo[]
Defined in: hub.ts:157
CapabilityStatus
Section titled “CapabilityStatus”Defined in: hid/index.ts:59
Properties
Section titled “Properties”availability
Section titled “availability”availability:
CapabilityAvailability
Defined in: hid/index.ts:61
inherent
Section titled “inherent”inherent:
boolean
Defined in: hid/index.ts:60
reason?
Section titled “reason?”
optionalreason?:string
Defined in: hid/index.ts:62
ContinuousHapticHandle
Section titled “ContinuousHapticHandle”Defined in: haptics/router.ts:59
Methods
Section titled “Methods”stop()
Section titled “stop()”stop():
void
Defined in: haptics/router.ts:61
Returns
Section titled “Returns”void
update()
Section titled “update()”update(
params):void
Defined in: haptics/router.ts:60
Parameters
Section titled “Parameters”params
Section titled “params”freqScale?
Section titled “freqScale?”number
intensity?
Section titled “intensity?”number
number
speed?
Section titled “speed?”number
Returns
Section titled “Returns”void
ControllerIdentity
Section titled “ControllerIdentity”Defined in: hid/index.ts:72
Properties
Section titled “Properties”brand:
ControllerBrand
Defined in: hid/index.ts:73
displayName
Section titled “displayName”displayName:
string
Defined in: hid/index.ts:75
firmwareInfo?
Section titled “firmwareInfo?”
optionalfirmwareInfo?:DualSenseFirmwareInfo
Defined in: hid/index.ts:81
model:
ControllerModel
Defined in: hid/index.ts:74
productId?
Section titled “productId?”
optionalproductId?:number
Defined in: hid/index.ts:78
rawId:
string
Defined in: hid/index.ts:76
source
Section titled “source”source:
"none"|"webhid"|"gamepad"|"keyboard_mouse"
Defined in: hid/index.ts:80
transport
Section titled “transport”transport:
TransportType
Defined in: hid/index.ts:79
vendorId?
Section titled “vendorId?”
optionalvendorId?:number
Defined in: hid/index.ts:77
ControllerLifecycleOptions
Section titled “ControllerLifecycleOptions”Defined in: lifecycle.ts:16
Properties
Section titled “Properties”audio?
Section titled “audio?”
optionalaudio?:LifecycleAudio| (() =>LifecycleAudio|null) |null
Defined in: lifecycle.ts:29
Audio layer to silence on exit; a getter lets hosts swap engines at runtime.
autoEmergencyReset?
Section titled “autoEmergencyReset?”
optionalautoEmergencyReset?:boolean
Defined in: lifecycle.ts:25
On pagehide / beforeunload: reset triggers, rumble and HD Rumble on every controller and stop
continuous audio haptics. Default true.
autoHotplug?
Section titled “autoHotplug?”
optionalautoHotplug?:boolean
Defined in: lifecycle.ts:18
Listen for WebHID hotplug and Gamepad API connect/disconnect events. Default true.
detachHotplugOnCleanup?
Section titled “detachHotplugOnCleanup?”
optionaldetachHotplugOnCleanup?:boolean
Defined in: lifecycle.ts:20
Detach WebHID hotplug again when the returned cleanup runs. Default true.
onChange?
Section titled “onChange?”
optionalonChange?: (reason) =>void
Defined in: lifecycle.ts:36
Called when controllers may have changed: 'status' (manager connect/disconnect/upgrade),
'gamepad' (Gamepad API event) or 'poll'. Diff cheaply; this fires every poll tick.
Parameters
Section titled “Parameters”reason
Section titled “reason”Returns
Section titled “Returns”void
pollMs?
Section titled “pollMs?”
optionalpollMs?:number
Defined in: lifecycle.ts:31
Poll interval (ms) for Gamepad API changes that fire no event. Default 250; 0 disables.
teardownAudioOnExit?
Section titled “teardownAudioOnExit?”
optionalteardownAudioOnExit?:boolean
Defined in: lifecycle.ts:27
Also release the DualSense 4-channel audio output on page exit. Default false.
ControllerSlotInfo
Section titled “ControllerSlotInfo”Defined in: hid/index.ts:544
Properties
Section titled “Properties”battery
Section titled “battery”battery:
BatteryStatus
Defined in: hid/index.ts:551
id:
string
Defined in: hid/index.ts:546
Stable slot identifier: hid-1, hid-2, gp-0, gp-1, …
identity
Section titled “identity”identity:
ControllerIdentity
Defined in: hid/index.ts:550
lastActivityAt
Section titled “lastActivityAt”lastActivityAt:
number
Defined in: hid/index.ts:554
Timestamp (performance.now()) of most recent button press on this slot
observedReportHz
Section titled “observedReportHz”observedReportHz:
number|null
Defined in: hid/index.ts:552
playerNumber
Section titled “playerNumber”playerNumber:
number
Defined in: hid/index.ts:548
1-based player index in the current deduplicated controller list (P1, P2, …)
source
Section titled “source”source:
"webhid"|"gamepad"
Defined in: hid/index.ts:549
DualSenseControllerManagerOptions
Section titled “DualSenseControllerManagerOptions”Defined in: hid/index.ts:165
Properties
Section titled “Properties”gamepadMappings?
Section titled “gamepadMappings?”
optionalgamepadMappings?:GamepadMappingRule[]
Defined in: hid/index.ts:167
Custom layouts for Gamepad API controllers; the first matching rule wins.
DualSenseFirmwareInfo
Section titled “DualSenseFirmwareInfo”Defined in: hid/index.ts:65
Properties
Section titled “Properties”buildDate
Section titled “buildDate”buildDate:
string
Defined in: hid/index.ts:66
buildTime
Section titled “buildTime”buildTime:
string
Defined in: hid/index.ts:67
fwVersionHex
Section titled “fwVersionHex”fwVersionHex:
string
Defined in: hid/index.ts:69
hwInfoHex
Section titled “hwInfoHex”hwInfoHex:
string
Defined in: hid/index.ts:68
GamepadlyHub
Section titled “GamepadlyHub”Defined in: hub.ts:161
Properties
Section titled “Properties”
readonlyhid:ControllerManager
Defined in: hub.ts:162
Accessors
Section titled “Accessors”active
Section titled “active”Get Signature
Section titled “Get Signature”get active():
PlayerHandle
Defined in: hub.ts:177
Gets the currently active player handle (single-player convenience).
Returns
Section titled “Returns”Methods
Section titled “Methods”attachAudio()
Section titled “attachAudio()”attachAudio(
audio):void
Defined in: hub.ts:173
Attaches or detaches a 3-layer audio / Link engine at runtime.
Parameters
Section titled “Parameters”HapticAudioSink | null
Returns
Section titled “Returns”void
connectWebHID()
Section titled “connectWebHID()”connectWebHID():
Promise<boolean>
Defined in: hub.ts:164
Connects a DualSense / Switch Pro controller via browser WebHID picker (must be called in a user gesture).
Returns
Section titled “Returns”Promise<boolean>
disconnectWebHID()
Section titled “disconnectWebHID()”disconnectWebHID(
slotId?,options?):Promise<void>
Defined in: hub.ts:169
Disconnects a WebHID controller (default: the active one). With forget: true the browser
permission is revoked too, so it will not silently reconnect on the next visit.
Parameters
Section titled “Parameters”slotId?
Section titled “slotId?”string
options?
Section titled “options?”forget?
Section titled “forget?”boolean
Returns
Section titled “Returns”Promise<void>
dispose()
Section titled “dispose()”dispose():
void
Defined in: hub.ts:193
Stops all active haptics/rumble/continuous audio, resets triggers & lightbar, and frees listeners.
Returns
Section titled “Returns”void
getSlots()
Section titled “getSlots()”getSlots():
ControllerSlotInfo[]
Defined in: hub.ts:175
Lists all deduplicated connected controllers (P1..P4).
Returns
Section titled “Returns”onCapabilitiesChange()
Section titled “onCapabilitiesChange()”onCapabilitiesChange(
listener): () =>void
Defined in: hub.ts:189
Subscribes to controller connect/disconnect, WebHID upgrade, slot switch, or 4ch audio changes.
Parameters
Section titled “Parameters”listener
Section titled “listener”(event) => void
Returns
Section titled “Returns”() => void
player()
Section titled “player()”player(
target?):PlayerHandle
Defined in: hub.ts:187
Returns a player handle by 0-based player index (0 = P1, 1 = P2, … up to 3) or explicit slotId.
If target is omitted or 'active', follows the manager’s active slot.
A numbered player keeps its controller: when another controller disconnects, connects or is
upgraded to WebHID, player(1) still reads P2’s controller. When P2’s controller disconnects,
player(1) reads an idle state and getSlotId() returns null until a newly connected
controller takes the free seat (the lowest free player number first).
Parameters
Section titled “Parameters”target?
Section titled “target?”string | number
Returns
Section titled “Returns”reconnectAuthorized()
Section titled “reconnectAuthorized()”reconnectAuthorized():
Promise<boolean>
Defined in: hub.ts:171
Re-attaches previously authorized WebHID controllers with zero prompts.
Returns
Section titled “Returns”Promise<boolean>
syncCapabilities()
Section titled “syncCapabilities()”syncCapabilities():
void
Defined in: hub.ts:191
Manually checks and emits capability changes if anything changed (useful in tests or custom loops).
Returns
Section titled “Returns”void
GamepadlyHubOptions
Section titled “GamepadlyHubOptions”Defined in: hub.ts:124
Properties
Section titled “Properties”attachKeyboardFallback?
Section titled “attachKeyboardFallback?”
optionalattachKeyboardFallback?:boolean
Defined in: hub.ts:144
Automatically attach keyboard fallback on the underlying manager when owned. Default false.
audio?
Section titled “audio?”
optionalaudio?:HapticAudioSink|null
Defined in: hub.ts:133
Optional 3-layer audio / 4ch Link engine (from @gamepadly/sdk/link).
autoEmergencyReset?
Section titled “autoEmergencyReset?”
optionalautoEmergencyReset?:boolean
Defined in: hub.ts:149
On pagehide / beforeunload: reset triggers, rumble and HD Rumble on every controller and stop
continuous audio haptics. Default true.
autoHotplug?
Section titled “autoHotplug?”
optionalautoHotplug?:boolean
Defined in: hub.ts:142
Automatically listen for WebHID hotplug & Gamepad API connect/disconnect events. Default true.
capabilityPollMs?
Section titled “capabilityPollMs?”
optionalcapabilityPollMs?:number
Defined in: hub.ts:153
Poll interval (ms) for detecting Gamepad API capability changes. Default 250. Set 0 to disable.
gamepadMappings?
Section titled “gamepadMappings?”
optionalgamepadMappings?:GamepadMappingRule[]
Defined in: hub.ts:131
Custom layouts for controllers the browser exposes with a non-standard Gamepad API mapping
(check player.input.getState().mapping === 'nonstandard'). First matching rule wins.
optionalhid?:ControllerManager
Defined in: hub.ts:126
Reuse an existing controller manager (e.g. from a host app context).
samples?
Section titled “samples?”
optionalsamples?:SampleAudioSink|null
Defined in: hub.ts:140
Optional 4-channel sample bank (createSampleBank(provider) from @gamepadly/sdk/audio).
Not needed when audio is created via createLinkAudio(), which already bundles a sample bank.
Controller-routed samples ('speaker' / 'vcm' / 'quad') only reach the DualSense when
audio reports a bound 4-channel device for this player.
teardownAudioOnExit?
Section titled “teardownAudioOnExit?”
optionalteardownAudioOnExit?:boolean
Defined in: hub.ts:151
Also release the DualSense 4-channel audio output on page exit. Default false.
GamepadMappingRule
Section titled “GamepadMappingRule”Defined in: hid/index.ts:154
Custom Gamepad API layout for controllers the browser exposes with a non-standard mapping
(common in Firefox and Safari, and for some third-party pads). Unlisted buttons/axes keep their
W3C standard index. Pass rules via createGamepadly({ gamepadMappings }) or
manager.setGamepadMappings().
Properties
Section titled “Properties”
optionalaxes?:Partial<Record<"lx"|"ly"|"rx"|"ry",GamepadAxisSource>>
Defined in: hid/index.ts:160
Stick axis → raw pad.axes[] index (optionally inverted).
buttons?
Section titled “buttons?”
optionalbuttons?:Partial<Record<ButtonName,number>>
Defined in: hid/index.ts:158
SDK button name → raw pad.buttons[] index.
match: (
pad) =>boolean
Defined in: hid/index.ts:156
Return true when this rule applies, e.g. (pad) => pad.mapping === '' && pad.id.includes('054c').
Parameters
Section titled “Parameters”string
number
mapping
Section titled “mapping”string
Returns
Section titled “Returns”boolean
triggers?
Section titled “triggers?”
optionaltriggers?:Partial<Record<"l2"|"r2",GamepadTriggerSource>>
Defined in: hid/index.ts:162
Analog trigger → raw button or axis.
HapticAudioSink
Section titled “HapticAudioSink”Defined in: haptics/router.ts:95
Structural audio/4ch-haptics sink satisfied by ThreeLayerAudioEngine in @gamepadly/sdk/link.
Keeping this interface in core ensures @gamepadly/sdk stays tree-shakable with zero audio dependency.
Properties
Section titled “Properties”dsMaxChannelCount
Section titled “dsMaxChannelCount”
readonlydsMaxChannelCount:number
Defined in: haptics/router.ts:97
dsMode
Section titled “dsMode”
readonlydsMode:"none"|"companion"|"setsinkid"
Defined in: haptics/router.ts:96
Methods
Section titled “Methods”createContinuous()
Section titled “createContinuous()”createContinuous(
preset):ContinuousHapticHandle
Defined in: haptics/router.ts:100
Parameters
Section titled “Parameters”preset
Section titled “preset”Returns
Section titled “Returns”hasSample()?
Section titled “hasSample()?”
optionalhasSample(id):boolean
Defined in: haptics/router.ts:110
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
loadSample()?
Section titled “loadSample()?”
optionalloadSample(id,source):Promise<boolean>
Defined in: haptics/router.ts:109
Parameters
Section titled “Parameters”string
source
Section titled “source”Returns
Section titled “Returns”Promise<boolean>
playComboPreset()
Section titled “playComboPreset()”playComboPreset(
presetId,pan?):void
Defined in: haptics/router.ts:101
Parameters
Section titled “Parameters”presetId
Section titled “presetId”number
Returns
Section titled “Returns”void
playControllerSpeakerTone()
Section titled “playControllerSpeakerTone()”playControllerSpeakerTone(
spec):void
Defined in: haptics/router.ts:104
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
playHapticPulse()
Section titled “playHapticPulse()”playHapticPulse(
spec):void
Defined in: haptics/router.ts:98
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
playHapticSweep()
Section titled “playHapticSweep()”playHapticSweep(
spec):void
Defined in: haptics/router.ts:99
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
playPcNoiseBurst()
Section titled “playPcNoiseBurst()”playPcNoiseBurst(
opts):void
Defined in: haptics/router.ts:103
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
playPcTone()
Section titled “playPcTone()”playPcTone(
spec):void
Defined in: haptics/router.ts:102
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
playSample()?
Section titled “playSample()?”
optionalplaySample(id,options?):SamplePlaybackHandle
Defined in: haptics/router.ts:112
Parameters
Section titled “Parameters”string
options?
Section titled “options?”Returns
Section titled “Returns”stopAllContinuous()?
Section titled “stopAllContinuous()?”
optionalstopAllContinuous():void
Defined in: haptics/router.ts:106
Optional: silences every continuous haptic/audio layer (called on page exit).
Returns
Section titled “Returns”void
teardownDsOutput()?
Section titled “teardownDsOutput()?”
optionalteardownDsOutput():Promise<void>
Defined in: haptics/router.ts:108
Optional: releases the DualSense 4-channel output (called on page exit when enabled).
Returns
Section titled “Returns”Promise<void>
unloadSample()?
Section titled “unloadSample()?”
optionalunloadSample(id):void
Defined in: haptics/router.ts:111
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
HapticPulseSpec
Section titled “HapticPulseSpec”Defined in: haptics/router.ts:16
Properties
Section titled “Properties”delayMs?
Section titled “delayMs?”
optionaldelayMs?:number
Defined in: haptics/router.ts:23
durationMs
Section titled “durationMs”durationMs:
number
Defined in: haptics/router.ts:20
endFreqHz?
Section titled “endFreqHz?”
optionalendFreqHz?:number
Defined in: haptics/router.ts:19
freqHz
Section titled “freqHz”freqHz:
number
Defined in: haptics/router.ts:18
intensity
Section titled “intensity”intensity:
number
Defined in: haptics/router.ts:21
optionalpan?:number
Defined in: haptics/router.ts:17
optionalwave?:OscillatorType
Defined in: haptics/router.ts:22
HapticRouteContext
Section titled “HapticRouteContext”Defined in: haptics/router.ts:117
Properties
Section titled “Properties”allow4ChAudio?
Section titled “allow4ChAudio?”
optionalallow4ChAudio?:boolean
Defined in: haptics/router.ts:122
Whether this slot can use the attached 4ch audio stream (true for active/primary DualSense).
audio?
Section titled “audio?”
optionalaudio?:HapticAudioSink|null
Defined in: haptics/router.ts:119
hid:
ControllerManager
Defined in: haptics/router.ts:118
slotId?
Section titled “slotId?”
optionalslotId?:string
Defined in: haptics/router.ts:120
HapticSweepSpec
Section titled “HapticSweepSpec”Defined in: haptics/router.ts:26
Properties
Section titled “Properties”durationMs
Section titled “durationMs”durationMs:
number
Defined in: haptics/router.ts:31
fromHz
Section titled “fromHz”fromHz:
number
Defined in: haptics/router.ts:29
fromPan
Section titled “fromPan”fromPan:
number
Defined in: haptics/router.ts:27
intensity
Section titled “intensity”intensity:
number
Defined in: haptics/router.ts:32
toHz:
number
Defined in: haptics/router.ts:30
toPan:
number
Defined in: haptics/router.ts:28
optionalwave?:OscillatorType
Defined in: haptics/router.ts:33
HIDStatusEvent
Section titled “HIDStatusEvent”Defined in: hid/index.ts:557
Properties
Section titled “Properties”deviceName?
Section titled “deviceName?”
optionaldeviceName?:string
Defined in: hid/index.ts:560
firmwareInfo?
Section titled “firmwareInfo?”
optionalfirmwareInfo?:DualSenseFirmwareInfo
Defined in: hid/index.ts:563
productId?
Section titled “productId?”
optionalproductId?:number
Defined in: hid/index.ts:561
slotId?
Section titled “slotId?”
optionalslotId?:string
Defined in: hid/index.ts:559
transport?
Section titled “transport?”
optionaltransport?:TransportType
Defined in: hid/index.ts:562
type:
"disconnected"|"connected"|"slots_changed"
Defined in: hid/index.ts:558
ImpulseTriggerSpec
Section titled “ImpulseTriggerSpec”Defined in: haptics/router.ts:75
Properties
Section titled “Properties”durationMs?
Section titled “durationMs?”
optionaldurationMs?:number
Defined in: haptics/router.ts:78
optionalleft?:number
Defined in: haptics/router.ts:76
right?
Section titled “right?”
optionalright?:number
Defined in: haptics/router.ts:77
strongGrip?
Section titled “strongGrip?”
optionalstrongGrip?:number
Defined in: haptics/router.ts:80
weakGrip?
Section titled “weakGrip?”
optionalweakGrip?:number
Defined in: haptics/router.ts:79
LifecycleAudio
Section titled “LifecycleAudio”Defined in: lifecycle.ts:9
Optional audio layer silenced on page exit (ThreeLayerAudioEngine satisfies it).
Methods
Section titled “Methods”stopAllContinuous()?
Section titled “stopAllContinuous()?”
optionalstopAllContinuous():void
Defined in: lifecycle.ts:10
Returns
Section titled “Returns”void
teardownDsOutput()?
Section titled “teardownDsOutput()?”
optionalteardownDsOutput():Promise<void>
Defined in: lifecycle.ts:11
Returns
Section titled “Returns”Promise<void>
MotionState
Section titled “MotionState”Defined in: input/motion.ts:32
Properties
Section titled “Properties”active
Section titled “active”active:
boolean
Defined in: input/motion.ts:34
True once connected IMU data (non-zero accel or gyro) has been observed.
angularSpeed
Section titled “angularSpeed”angularSpeed:
number
Defined in: input/motion.ts:46
Instantaneous angular speed magnitude (hypot(gyro.x, gyro.y, gyro.z)).
flickDirection
Section titled “flickDirection”flickDirection:
FlickDirection
Defined in: input/motion.ts:56
Dominant direction of the latest flick ('none' when justFlicked is false).
justFlicked
Section titled “justFlicked”justFlicked:
boolean
Defined in: input/motion.ts:54
Single-frame rising edge triggered on a brisk wrist flick (casting, throwing, whipping).
linearAccelDelta
Section titled “linearAccelDelta”linearAccelDelta:
number
Defined in: input/motion.ts:48
Gravity-removed high-pass linear acceleration magnitude.
pitch:
number
Defined in: input/motion.ts:36
Calibrated pitch angle in radians (nose up positive, relative to recenter()).
pitchNorm
Section titled “pitchNorm”pitchNorm:
number
Defined in: input/motion.ts:42
Normalized pitch tilt (-1..1 at ±fullTiltRad).
roll:
number
Defined in: input/motion.ts:38
Calibrated roll angle in radians (tilted right positive, relative to recenter()).
rollNorm
Section titled “rollNorm”rollNorm:
number
Defined in: input/motion.ts:44
Normalized roll tilt (-1..1 at ±fullTiltRad).
shakeIntensity
Section titled “shakeIntensity”shakeIntensity:
number
Defined in: input/motion.ts:50
Smoothed continuous shaking energy (0..1).
shaking
Section titled “shaking”shaking:
boolean
Defined in: input/motion.ts:52
True when shakeIntensity >= shakeThreshold.
yaw:
number
Defined in: input/motion.ts:40
Integrated relative yaw angle in radians (relative to recenter()).
MotionTracker
Section titled “MotionTracker”Defined in: input/motion.ts:59
Methods
Section titled “Methods”getState()
Section titled “getState()”getState():
MotionState
Defined in: input/motion.ts:63
Returns the latest computed motion pose and gesture snapshot.
Returns
Section titled “Returns”recenter()
Section titled “recenter()”recenter():
void
Defined in: input/motion.ts:65
Zeroes the current physical controller orientation as the neutral (pitch=0, roll=0, yaw=0) pose.
Returns
Section titled “Returns”void
reset()
Section titled “reset()”reset():
void
Defined in: input/motion.ts:67
Resets all calibration offsets, filters, and gesture history.
Returns
Section titled “Returns”void
update()
Section titled “update()”update(
input,dtSec?,nowMs?):MotionState
Defined in: input/motion.ts:61
Advances the complementary filter and gesture detectors with the latest controller state.
Parameters
Section titled “Parameters”dtSec?
Section titled “dtSec?”number
nowMs?
Section titled “nowMs?”number
Returns
Section titled “Returns”MotionTrackerOptions
Section titled “MotionTrackerOptions”Defined in: input/motion.ts:5
Properties
Section titled “Properties”flickCooldownMs?
Section titled “flickCooldownMs?”
optionalflickCooldownMs?:number
Defined in: input/motion.ts:25
Minimum cooldown (ms) between consecutive justFlicked events. Default 320.
flickThreshold?
Section titled “flickThreshold?”
optionalflickThreshold?:number
Defined in: input/motion.ts:23
Combined impulse threshold triggering justFlicked. Default 0.62.
fullTiltRad?
Section titled “fullTiltRad?”
optionalfullTiltRad?:number
Defined in: input/motion.ts:21
Angle in radians mapped to pitchNorm = ±1 / rollNorm = ±1.
Default Math.PI / 4 (45 degrees).
gyroScaleRadPerSec?
Section titled “gyroScaleRadPerSec?”
optionalgyroScaleRadPerSec?:number
Defined in: input/motion.ts:16
Maps normalized input.gyro.{x,y,z} (-1..1) to radians/sec.
Default 4.5 rad/s.
gyroWeight?
Section titled “gyroWeight?”
optionalgyroWeight?:number
Defined in: input/motion.ts:11
Complementary filter weight on integrated gyroscope vs gravity accelerometer (0..1).
Higher values feel snappier with less linear-acceleration wobble; lower values self-level faster.
Default 0.94.
shakeDecay?
Section titled “shakeDecay?”
optionalshakeDecay?:number
Defined in: input/motion.ts:27
Shake energy decay rate per second. Default 2.4.
shakeThreshold?
Section titled “shakeThreshold?”
optionalshakeThreshold?:number
Defined in: input/motion.ts:29
Threshold (0..1) above which shaking is true. Default 0.35.
NoiseBurstSpec
Section titled “NoiseBurstSpec”Defined in: haptics/router.ts:46
Properties
Section titled “Properties”delayMs?
Section titled “delayMs?”
optionaldelayMs?:number
Defined in: haptics/router.ts:54
durationMs
Section titled “durationMs”durationMs:
number
Defined in: haptics/router.ts:47
endFreqHz?
Section titled “endFreqHz?”
optionalendFreqHz?:number
Defined in: haptics/router.ts:50
filterType?
Section titled “filterType?”
optionalfilterType?:BiquadFilterType
Defined in: haptics/router.ts:48
freqHz
Section titled “freqHz”freqHz:
number
Defined in: haptics/router.ts:49
intensity?
Section titled “intensity?”
optionalintensity?:number
Defined in: haptics/router.ts:52
optionalpan?:number
Defined in: haptics/router.ts:53
optionalq?:number
Defined in: haptics/router.ts:51
PlayerCapabilities
Section titled “PlayerCapabilities”Defined in: hub.ts:56
Properties
Section titled “Properties”has4ChHaptics
Section titled “has4ChHaptics”has4ChHaptics:
boolean
Defined in: hub.ts:66
hasAdaptiveTriggers
Section titled “hasAdaptiveTriggers”hasAdaptiveTriggers:
boolean
Defined in: hub.ts:62
hasControllerSpeaker
Section titled “hasControllerSpeaker”hasControllerSpeaker:
boolean
Defined in: hub.ts:67
hasDualRumble
Section titled “hasDualRumble”hasDualRumble:
boolean
Defined in: hub.ts:65
hasGyro
Section titled “hasGyro”hasGyro:
boolean
Defined in: hub.ts:68
hasHdRumble
Section titled “hasHdRumble”hasHdRumble:
boolean
Defined in: hub.ts:64
hasImpulseTriggers
Section titled “hasImpulseTriggers”hasImpulseTriggers:
boolean
Defined in: hub.ts:63
hasTouchpad
Section titled “hasTouchpad”hasTouchpad:
boolean
Defined in: hub.ts:69
identity
Section titled “identity”identity:
ControllerIdentity
Defined in: hub.ts:59
matrix
Section titled “matrix”matrix:
Record<CapabilityId,CapabilityStatus>
Defined in: hub.ts:60
slotId
Section titled “slotId”slotId:
string|null
Defined in: hub.ts:57
tier:
HardwareTier
Defined in: hub.ts:58
Methods
Section titled “Methods”has(
cap):boolean
Defined in: hub.ts:61
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
PlayerHandle
Section titled “PlayerHandle”Defined in: hub.ts:72
Extended by
Section titled “Extended by”Properties
Section titled “Properties”
readonlyaudio:object
Defined in: hub.ts:103
hasSample()
Section titled “hasSample()”hasSample(
id):boolean
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
loadSample()
Section titled “loadSample()”loadSample(
id,source):Promise<boolean>
Parameters
Section titled “Parameters”string
source
Section titled “source”Returns
Section titled “Returns”Promise<boolean>
playControllerSpeakerTone()
Section titled “playControllerSpeakerTone()”playControllerSpeakerTone(
spec):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
playPcNoise()
Section titled “playPcNoise()”playPcNoise(
opts):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
playPcTone()
Section titled “playPcTone()”playPcTone(
spec):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
playSample()
Section titled “playSample()”playSample(
id,options?):SamplePlaybackHandle
Parameters
Section titled “Parameters”string
options?
Section titled “options?”Returns
Section titled “Returns”unloadSample()
Section titled “unloadSample()”unloadSample(
id):void
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
haptics
Section titled “haptics”
readonlyhaptics:object
Defined in: hub.ts:91
createContinuous()
Section titled “createContinuous()”createContinuous(
preset):ContinuousHapticHandle
Parameters
Section titled “Parameters”preset
Section titled “preset”Returns
Section titled “Returns”hdRumble()
Section titled “hdRumble()”hdRumble(
spec):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
hdSequence()
Section titled “hdSequence()”hdSequence(
steps):void
Parameters
Section titled “Parameters”(SwitchHdRumbleSpec & object)[]
Returns
Section titled “Returns”void
playComboPreset()
Section titled “playComboPreset()”playComboPreset(
presetId,pan?):void
Parameters
Section titled “Parameters”presetId
Section titled “presetId”number
Returns
Section titled “Returns”void
playPreset()
Section titled “playPreset()”playPreset(
presetId,opts?):HapticRouteTier
Parameters
Section titled “Parameters”presetId
Section titled “presetId”intensity?
Section titled “intensity?”number
number
Returns
Section titled “Returns”pulse()
Section titled “pulse()”pulse(
spec):HapticRouteTier
Parameters
Section titled “Parameters”Returns
Section titled “Returns”rumble()
Section titled “rumble()”rumble(
opts):void
Parameters
Section titled “Parameters”durationMs
Section titled “durationMs”number
strong
Section titled “strong”number
number
Returns
Section titled “Returns”void
stop()
Section titled “stop()”stop():
void
Returns
Section titled “Returns”void
sweep()
Section titled “sweep()”sweep(
spec):HapticRouteTier
Parameters
Section titled “Parameters”Returns
Section titled “Returns”
readonlyinput:object
Defined in: hub.ts:77
applyDeadzone()
Section titled “applyDeadzone()”applyDeadzone(
value,threshold?):number
Parameters
Section titled “Parameters”number
threshold?
Section titled “threshold?”number
Returns
Section titled “Returns”number
getState()
Section titled “getState()”getState():
UnifiedInputState
Returns
Section titled “Returns”lightbar
Section titled “lightbar”
readonlylightbar:object
Defined in: hub.ts:113
flash()
Section titled “flash()”flash(
r,g,b,durationMs?):void
Parameters
Section titled “Parameters”number
number
number
durationMs?
Section titled “durationMs?”number
Returns
Section titled “Returns”void
setColor()
Section titled “setColor()”setColor(
r,g,b):void
Parameters
Section titled “Parameters”number
number
number
Returns
Section titled “Returns”void
triggers
Section titled “triggers”
readonlytriggers:object
Defined in: hub.ts:82
applyPreset()
Section titled “applyPreset()”applyPreset(
presetId,side?):void
Parameters
Section titled “Parameters”presetId
Section titled “presetId”"both" | "left" | "right"
Returns
Section titled “Returns”void
pulseImpulse()
Section titled “pulseImpulse()”pulseImpulse(
spec):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
reset()
Section titled “reset()”reset():
void
Returns
Section titled “Returns”void
setBoth()
Section titled “setBoth()”setBoth(
left,right):void
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
setLeft()
Section titled “setLeft()”setLeft(
effect):void
Parameters
Section titled “Parameters”effect
Section titled “effect”Returns
Section titled “Returns”void
setRight()
Section titled “setRight()”setRight(
effect):void
Parameters
Section titled “Parameters”effect
Section titled “effect”Returns
Section titled “Returns”void
Methods
Section titled “Methods”createActions()
Section titled “createActions()”createActions<
TActions,TAxes>(spec):ActionTracker<TActions,TAxes>
Defined in: hub.ts:119
Creates a semantic Action Map tracker scoped to this hub’s disposal lifecycle.
Type Parameters
Section titled “Type Parameters”TActions
Section titled “TActions”TActions extends string = string
TAxes extends string = string
Parameters
Section titled “Parameters”ActionMapSpec<TActions, TAxes>
Returns
Section titled “Returns”ActionTracker<TActions, TAxes>
getCapabilities()
Section titled “getCapabilities()”getCapabilities():
PlayerCapabilities
Defined in: hub.ts:75
Returns
Section titled “Returns”getSlotId()
Section titled “getSlotId()”getSlotId():
string|null
Defined in: hub.ts:74
Resolves the current physical slot ID bound to this handle, or null if disconnected.
Returns
Section titled “Returns”string | null
PlaySampleOptions
Section titled “PlaySampleOptions”Defined in: haptics/samples.ts:22
Properties
Section titled “Properties”delayMs?
Section titled “delayMs?”
optionaldelayMs?:number
Defined in: haptics/samples.ts:41
Optional start delay in milliseconds. Default 0.
fallbackHaptic?
Section titled “fallbackHaptic?”
optionalfallbackHaptic?:object
Defined in: haptics/samples.ts:46
Optional cross-brand fallback tactile pulse used by PlayerHandle when route is 'vcm'
or 'quad' on non-4ch hardware (Switch Pro HD Rumble, Xbox Impulse Triggers, standard rumble).
durationMs?
Section titled “durationMs?”
optionaldurationMs?:number
freqHz?
Section titled “freqHz?”
optionalfreqHz?:number
intensity?
Section titled “intensity?”
optionalintensity?:number
optionalgain?:number
Defined in: haptics/samples.ts:35
Playback gain 0..1.5. Default 0.85.
optionalloop?:boolean
Defined in: haptics/samples.ts:39
Loop continuously until .stop() is called. Default false.
optionalpan?:number
Defined in: haptics/samples.ts:33
Stereo pan -1 (left) .. +1 (right). Default 0.
playbackRate?
Section titled “playbackRate?”
optionalplaybackRate?:number
Defined in: haptics/samples.ts:37
Playback rate 0.25..4.0 (modulate pitch/texture with movement speed). Default 1.0.
route?
Section titled “route?”
optionalroute?:SampleRoute
Defined in: haptics/samples.ts:31
Output bus routing:
'pc'— PC speakers / headphones (stereo panned)'speaker'— DualSense built-in controller speaker Ch0+Ch1 (falls back to PC if unbound)'vcm'— DualSense L/R voice-coil actuators Ch2+Ch3 (falls back via cross-brand haptics router)'quad'— Synchronized 4-channel playback: Ch0/1 -> Controller Speaker, Ch2/3 -> L/R VCM Default'pc'.
RawPcmSample
Section titled “RawPcmSample”Defined in: haptics/samples.ts:8
Properties
Section titled “Properties”channels
Section titled “channels”channels:
Float32Array<ArrayBufferLike>[]
Defined in: haptics/samples.ts:17
Channel PCM arrays (-1..1 float samples):
- 1 channel: mono
- 2 channels: stereo
[left, right] - 4 channels (for
route: 'quad'):[speakerL, speakerR, vcmLeft, vcmRight]
sampleRate
Section titled “sampleRate”sampleRate:
number
Defined in: haptics/samples.ts:10
Sample rate in Hz (48000 recommended for DualSense 4-channel VCM fidelity).
SampleAudioSink
Section titled “SampleAudioSink”Defined in: haptics/router.ts:84
Structural 4-channel sample playback sink satisfied by SampleBank and LinkAudioEngine.
Methods
Section titled “Methods”hasSample()
Section titled “hasSample()”hasSample(
id):boolean
Defined in: haptics/router.ts:86
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
loadSample()
Section titled “loadSample()”loadSample(
id,source):Promise<boolean>
Defined in: haptics/router.ts:85
Parameters
Section titled “Parameters”string
source
Section titled “source”Returns
Section titled “Returns”Promise<boolean>
playSample()
Section titled “playSample()”playSample(
id,options?):SamplePlaybackHandle
Defined in: haptics/router.ts:88
Parameters
Section titled “Parameters”string
options?
Section titled “options?”Returns
Section titled “Returns”unloadSample()
Section titled “unloadSample()”unloadSample(
id):void
Defined in: haptics/router.ts:87
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
SamplePlaybackHandle
Section titled “SamplePlaybackHandle”Defined in: haptics/samples.ts:53
Properties
Section titled “Properties”active
Section titled “active”
readonlyactive:boolean
Defined in: haptics/samples.ts:59
True while the sample node is still active.
Methods
Section titled “Methods”stop()
Section titled “stop()”stop(
fadeOutMs?):void
Defined in: haptics/samples.ts:57
Stops playback cleanly, with an optional smooth fade-out in milliseconds.
Parameters
Section titled “Parameters”fadeOutMs?
Section titled “fadeOutMs?”number
Returns
Section titled “Returns”void
update()
Section titled “update()”update(
params):void
Defined in: haptics/samples.ts:55
Dynamically modulates an active (especially looping) sample’s pan, gain, or playback rate.
Parameters
Section titled “Parameters”params
Section titled “params”number
number
playbackRate?
Section titled “playbackRate?”number
Returns
Section titled “Returns”void
SecondFingerState
Section titled “SecondFingerState”Defined in: input/touchpad.ts:20
Properties
Section titled “Properties”active
Section titled “active”active:
boolean
Defined in: input/touchpad.ts:21
dx:
number
Defined in: input/touchpad.ts:26
dy:
number
Defined in: input/touchpad.ts:27
justReleased
Section titled “justReleased”justReleased:
boolean
Defined in: input/touchpad.ts:23
justTouched
Section titled “justTouched”justTouched:
boolean
Defined in: input/touchpad.ts:22
x:
number
Defined in: input/touchpad.ts:24
y:
number
Defined in: input/touchpad.ts:25
SlotActivityResult
Section titled “SlotActivityResult”Defined in: input/slotSwitcher.ts:12
Properties
Section titled “Properties”switchTo
Section titled “switchTo”switchTo:
string|null
Defined in: input/slotSwitcher.ts:14
Non-null when an inactive controller was intentionally operated and should become active.
triggeredSlotId
Section titled “triggeredSlotId”triggeredSlotId:
string|null
Defined in: input/slotSwitcher.ts:16
Non-null whenever any controller (active or inactive) received intentional fresh input.
SlotMotionSample
Section titled “SlotMotionSample”Defined in: input/slotSwitcher.ts:1
Properties
Section titled “Properties”id:
string
Defined in: input/slotSwitcher.ts:2
l2:
number
Defined in: input/slotSwitcher.ts:8
lastActivityAt
Section titled “lastActivityAt”lastActivityAt:
number
Defined in: input/slotSwitcher.ts:3
lx:
number
Defined in: input/slotSwitcher.ts:4
ly:
number
Defined in: input/slotSwitcher.ts:5
r2:
number
Defined in: input/slotSwitcher.ts:9
rx:
number
Defined in: input/slotSwitcher.ts:6
ry:
number
Defined in: input/slotSwitcher.ts:7
SwitchHdRumbleSide
Section titled “SwitchHdRumbleSide”Defined in: hid/index.ts:223
Properties
Section titled “Properties”highAmp
Section titled “highAmp”highAmp:
number
Defined in: hid/index.ts:227
High-band amplitude (0.0 - 1.0, safely clamped at 0.85 to protect LRAs)
highFreqHz
Section titled “highFreqHz”highFreqHz:
number
Defined in: hid/index.ts:225
High-band frequency in Hz (81.75 - 1252.6 Hz, default 320 Hz)
lowAmp
Section titled “lowAmp”lowAmp:
number
Defined in: hid/index.ts:231
Low-band amplitude (0.0 - 1.0, safely clamped at 0.85 to protect LRAs)
lowFreqHz
Section titled “lowFreqHz”lowFreqHz:
number
Defined in: hid/index.ts:229
Low-band frequency in Hz (40.88 - 626.3 Hz, default 160 Hz)
SwitchHdRumbleSpec
Section titled “SwitchHdRumbleSpec”Defined in: hid/index.ts:234
Properties
Section titled “Properties”durationMs?
Section titled “durationMs?”
optionaldurationMs?:number
Defined in: hid/index.ts:238
Auto-stop duration in ms (default 220, clamped 30..2500)
optionalleft?:SwitchHdRumbleSide
Defined in: hid/index.ts:235
right?
Section titled “right?”
optionalright?:SwitchHdRumbleSide
Defined in: hid/index.ts:236
TactilePresetSpec
Section titled “TactilePresetSpec”Defined in: haptics/presets.ts:36
Properties
Section titled “Properties”durationMs
Section titled “durationMs”durationMs:
number
Defined in: haptics/presets.ts:39
endFreqHz?
Section titled “endFreqHz?”
optionalendFreqHz?:number
Defined in: haptics/presets.ts:38
freqHz
Section titled “freqHz”freqHz:
number
Defined in: haptics/presets.ts:37
intensity
Section titled “intensity”intensity:
number
Defined in: haptics/presets.ts:40
switchHd?
Section titled “switchHd?”
optionalswitchHd?:object
Defined in: haptics/presets.ts:45
Optional Switch Pro dual-band fine tuning
highFreqHz
Section titled “highFreqHz”highFreqHz:
number
highWeight
Section titled “highWeight”highWeight:
number
lowFreqHz
Section titled “lowFreqHz”lowFreqHz:
number
lowWeight
Section titled “lowWeight”lowWeight:
number
triggerEmphasis?
Section titled “triggerEmphasis?”
optionaltriggerEmphasis?:number
Defined in: haptics/presets.ts:43
Optional Xbox impulse trigger emphasis (0..1)
optionalwave?:OscillatorType
Defined in: haptics/presets.ts:41
ToneSpec
Section titled “ToneSpec”Defined in: haptics/router.ts:36
Properties
Section titled “Properties”delayMs?
Section titled “delayMs?”
optionaldelayMs?:number
Defined in: haptics/router.ts:43
durationMs
Section titled “durationMs”durationMs:
number
Defined in: haptics/router.ts:39
endFreqHz?
Section titled “endFreqHz?”
optionalendFreqHz?:number
Defined in: haptics/router.ts:38
freqHz
Section titled “freqHz”freqHz:
number
Defined in: haptics/router.ts:37
intensity?
Section titled “intensity?”
optionalintensity?:number
Defined in: haptics/router.ts:40
optionalpan?:number
Defined in: haptics/router.ts:41
optionalwave?:OscillatorType
Defined in: haptics/router.ts:42
TouchFinger
Section titled “TouchFinger”Defined in: hid/index.ts:123
Properties
Section titled “Properties”active
Section titled “active”active:
boolean
Defined in: hid/index.ts:124
x:
number
Defined in: hid/index.ts:125
y:
number
Defined in: hid/index.ts:126
TouchpadGestureOptions
Section titled “TouchpadGestureOptions”Defined in: input/touchpad.ts:5
Properties
Section titled “Properties”doubleTapWindowMs?
Section titled “doubleTapWindowMs?”
optionaldoubleTapWindowMs?:number
Defined in: input/touchpad.ts:11
Max gap (ms) between two taps to trigger justDoubleTapped. Default 320.
swipeMinDistance?
Section titled “swipeMinDistance?”
optionalswipeMinDistance?:number
Defined in: input/touchpad.ts:15
Minimum total displacement required for justSwiped. Default 0.12.
swipeMinSpeed?
Section titled “swipeMinSpeed?”
optionalswipeMinSpeed?:number
Defined in: input/touchpad.ts:13
Minimum release velocity (normalized units/sec) to trigger justSwiped. Default 1.15.
tapMaxMove?
Section titled “tapMaxMove?”
optionaltapMaxMove?:number
Defined in: input/touchpad.ts:9
Max total displacement (normalized 0..1) to classify as a tap. Default 0.06.
tapMaxMs?
Section titled “tapMaxMs?”
optionaltapMaxMs?:number
Defined in: input/touchpad.ts:7
Max contact duration (ms) to classify as a tap. Default 240.
velocitySmoothing?
Section titled “velocitySmoothing?”
optionalvelocitySmoothing?:number
Defined in: input/touchpad.ts:17
EMA smoothing factor (0..1) for velocity (vx, vy). Default 0.45.
TouchpadGestureState
Section titled “TouchpadGestureState”Defined in: input/touchpad.ts:30
Properties
Section titled “Properties”active
Section titled “active”active:
boolean
Defined in: input/touchpad.ts:34
True while primary finger 1 is contacting the touchpad.
clicked
Section titled “clicked”clicked:
boolean
Defined in: input/touchpad.ts:78
Physical touchpad press button (input.buttons.touchpadClick).
dx:
number
Defined in: input/touchpad.ts:44
Per-frame primary finger X delta.
dy:
number
Defined in: input/touchpad.ts:46
Per-frame primary finger Y delta.
fingerCount
Section titled “fingerCount”fingerCount:
0|1|2
Defined in: input/touchpad.ts:32
Number of active fingers on the touchpad (0, 1, or 2).
justClicked
Section titled “justClicked”justClicked:
boolean
Defined in: input/touchpad.ts:80
Single-frame rising edge on physical touchpad click.
justDoubleTapped
Section titled “justDoubleTapped”justDoubleTapped:
boolean
Defined in: input/touchpad.ts:60
Single-frame edge fired when two quick taps land within doubleTapWindowMs.
justReleased
Section titled “justReleased”justReleased:
boolean
Defined in: input/touchpad.ts:42
Falling edge on primary finger lift.
justSwiped
Section titled “justSwiped”justSwiped:
boolean
Defined in: input/touchpad.ts:64
Single-frame edge fired when a brisk swipe completes on release.
justTapped
Section titled “justTapped”justTapped:
boolean
Defined in: input/touchpad.ts:58
Single-frame edge fired on a quick single-finger tap.
justTouched
Section titled “justTouched”justTouched:
boolean
Defined in: input/touchpad.ts:40
Rising edge on primary finger contact.
justTwoFingerTapped
Section titled “justTwoFingerTapped”justTwoFingerTapped:
boolean
Defined in: input/touchpad.ts:62
Single-frame edge fired on a quick two-finger tap.
pinchActive
Section titled “pinchActive”pinchActive:
boolean
Defined in: input/touchpad.ts:68
True while both fingers are touching simultaneously.
pinchDelta
Section titled “pinchDelta”pinchDelta:
number
Defined in: input/touchpad.ts:72
Per-frame change in pinchDistance (>0 spreading apart, <0 pinching together).
pinchDistance
Section titled “pinchDistance”pinchDistance:
number
Defined in: input/touchpad.ts:70
Current Euclidean distance between finger 1 and finger 2 (normalized).
pinchScale
Section titled “pinchScale”pinchScale:
number
Defined in: input/touchpad.ts:74
Relative pinch ratio (1.0 at two-finger touch start).
secondFinger
Section titled “secondFinger”secondFinger:
SecondFingerState
Defined in: input/touchpad.ts:76
Independent state for the second finger (input.touch2).
speed:
number
Defined in: input/touchpad.ts:56
Smoothed primary finger speed (hypot(vx, vy)).
swipeDirection
Section titled “swipeDirection”swipeDirection:
SwipeDirection
Defined in: input/touchpad.ts:66
Dominant direction of the latest swipe ('none' when justSwiped is false).
totalDx
Section titled “totalDx”totalDx:
number
Defined in: input/touchpad.ts:48
Total X displacement since primary touch began.
totalDy
Section titled “totalDy”totalDy:
number
Defined in: input/touchpad.ts:50
Total Y displacement since primary touch began.
vx:
number
Defined in: input/touchpad.ts:52
Smoothed primary finger horizontal velocity (normalized units/sec).
vy:
number
Defined in: input/touchpad.ts:54
Smoothed primary finger vertical velocity (normalized units/sec).
x:
number
Defined in: input/touchpad.ts:36
Primary finger X (0..1, left to right).
y:
number
Defined in: input/touchpad.ts:38
Primary finger Y (0..1, top to bottom).
TouchpadGestureTracker
Section titled “TouchpadGestureTracker”Defined in: input/touchpad.ts:83
Methods
Section titled “Methods”getState()
Section titled “getState()”getState():
TouchpadGestureState
Defined in: input/touchpad.ts:87
Returns the latest gesture snapshot.
Returns
Section titled “Returns”reset()
Section titled “reset()”reset():
void
Defined in: input/touchpad.ts:89
Clears all active touch, velocity, and tap history.
Returns
Section titled “Returns”void
update()
Section titled “update()”update(
input,dtSec?,nowMs?):TouchpadGestureState
Defined in: input/touchpad.ts:85
Updates gesture recognition from the latest UnifiedInputState.
Parameters
Section titled “Parameters”dtSec?
Section titled “dtSec?”number
nowMs?
Section titled “nowMs?”number
Returns
Section titled “Returns”TriggerApplyResult
Section titled “TriggerApplyResult”Defined in: haptics/triggerWrites.ts:10
Properties
Section titled “Properties”hadActiveBefore
Section titled “hadActiveBefore”hadActiveBefore:
boolean
Defined in: haptics/triggerWrites.ts:14
hadActiveTargetBefore
Section titled “hadActiveTargetBefore”hadActiveTargetBefore:
boolean
Defined in: haptics/triggerWrites.ts:15
leftPreset
Section titled “leftPreset”leftPreset:
string
Defined in: haptics/triggerWrites.ts:16
needsReset
Section titled “needsReset”needsReset:
boolean
Defined in: haptics/triggerWrites.ts:18
ok:
boolean
Defined in: haptics/triggerWrites.ts:11
rightPreset
Section titled “rightPreset”rightPreset:
string
Defined in: haptics/triggerWrites.ts:17
stale:
boolean
Defined in: haptics/triggerWrites.ts:12
unmounted
Section titled “unmounted”unmounted:
boolean
Defined in: haptics/triggerWrites.ts:13
TriggerHidAdapter
Section titled “TriggerHidAdapter”Defined in: haptics/triggerWrites.ts:5
Methods
Section titled “Methods”resetTriggers()
Section titled “resetTriggers()”resetTriggers():
Promise<boolean>
Defined in: haptics/triggerWrites.ts:7
Returns
Section titled “Returns”Promise<boolean>
setTriggers()
Section titled “setTriggers()”setTriggers(
left?,right?):Promise<boolean>
Defined in: haptics/triggerWrites.ts:6
Parameters
Section titled “Parameters”right?
Section titled “right?”Returns
Section titled “Returns”Promise<boolean>
UnifiedInputState
Section titled “UnifiedInputState”Defined in: hid/index.ts:170
Properties
Section titled “Properties”accel:
object
Defined in: hid/index.ts:193
x:
number
y:
number
z:
number
battery
Section titled “battery”battery:
BatteryStatus
Defined in: hid/index.ts:198
buttons
Section titled “buttons”buttons:
Record<ButtonName,boolean>
Defined in: hid/index.ts:185
connected
Section titled “connected”connected:
boolean
Defined in: hid/index.ts:171
deviceName
Section titled “deviceName”deviceName:
string
Defined in: hid/index.ts:175
gyro:
object
Defined in: hid/index.ts:188
x:
number
y:
number
z:
number
identity
Section titled “identity”identity:
ControllerIdentity
Defined in: hid/index.ts:177
isDualSense
Section titled “isDualSense”isDualSense:
boolean
Defined in: hid/index.ts:176
l2:
number
Defined in: hid/index.ts:183
lx:
number
Defined in: hid/index.ts:179
Raw un-deadzoned axes (-1..1). Use applyDeadzone() in games if smoothing is desired.
ly:
number
Defined in: hid/index.ts:180
mapping
Section titled “mapping”mapping:
InputMapping
Defined in: hid/index.ts:174
How buttons/axes were mapped for this snapshot (see InputMapping).
observedReportHz
Section titled “observedReportHz”observedReportHz:
number|null
Defined in: hid/index.ts:200
Browser-observed WebHID inputreport frequency (Hz). Null when not streaming WebHID.
r2:
number
Defined in: hid/index.ts:184
rx:
number
Defined in: hid/index.ts:181
ry:
number
Defined in: hid/index.ts:182
source
Section titled “source”source:
"none"|"webhid"|"gamepad"|"keyboard_mouse"
Defined in: hid/index.ts:172
touch:
TouchFinger
Defined in: hid/index.ts:186
touch2
Section titled “touch2”touch2:
TouchFinger
Defined in: hid/index.ts:187
Type Aliases
Section titled “Type Aliases”ActionBinding
Section titled “ActionBinding”ActionBinding =
ButtonInput|TriggerBinding|StickDirectionBinding|MouseButtonBinding|string&object
Defined in: input/actions.ts:16
Any binding accepted in a digital action array:
- Controller buttons (
'cross','r1','up', …) or position-based aliases ('south','east','start', …) - Analog triggers (
'l2','r2') - Stick directions (
'lx+','lx-','ly+','ly-','rx+','rx-','ry+','ry-') - Mouse buttons (
'MouseLeft','MouseRight','MouseMiddle') - Keyboard
KeyboardEvent.codestrings ('Space','KeyW','ArrowUp','ShiftLeft', …)
AudioRouteMode
Section titled “AudioRouteMode”AudioRouteMode =
"speaker"|"headphone"|"both"
Defined in: hid/index.ts:18
ButtonAlias
Section titled “ButtonAlias”ButtonAlias =
"south"|"east"|"west"|"north"|"select"|"start"|"home"
Defined in: input/buttons.ts:7
Brand-neutral, position-based button names (the SDL / Unity Input System convention).
south is the bottom face button on every controller: Xbox A, PlayStation Cross, Nintendo B.
ButtonInput
Section titled “ButtonInput”ButtonInput =
ButtonName|ButtonAlias
Defined in: input/buttons.ts:10
Any button name accepted by action maps and the key/mouse bridge.
ButtonName
Section titled “ButtonName”ButtonName =
"cross"|"circle"|"square"|"triangle"|"l1"|"r1"|"l2Btn"|"r2Btn"|"l3"|"r3"|"up"|"down"|"left"|"right"|"create"|"options"|"ps"|"touchpadClick"|"mute"|"fnL"|"fnR"|"paddleL"|"paddleR"
Defined in: hid/index.ts:84
CapabilityAvailability
Section titled “CapabilityAvailability”CapabilityAvailability =
"ready"|"permission_required"|"bridge_required"|"configuration_required"|"unsupported"|"unknown"|"disconnected"|"busy"
Defined in: hid/index.ts:49
CapabilityId
Section titled “CapabilityId”CapabilityId =
"standard_input"|"analog_triggers"|"dual_motor_rumble"|"impulse_triggers"|"hd_rumble"|"adaptive_triggers"|"audio_haptics"|"controller_speaker"|"gyro"|"accelerometer"|"touchpad"|"lightbar"|"battery"
Defined in: hid/index.ts:34
ComboPresetId
Section titled “ComboPresetId”ComboPresetId =
"ratchet_tick"|"lock_sweet_spot"|"lock_unlock"|"fish_bite"|"fish_splash"|"pistol"|"shotgun"|"bow_release"|"thunder"
Defined in: haptics/router.ts:64
ContinuousPreset
Section titled “ContinuousPreset”ContinuousPreset =
"ice"|"metal"|"gravel"|"grass"|"water"|"engine"|"tension"
Defined in: haptics/router.ts:57
ControllerBrand
Section titled “ControllerBrand”ControllerBrand =
"sony"|"xbox"|"nintendo"|"generic"|"none"
Defined in: hid/index.ts:20
ControllerLifecycleReason
Section titled “ControllerLifecycleReason”ControllerLifecycleReason =
"status"|"gamepad"|"poll"
Defined in: lifecycle.ts:14
ControllerModel
Section titled “ControllerModel”ControllerModel =
"dualsense"|"dualsense_edge"|"dualshock4"|"xbox_series"|"xbox_one"|"xbox_360"|"switch_pro"|"switch2_pro"|"joycon"|"generic"|"none"
Defined in: hid/index.ts:21
FlickDirection
Section titled “FlickDirection”FlickDirection =
"none"|"up"|"down"|"left"|"right"
Defined in: input/motion.ts:3
GamepadAxisSource
Section titled “GamepadAxisSource”GamepadAxisSource =
number| {index:number;invert?:boolean; }
Defined in: hid/index.ts:140
Raw axis source for a remapped stick axis.
GamepadTriggerSource
Section titled “GamepadTriggerSource”GamepadTriggerSource = {
button:number; } | {axis:number;range?:"signed"|"unsigned"; }
Defined in: hid/index.ts:143
Raw source for a remapped analog trigger (0..1).
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ button: number; }
Type Literal
Section titled “Type Literal”{ axis: number; range?: "signed" | "unsigned"; }
range: 'signed' (default) treats -1 as released and 1 as fully pressed; 'unsigned' reads 0..1.
HapticRouteTier
Section titled “HapticRouteTier”HapticRouteTier =
"4ch_vcm"|"hd_rumble"|"impulse_triggers"|"dual_rumble"|"none"
Defined in: haptics/router.ts:115
HardwareTier
Section titled “HardwareTier”HardwareTier =
"dualsense_full_4ch"|"dualsense_hid_only"|"switch_pro_hid"|"xbox_impulse"|"standard_gamepad"|"keyboard_mouse"
Defined in: hub.ts:48
InputMapping
Section titled “InputMapping”InputMapping =
"standard"|"nonstandard"|"custom"|"hid"|"none"
Defined in: hid/index.ts:137
How the active input snapshot’s buttons and axes were mapped.
standard: browser reports the W3C “standard” Gamepad layout (indices are reliable)nonstandard: browser reportsmapping === ''; indices are read as if standard and may be misnamedcustom: aGamepadMappingRulematched this pad and remapped ithid: decoded directly from WebHID reports (always correct)none: keyboard/mouse fallback or disconnected
MouseButtonBinding
Section titled “MouseButtonBinding”MouseButtonBinding =
"MouseLeft"|"MouseRight"|"MouseMiddle"
Defined in: input/actions.ts:6
MuteLedMode
Section titled “MuteLedMode”MuteLedMode =
"off"|"on"|"pulse"
Defined in: hid/index.ts:19
SampleRoute
Section titled “SampleRoute”SampleRoute =
"pc"|"speaker"|"vcm"|"quad"
Defined in: haptics/samples.ts:6
Sample-driven audio & 4-channel VCM haptics types + procedural PCM tactile buffer builder.
Pure TypeScript with zero Web Audio dependency so core @gamepadly/sdk stays headless & tree-shakable.
SampleSource
Section titled “SampleSource”SampleSource =
string|ArrayBuffer|RawPcmSample
Defined in: haptics/samples.ts:20
StickDirectionBinding
Section titled “StickDirectionBinding”StickDirectionBinding =
"lx+"|"lx-"|"ly+"|"ly-"|"rx+"|"rx-"|"ry+"|"ry-"
Defined in: input/actions.ts:4
SwipeDirection
Section titled “SwipeDirection”SwipeDirection =
"none"|"up"|"down"|"left"|"right"
Defined in: input/touchpad.ts:3
TactileBufferPreset
Section titled “TactileBufferPreset”TactileBufferPreset =
"footstep_ice"|"footstep_metal"|"footstep_gravel"|"footstep_water"|"zipper_tick"|"spring_boing"|"engine_hum"
Defined in: haptics/samples.ts:70
TactilePresetId
Section titled “TactilePresetId”TactilePresetId =
"click"|"ratchet"|"wall_hit"|"marble_click"|"recoil"|"heavy_impact"|"lock_unlock"|"splash"|"boost"|"error_buzz"
Defined in: haptics/presets.ts:24
TransportType
Section titled “TransportType”TransportType =
"usb"|"bluetooth"|"unknown"|"disconnected"
Defined in: hid/index.ts:17
@gamepadly/sdk — Cross-Brand Controller Protocol & Capability Layer
Key guarantees:
- ZERO hidden deadzone on raw analog axes (micro-drift is never masked in diagnostics)
- Complete 18-button standard mapping (including L3/R3/Create/Options/Home/Touchpad)
- Multi-controller slot addressing (P1–P4) across WebHID + Gamepad API
- Native Xbox Series Impulse Triggers (
trigger-rumblein Chrome/Edge 126+, zero install) - Sony DualSense (0x054C:0x0CE6) & DualSense Edge (0x054C:0x0DF2) via WebHID (USB 0x02 & BT 0x31 CRC32)
- Official 10-zone Adaptive Triggers (works over BOTH USB & Bluetooth, zero companion needed!)
- 6-axis Gyro/Accel, dual-finger Touchpad, Battery, RGB Lightbar, read-only firmware metadata
- Speaker amplifier unlock for optional 4ch USB audio workflows
- Nintendo Switch Pro (0x057E:0x2009) via WebHID: dual-band LRA HD Rumble, 6-axis Gyro/Accel, read-only SPI calibration
- SSR-safe (never crashes when
window/navigatorare unavailable during static prerendering)
TriggerBinding
Section titled “TriggerBinding”TriggerBinding =
"l2"|"r2"
Defined in: input/actions.ts:5
TriggerEffectSpec
Section titled “TriggerEffectSpec”TriggerEffectSpec = {
type:"off"; } | {startZone:number;strength:number;type:"feedback"; } | {endStrength:number;endZone:number;startStrength:number;startZone:number;type:"slope"; } | {endZone:number;startZone:number;strength:number;type:"weapon"; } | {amplitude:number;frequencyHz:number;startZone:number;type:"vibration"; }
Defined in: hid/index.ts:109
TriggerPresetId
Section titled “TriggerPresetId”TriggerPresetId =
"off"|"weapon"|"heavy_weapon"|"bow"|"abs"|"soft_wall"|"rapid_pulse"|"precision_damp"
Defined in: haptics/presets.ts:3
TriggerWriteTarget
Section titled “TriggerWriteTarget”TriggerWriteTarget =
"both"|"left"|"right"
Defined in: haptics/triggerWrites.ts:3
Variables
Section titled “Variables”BUTTON_ALIASES
Section titled “BUTTON_ALIASES”
constBUTTON_ALIASES:Readonly<Record<ButtonAlias,ButtonName>>
Defined in: input/buttons.ts:13
Position-based alias → SDK button name. SDK names follow the physical position, not the printed label.
DEFAULT_DUALSENSE_SPEAKER_PREAMP
Section titled “DEFAULT_DUALSENSE_SPEAKER_PREAMP”
constDEFAULT_DUALSENSE_SPEAKER_PREAMP:5=5
Defined in: hid/index.ts:631
Balanced DualSense built-in speaker hardware preamp (0..7; 5 stays crisp without harsh clipping).
DEFAULT_DUALSENSE_SPEAKER_VOLUME
Section titled “DEFAULT_DUALSENSE_SPEAKER_VOLUME”
constDEFAULT_DUALSENSE_SPEAKER_VOLUME:88=0x58
Defined in: hid/index.ts:629
Balanced DualSense built-in speaker volume (inside official 0x3D..0x64 audible span).
NOOP_SAMPLE_HANDLE
Section titled “NOOP_SAMPLE_HANDLE”
constNOOP_SAMPLE_HANDLE:SamplePlaybackHandle
Defined in: haptics/samples.ts:62
TACTILE_PRESETS
Section titled “TACTILE_PRESETS”
constTACTILE_PRESETS:Record<TactilePresetId,TactilePresetSpec>
Defined in: haptics/presets.ts:53
TRIGGER_PRESETS
Section titled “TRIGGER_PRESETS”
constTRIGGER_PRESETS:Record<TriggerPresetId,TriggerEffectSpec>
Defined in: haptics/presets.ts:13
Functions
Section titled “Functions”applyDeadzone()
Section titled “applyDeadzone()”applyDeadzone(
value,threshold?):number
Defined in: hid/index.ts:302
Parameters
Section titled “Parameters”number
threshold?
Section titled “threshold?”number = 0.06
Returns
Section titled “Returns”number
attachControllerLifecycle()
Section titled “attachControllerLifecycle()”attachControllerLifecycle(
hid,options?): () =>void
Defined in: lifecycle.ts:40
Wires the lifecycle and returns an idempotent cleanup function. Safe to call during SSR (no-op).
Parameters
Section titled “Parameters”options?
Section titled “options?”ControllerLifecycleOptions = {}
Returns
Section titled “Returns”() => void
buildSwitchHdFromPulse()
Section titled “buildSwitchHdFromPulse()”buildSwitchHdFromPulse(
opts):SwitchHdRumbleSpec
Defined in: haptics/presets.ts:149
Helper to build a Switch Pro stereo HD Rumble frame from pan (-1..+1), frequency, and intensity (0..1).
Parameters
Section titled “Parameters”durationMs
Section titled “durationMs”number
freqHz
Section titled “freqHz”number
highFreqHz?
Section titled “highFreqHz?”number
highWeight?
Section titled “highWeight?”number
intensity
Section titled “intensity”number
lowFreqHz?
Section titled “lowFreqHz?”number
lowWeight?
Section titled “lowWeight?”number
number
Returns
Section titled “Returns”crc32WithSeed()
Section titled “crc32WithSeed()”crc32WithSeed(
seedByte,reportId,bytes):number
Defined in: hid/index.ts:402
CRC-32 (zlib polynomial) over [seedByte, reportId, ...bytes], as appended to DualSense Bluetooth output reports.
Parameters
Section titled “Parameters”seedByte
Section titled “seedByte”number
reportId
Section titled “reportId”number
Uint8Array
Returns
Section titled “Returns”number
createActionTracker()
Section titled “createActionTracker()”createActionTracker<
TActions,TAxes>(spec):ActionTracker<TActions,TAxes>
Defined in: input/actions.ts:232
Type Parameters
Section titled “Type Parameters”TActions
Section titled “TActions”TActions extends string = string
TAxes extends string = string
Parameters
Section titled “Parameters”ActionMapSpec<TActions, TAxes>
Returns
Section titled “Returns”ActionTracker<TActions, TAxes>
createEmptyInput()
Section titled “createEmptyInput()”createEmptyInput():
UnifiedInputState
Defined in: hid/index.ts:489
Returns
Section titled “Returns”createGamepadly()
Section titled “createGamepadly()”createGamepadly(
options?):GamepadlyHub
Defined in: hub.ts:272
Parameters
Section titled “Parameters”options?
Section titled “options?”GamepadlyHubOptions = {}
Returns
Section titled “Returns”createMotionTracker()
Section titled “createMotionTracker()”createMotionTracker(
options?):MotionTracker
Defined in: input/motion.ts:78
Fuses canonical 6-axis gyroscope + accelerometer readings (PS5 DualSense / Switch Pro)
into drift-compensated pitch / roll / yaw angles plus ready-to-use shake and flick gestures.
Parameters
Section titled “Parameters”options?
Section titled “options?”MotionTrackerOptions = {}
Returns
Section titled “Returns”createTactileBuffer()
Section titled “createTactileBuffer()”createTactileBuffer(
preset,sampleRate?):RawPcmSample
Defined in: haptics/samples.ts:96
Generates deterministic 48 kHz 4-channel quad PCM tactile samples ([spkL, spkR, vcmL, vcmR])
with synchronized near-field speaker transients (Ch0/1) and voice-coil waveforms (Ch2/3).
Ideal for prototyping Astro-style surface footsteps, zipper ticks, and springs with zero external assets.
Parameters
Section titled “Parameters”preset
Section titled “preset”sampleRate?
Section titled “sampleRate?”number = 48000
Returns
Section titled “Returns”createTouchpadGestures()
Section titled “createTouchpadGestures()”createTouchpadGestures(
options?):TouchpadGestureTracker
Defined in: input/touchpad.ts:101
Turns raw DualSense dual-finger touchpad coordinates (input.touch / input.touch2)
into game-ready gestures: drag deltas, smoothed swipe velocity (for ball rolling / sliders),
single/double/two-finger taps, directional swipes, and two-finger pinch scale.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”encodeSwitchHdRumbleSide()
Section titled “encodeSwitchHdRumbleSide()”encodeSwitchHdRumbleSide(
side?):Uint8Array
Defined in: hid/index.ts:273
Encodes one side (Left or Right LRA) of Nintendo Switch Pro HD Rumble into the 4-byte HID payload.
Returns neutral off [0x00, 0x01, 0x40, 0x40] when both band amplitudes are silent.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Uint8Array
encodeTriggerEffect()
Section titled “encodeTriggerEffect()”encodeTriggerEffect(
spec):Uint8Array
Defined in: hid/index.ts:412
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Uint8Array
getButtonLabel()
Section titled “getButtonLabel()”getButtonLabel(
button,brand):string
Defined in: input/buttons.ts:68
Human-readable label for on-screen prompts, matching what is printed on the player’s controller.
Generic and unknown controllers use the Xbox-style labels most PC pads print (A/B/X/Y).
Plain text only: render your own icons if you want glyphs. Also accepts 'l2' / 'r2'; any other
string, such as a stick direction or a key code, is returned unchanged.
Parameters
Section titled “Parameters”button
Section titled “button”"l2" | "r2" | ButtonInput | string & object
Returns
Section titled “Returns”string
Example
Section titled “Example”getButtonLabel('south', hub.active.getCapabilities().identity.brand) // 'A' | 'Cross' | 'B'identifyGamepadFromId()
Section titled “identifyGamepadFromId()”identifyGamepadFromId(
rawId):Omit<ControllerIdentity,"source"|"transport">
Defined in: hid/index.ts:339
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Omit<ControllerIdentity, "source" | "transport">
isControllerBinding()
Section titled “isControllerBinding()”isControllerBinding(
binding):boolean
Defined in: input/actions.ts:178
Whether a binding is a controller input (a button, 'l2' / 'r2' or a stick direction) rather than
a keyboard key or mouse button. Use it to replace only the controller side of an action when a
player remaps it, so keyboard bindings keep working.
Parameters
Section titled “Parameters”binding
Section titled “binding”string
Returns
Section titled “Returns”boolean
resolveButtonName()
Section titled “resolveButtonName()”Call Signature
Section titled “Call Signature”resolveButtonName(
name):ButtonName
Defined in: input/buttons.ts:24
Returns the SDK button name for a position-based alias, or the name itself when it is not an alias.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Call Signature
Section titled “Call Signature”resolveButtonName(
name):string
Defined in: input/buttons.ts:25
Returns the SDK button name for a position-based alias, or the name itself when it is not an alias.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”string
routeHapticPulse()
Section titled “routeHapticPulse()”routeHapticPulse(
ctx,spec):HapticRouteTier
Defined in: haptics/router.ts:139
Routes a tactile pulse across hardware tiers with faithful stereo & frequency preservation:
- DualSense 4ch VCM audio (when attached & active)
- Nintendo Switch Pro dual-band LRA HD Rumble (preserves pan + freqHz)
- Xbox Series Impulse Triggers (maps pan + crisp frequencies into L/R trigger motors)
- Standard Gamepad / DualSense legacy dual-motor fallback
Returns the actual hardware tier selected (HapticRouteTier).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”routeHapticSweep()
Section titled “routeHapticSweep()”routeHapticSweep(
ctx,spec):HapticRouteTier
Defined in: haptics/router.ts:191
Routes a tactile sweep across hardware tiers:
- DualSense 4ch VCM audio sweep
- Switch Pro multi-step stereo HD Rumble sequence (interpolating pan & frequency)
- Xbox / standard dual-motor fallback
Returns the actual hardware tier selected (HapticRouteTier).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”routeTactilePreset()
Section titled “routeTactilePreset()”routeTactilePreset(
ctx,presetId,opts?):HapticRouteTier
Defined in: haptics/router.ts:241
Plays a named cross-brand tactile preset with optional pan & intensity scale overrides.
Returns the actual hardware tier selected (HapticRouteTier).
Parameters
Section titled “Parameters”presetId
Section titled “presetId”intensity?
Section titled “intensity?”number
number
Returns
Section titled “Returns”References
Section titled “References”DualSenseControllerManager
Section titled “DualSenseControllerManager”Renames and re-exports ControllerManager