| 25 | } |
| 26 | |
| 27 | float HapticsBuffer::GetSample() |
| 28 | { |
| 29 | // We can't pass the write index, so the buffer is now empty |
| 30 | if (m_ReadIndex + 1 == m_WriteIndex) |
| 31 | return 0.0f; |
| 32 | |
| 33 | // Index will overflow correctly, so no need for a modulo operator |
| 34 | uint8_t sample = m_Buffer[++m_ReadIndex]; |
| 35 | |
| 36 | return sample / 255.0f; |
| 37 | } |
| 38 | |
| 39 | ovrHapticsPlaybackState HapticsBuffer::GetState() |
| 40 | { |