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

Method AddSamples

Revive/HapticsBuffer.cpp:10–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8}
9
10void HapticsBuffer::AddSamples(const ovrHapticsBuffer* buffer)
11{
12 // Force constant vibration off
13 m_ConstantTimeout = 0;
14
15 uint8_t* samples = (uint8_t*)buffer->Samples;
16
17 for (int i = 0; i < buffer->SamplesCount; i++)
18 {
19 if (m_WriteIndex == m_ReadIndex)
20 return;
21
22 m_Buffer[m_WriteIndex] = samples[i];
23
24 // We increment the atomic here as a memory barrier
25 // Index will overflow correctly, so no need for a modulo operator
26 m_WriteIndex++;
27 }
28}
29
30void HapticsBuffer::SetConstant(float frequency, float amplitude)
31{

Callers 1

SubmitVibrationMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected