- From: Patrick Martin <patrick.martin.r@gmail.com>
- Date: Mon, 24 Mar 2014 11:36:53 -0700
- To: Brandon Jones <bajones@google.com>
- Cc: Webapps WG <public-webapps@w3.org>
I agree that it would be simpler to extend the vibration API but oftentimes controllers' rumble packs do a lot more than just vibrate at one frequency or intensity, using the web audio api would allow people to take advantage of that, you could play the low-end sound from your game through the rumble pack, so that the user feels the explosion they are hearing in the game etc. As for how the motor selection would work in a web audio API implementation, it would select the motors based on the pitch and amplitude of the signal, and the speed from just the pitch, but it may not be the best way of doing this, I simply noticed there was very little on this topic, so I came up with a few Ideas. On 3/23/14, Brandon Jones <bajones@google.com> wrote: > Mozilla has played around with gamepad vibration a bit already: > https://bugzilla.mozilla.org/show_bug.cgi?id=680289 > There's been some mixed messages, but so far the basic idea seems to be to > either extend the existing Vibration > API<http://www.w3.org/TR/2014/WD-vibration-20140211/>to handle > multiple motors (and presumably associate it back to a specific > pad) or to add a very similar looking "vibrate" function to the gamepad > API. Something like: > > vibrate(int motorIndex, float intensity); > > Personally I think that there's got to be a little more to it than that. > For one, you'll want to be able to query not only how many motors a device > has but have a way of expressing what type of feedback that motor provides > (is it a heavy motor, etc.) and possibly some description of it's locality > (The Xbox One controller has motors in each trigger, and the Steam > controller has motors under each touchpad.) I have no idea how to concisely > and robustly communicate that information. This also assumes that the > device has simple X-Input style feedback, not the more complicated joystick > force feedback that was all the rage in the 90s. (Which is far more > complicated and fairly dead, so I doubt it's worth addressing at all.) > > As for controller speakers, I see the argument that it's a type of > controller feedback, but I don't think it should be conflated with > controller vibration. I see them as two very distinct features. It *is* an > interesting feature to consider on it's own, though. > > > > On Sun, Mar 23, 2014 at 11:19 AM, Patrick Martin > <patrick.martin.r@gmail.com >> wrote: > >> Hello, >> >> Is there a reason that haptic feedback support is missing from the >> gamepad >> api? I feel that this would prevent developers from fully utilizing >> modern >> gamepads which nearly always include some form of a haptic feedback >> mechanism, (from the speaker on the wiimote to the dual vibrators in an >> xbox 360 controller). In order for this to work however, we need a >> mechanism for detecting supported "haptic feedback modes" which could >> then >> be used on the gamepad with the WebAudio API. >> >> Here is an example of one such mechanism: >> >> var ctx = new AudioContext(); >> var rumble_audio = document.getElementById("rumbleAudio"); >> var rumble_audio_source = ctx.createMediaElementSource(rumble_audio) >> var modes = gamepad.getSupportedFeedbackModes(); >> var feedback_node = null; >> if (typeof(modes.RUMBLE_STEREO) !== "undefined"){ // like the xbox 360 >> feedback_node = gamepad.getFeedbackNode(ctx,modes.RUMBLE_STEREO); >> }else if(typeof(modes.RUMBLE_MONO) !=="undefined"){ // like some pc >> gamepads >> feedback_node = gamepad.getFeedbackNode(ctx,modes.RUMBLE_MONO); >> }else if(typeof(modes.GAMEPAD_AUDIO)){ // like the wii remote >> feedback_node = gamepad.getFeedbackNode(ctx,modes.GAMEPAD_AUDIO); >> }else{ >> feedback_node = ctx.destination >> } >> rumble_audio_source.connect(feedback_node); >> rumble_audio.play(); >> >> A system like this would allow both greater access to the controller's >> functionality and allow feedback to be dynamically generated or modified >> by >> the WebAudio API. >> >> >> I hope this suggestion helps, >> Patrick Martin >> >
Received on Monday, 24 March 2014 18:37:20 UTC