MCPcopy Create free account
hub / github.com/LibreVR/Revive / HapticsThread

Method HapticsThread

Revive/InputManager.cpp:368–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368void InputManager::OculusTouch::HapticsThread(OculusTouch* device)
369{
370 std::chrono::microseconds freq(std::chrono::seconds(1));
371 freq /= REV_HAPTICS_SAMPLE_RATE;
372
373 while (device->m_bHapticsRunning)
374 {
375 vr::TrackedDeviceIndex_t touch = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(device->Role);
376
377 float sample = (device->m_Haptics.GetSample() + device->m_Haptics.GetSample()) / 2.0f;
378 if (sample > 0.0f)
379 vr::VRSystem()->TriggerHapticPulse(touch, 0, (uint16_t)(freq.count() * sample));
380
381 std::this_thread::sleep_for(freq);
382 }
383}
384
385InputManager::OculusTouch::OculusTouch(vr::VRActionSetHandle_t actionSet, vr::ETrackedControllerRole role)
386 : InputDevice(actionSet)

Callers

nothing calls this directly

Calls 1

GetSampleMethod · 0.45

Tested by

no test coverage detected