forked from eden-emu/eden
controllers/npad: Remove the old vibration filter
Previously we used a vibration filter that filters out amplitudes close to each other. It turns out there are cases where this results into vibrations that are too inaccurate. Remove this and move the 100Hz vibration filter (Only allowing a maximum of 100 vibrations per second) from sdl_impl to npad when enable_accurate_vibrations is set to false.
This commit is contained in:
parent
91c06dae1a
commit
30e0d1c973
4 changed files with 69 additions and 70 deletions
|
@ -81,18 +81,6 @@ public:
|
|||
}
|
||||
|
||||
bool RumblePlay(u16 amp_low, u16 amp_high) {
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::steady_clock;
|
||||
|
||||
// Block non-zero vibrations less than 10ms apart from each other.
|
||||
if ((amp_low != 0 || amp_high != 0) &&
|
||||
duration_cast<milliseconds>(steady_clock::now() - last_vibration) < milliseconds(10)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
last_vibration = steady_clock::now();
|
||||
|
||||
if (sdl_controller) {
|
||||
return SDL_GameControllerRumble(sdl_controller.get(), amp_low, amp_high, 0) == 0;
|
||||
} else if (sdl_joystick) {
|
||||
|
@ -171,9 +159,6 @@ private:
|
|||
std::unique_ptr<SDL_GameController, decltype(&SDL_GameControllerClose)> sdl_controller;
|
||||
mutable std::mutex mutex;
|
||||
|
||||
// This is the timepoint of the last vibration and is used to ensure vibrations are 10ms apart.
|
||||
std::chrono::steady_clock::time_point last_vibration;
|
||||
|
||||
// Motion is initialized without PID values as motion input is not aviable for SDL2
|
||||
MotionInput motion{0.0f, 0.0f, 0.0f};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue