Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Gamepad::SetVibrationData(HidVibrationValue & vibration, double amplitude)
- {
- vibration.freq_low = 160.0f;
- vibration.freq_high = 320.0f;
- vibration.amp_low = amplitude;
- vibration.amp_high = amplitude;
- }
- void Gamepad::SetVibration(double left, double right)
- {
- double leftAmplitude = clamp(0, left, 1);
- HidVibrationValue leftValue;
- this->SetVibrationData(leftValue, leftAmplitude);
- memcpy(&this->vibration[0], &leftValue, sizeof(HidVibrationValue));
- double rightAmplitude = clamp(0, right, 1);
- HidVibrationValue rightValue;
- this->SetVibrationData(rightValue, rightAmplitude);
- memcpy(&this->vibration[1], &rightValue, sizeof(HidVibrationValue));
- hidSendVibrationValues(this->vibrationHandles, this->vibration, 2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement