Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. void Gamepad::SetVibrationData(HidVibrationValue & vibration, double amplitude)
  2. {
  3. vibration.freq_low = 160.0f;
  4. vibration.freq_high = 320.0f;
  5.  
  6. vibration.amp_low = amplitude;
  7. vibration.amp_high = amplitude;
  8. }
  9.  
  10. void Gamepad::SetVibration(double left, double right)
  11. {
  12. double leftAmplitude = clamp(0, left, 1);
  13. HidVibrationValue leftValue;
  14.  
  15. this->SetVibrationData(leftValue, leftAmplitude);
  16. memcpy(&this->vibration[0], &leftValue, sizeof(HidVibrationValue));
  17.  
  18. double rightAmplitude = clamp(0, right, 1);
  19. HidVibrationValue rightValue;
  20.  
  21. this->SetVibrationData(rightValue, rightAmplitude);
  22. memcpy(&this->vibration[1], &rightValue, sizeof(HidVibrationValue));
  23.  
  24. hidSendVibrationValues(this->vibrationHandles, this->vibration, 2);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement