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

Method AddSamples

ReviveXR/HapticsBuffer.cpp:10–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

SubmitVibrationMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected