dualsense-ts
Version:
The natural interface for your DualSense and DualSense Access controllers, with Typescript
109 lines • 4.05 kB
TypeScript
/** Canonical trigger effect types from the DualSense firmware */
export declare enum TriggerEffect {
/** No resistance — default linear feel */
Off = "off",
/** Zone-based continuous resistance */
Feedback = "feedback",
/** Resistance with a snap release point, like a weapon trigger */
Weapon = "weapon",
/** Weapon feel with snap-back force, like drawing a bow */
Bow = "bow",
/** Rhythmic two-stroke oscillation */
Galloping = "galloping",
/** Zone-based oscillation with configurable amplitude and frequency */
Vibration = "vibration",
/** Dual-amplitude vibration with frequency and period control */
Machine = "machine"
}
/** Zone-based resistance with per-zone force control */
export interface FeedbackEffect {
effect: TriggerEffect.Feedback;
/** Where resistance begins along trigger travel (0-1) */
position: number;
/** Resistance strength (0-1, maps to firmware's 1-8 scale) */
strength: number;
}
/** Resistance with a start position, snap release point, and force */
export interface WeaponEffect {
effect: TriggerEffect.Weapon;
/** Where resistance begins (0-1, maps to zones 2-7) */
start: number;
/** Where snap release occurs (0-1, maps to zones 3-8, must be after start) */
end: number;
/** Resistance strength (0-1) */
strength: number;
}
/** Weapon feel with snap-back force */
export interface BowEffect {
effect: TriggerEffect.Bow;
/** Where resistance begins (0-1) */
start: number;
/** Where snap-back occurs (0-1, must be after start) */
end: number;
/** Pull strength (0-1) */
strength: number;
/** Snap-back force (0-1) */
snapForce: number;
}
/** Rhythmic two-stroke oscillation */
export interface GallopingEffect {
effect: TriggerEffect.Galloping;
/** Where effect begins (0-1) */
start: number;
/** Where effect ends (0-1) */
end: number;
/** First foot timing (0-1, maps to 0-6) */
firstFoot: number;
/** Second foot timing (0-1, maps to 0-7, must be after firstFoot) */
secondFoot: number;
/** Oscillation frequency in Hz (1-255) */
frequency: number;
}
/** Zone-based oscillation with amplitude and frequency control */
export interface VibrationEffect {
effect: TriggerEffect.Vibration;
/** Where vibration begins along trigger travel (0-1) */
position: number;
/** Vibration amplitude (0-1, maps to firmware's 1-8 scale) */
amplitude: number;
/** Vibration frequency in Hz (1-255) */
frequency: number;
}
/** Dual-amplitude vibration with frequency and period */
export interface MachineEffect {
effect: TriggerEffect.Machine;
/** Where effect begins (0-1) */
start: number;
/** Where effect ends (0-1) */
end: number;
/** First amplitude (0-1, maps to 0-7) */
amplitudeA: number;
/** Second amplitude (0-1, maps to 0-7) */
amplitudeB: number;
/** Vibration frequency in Hz (1-255) */
frequency: number;
/** Period in tenths of a second */
period: number;
}
export type TriggerFeedbackConfig = {
effect: TriggerEffect.Off;
} | FeedbackEffect | WeaponEffect | BowEffect | GallopingEffect | VibrationEffect | MachineEffect;
/** Build the 11-byte trigger effect block from a config */
export declare function buildTriggerEffectBlock(config: TriggerFeedbackConfig): Uint8Array;
/** Holds the desired adaptive trigger feedback state and translates it for HID output */
export declare class TriggerFeedback {
private _config;
/** The current feedback configuration */
get config(): TriggerFeedbackConfig;
/** The current effect type */
get effect(): TriggerEffect;
/** Set adaptive trigger feedback */
set(config: TriggerFeedbackConfig): void;
/** Reset to no resistance */
reset(): void;
/** Build the raw 11-byte effect block for HID output */
toBytes(): Uint8Array;
/** String key for change detection in the polling loop */
toKey(): string;
}
//# sourceMappingURL=trigger_feedback.d.ts.map