- From: Patrick Martin <patrick.martin.r@gmail.com>
- Date: Sun, 23 Mar 2014 11:19:53 -0700
- To: public-webapps@w3.org
- Message-ID: <CAN_rxo2jKpGNX48jOZQvPROJ3DcPzthVbJb=HmV9zeEPEoYkwQ@mail.gmail.com>
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 Sunday, 23 March 2014 18:25:30 UTC