-
Notifications
You must be signed in to change notification settings - Fork 48
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
Support Buffered Haptic Effects #39
Comments
The proposed WebIDL would fit within the Gamepad Extensions:
|
Based on initial feedback when this WebIDL was posted as a comment in PR #32, we may wish to replace "linear" with a more immediately relevant actuator type in GamepadHapticActuatorType. Perhaps it would also be beneficial to either specify that this API could be used for force feedback or is limited to vibration based haptics. |
Thanks for filing this. Also, want to make sure that #19 isn't neglected. I assume we want to keep things separate, even though |
This is ... quite a lot of API surface. One of the things we've always tried to do with the Gamepad API is keep the API surface small, so it's easy to use and reason about. I'm not convinced that the payoff is worth the complexity here. FWIW, I have previously rejected supporting force-feedback, since it doesn't seem to be in wide use in modern devices, but I don't know if VR hardware changes that. Modern gamepads just offer vibration motors of varying intensity, and I think we should expose that as a simple API. |
The functionality requested is mostly the same as what is specified in the Web Audio API. Linear actuators are strikingly similar to audio devices in the way that they receive data, and many would argue that they are low frequency audio devices. The Web Audio API could be extended to support linear actuators with a minimal increase in API surface area. Is it a reasonable proposal to provide vibration through the Web Audio API? |
Interesting idea. Is there precedent with the Web Audio APIs of interacting with or mapping relationships to peripherals. Beyond gamepads, can you think of other use cases that could justify extending Web Audio for vibration? (It's worth mentioning that this could also cause further confusion with the already existent Vibration API.) |
The Web Audio API has AudioContext.createMediaStreamDestination() intended for sending audio through the WebRTC API to play on a remote system or saving to a file. The same API can be used to send data to linear actuators built into a Gamepad. Support for something like the WiiU controller's screen and speaker could use MediaStreams in a similar way. |
Thanks for the feedback. Perhaps either a simpler API that allows javascript to keep a buffered stream of haptic actuator values filled is all we need. Everything else could be done in library space. I'll also explore the possible media stream integration concept and give a couple of options for the webidl. |
The "pulse" function added in PR #32 provides an easy to use, direct way to provide a simple, momentary actuation of vibration motors in controllers.
The goal of buffered haptics to is increase the variety of effects that can be expressed. More advanced effects require millisecond-level precision updates to the actuators that provide haptic feedback. The underlying hardware API's allow submission of arrays of values that are often uploaded wirelessly to the hardware itself for high frequency execution.
I would like to provide the ability to run these haptic effects asynchronously. The UA can emulate the hardware buffering, so this functionality can be available on all controllers that support haptic feedback while taking advantage of hardware haptic buffering when available.
Fundamental features of the suggested interface:
The text was updated successfully, but these errors were encountered: