Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trigger rumble effect #195

Merged
merged 6 commits into from
Mar 29, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 69 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,13 @@ <h2>
If |params| does not describe a [=valid dual-rumble effect=],
return `false`.
</dd>
<dt>
{{GamepadHapticEffectType/"trigger-rumble"}}
</dt>
<dd>
If |params| does not describe a [=valid trigger-rumble effect=],
return `false`.
</dd>
</dl>
</li>
<li>Return `true`
Expand Down Expand Up @@ -1418,7 +1425,8 @@ <h3>
</p>
<pre class="idl">
enum GamepadHapticEffectType {
"dual-rumble"
"dual-rumble",
"trigger-rumble"
};
</pre>
<dl>
Expand Down Expand Up @@ -1455,12 +1463,54 @@ <h3>
<p>
Given {{GamepadEffectParameters}} |params:GamepadEffectParameters|,
a <dfn>valid dual-rumble effect</dfn> must have a valid
duration, a valid startDelay, and both the
{{GamepadEffectParameters/duration}}, a valid {{GamepadEffectParameters/startDelay}}, and both the
{{GamepadEffectParameters/strongMagnitude}} and the
{{GamepadEffectParameters/weakMagnitude}} must be in the range
`[0,1]`.
</p>
</dd>
<dt>
<dfn data-for="GamepadHapticEffectType">"trigger-rumble" effect
type</dfn>
</dt>
<dd>
<p>
{{GamepadHapticEffectType/"trigger-rumble"}} describes a haptics
configuration with a vibration motor in each of the bottom front buttons
of a [=Standard Gamepad=] (buttons with [=canonical indices=] 6 and 7) in addition to the two handle motors used for
{{GamepadHapticEffectType/"dual-rumble"}}. Nowadays these buttons
gabrielsanbrito marked this conversation as resolved.
Show resolved Hide resolved
most commonly take the form of spring-loaded triggers. In this
configuration, either motor is capable of providing localized haptic
feedback on the button's surface.
</p>
<p>
A {{GamepadHapticEffectType/"trigger-rumble"}} effect is a
fixed-duration, constant-intensity vibration effect intended for an
actuator of this type. {{GamepadHapticEffectType/"trigger-rumble"}}
effects are defined by {{GamepadEffectParameters/startDelay}},
{{GamepadEffectParameters/duration}},
{{GamepadEffectParameters/strongMagnitude}},
{{GamepadEffectParameters/weakMagnitude}}, {{GamepadEffectParameters/leftTrigger}}, and {{GamepadEffectParameters/rightTrigger}}, none of which are
required because they default to 0.
</p>
<p>
{{GamepadEffectParameters/startDelay}}, {{GamepadEffectParameters/duration}},
{{GamepadEffectParameters/strongMagnitude}},
{{GamepadEffectParameters/weakMagnitude}} share the same definition with {{GamepadHapticEffectType/"dual-rumble"}}.
{{GamepadEffectParameters/leftTrigger}} and
{{GamepadEffectParameters/rightTrigger}}, respectively, set the
intensity levels for the left and right bottom front buttons
vibrations, normalized to the range `[0,1]`, defaulting to 0.
</p>
<p>
Given {{GamepadEffectParameters}} |params:GamepadEffectParameters|,
a <dfn>valid trigger-rumble effect</dfn> must have a valid
gabrielsanbrito marked this conversation as resolved.
Show resolved Hide resolved
{{GamepadEffectParameters/duration}}, a valid {{GamepadEffectParameters/startDelay}}, and the
{{GamepadEffectParameters/strongMagnitude}},
{{GamepadEffectParameters/weakMagnitude}}, {{GamepadEffectParameters/leftTrigger}}, and {{GamepadEffectParameters/rightTrigger}} must be in the range
`[0,1]`.
</p>
</dd>
</dl>
</section>
<section>
Expand All @@ -1484,6 +1534,8 @@ <h3>
unsigned long long startDelay = 0;
double strongMagnitude = 0.0;
double weakMagnitude = 0.0;
double leftTrigger = 0.0;
double rightTrigger = 0.0;
};
</pre>
<dl>
Expand All @@ -1508,14 +1560,26 @@ <h3>
</dt>
<dd>
The vibration magnitude for the low frequency rumble in a
{{GamepadHapticEffectType/"dual-rumble"}} effect.
{{GamepadHapticEffectType/"dual-rumble"}} or {{GamepadHapticEffectType/"trigger-rumble"}} effect.
</dd>
<dt>
<dfn>weakMagnitude</dfn> member
</dt>
<dd>
The vibration magnitude for the high frequency rumble in a
{{GamepadHapticEffectType/"dual-rumble"}} effect.
{{GamepadHapticEffectType/"dual-rumble"}} or {{GamepadHapticEffectType/"trigger-rumble"}} effect.
</dd>
<dt>
<dfn>leftTrigger</dfn> member
</dt>
<dd>
The vibration magnitude for the bottom left front button ([=canonical index=] 6) rumble in a {{GamepadHapticEffectType/"trigger-rumble"}} effect.
</dd>
<dt>
<dfn>rightTrigger</dfn> member
</dt>
<dd>
The vibration magnitude for the bottom right front button ([=canonical index=] 7) rumble in a {{GamepadHapticEffectType/"trigger-rumble"}} effect.
</dd>
</dl>
</section>
Expand Down Expand Up @@ -1753,7 +1817,7 @@ <h2>
</p>
<p>
If an axis or button input represents a [=Standard Gamepad=] axis or
button, then its <dfn>canonical index</dfn> is the index of the
button, then its <dfn data-lt="canonical indices">canonical index</dfn> is the index of the
corresponding [=Standard Gamepad=] axis or button.
</p>
<table class="tg">
Expand Down
Loading