- From: Tobie Langel via GitHub <sysbot+gh@w3.org>
- Date: Fri, 24 Feb 2017 12:27:27 +0000
- To: public-device-apis-log@w3.org
> To meet this use case we need an uninterrupted recording all the
time, note that samples can be lost even during notification that the
given buffer is full and while refreshing the buffer.
Would you write to the buffer directly as you get the samples from the
HAL (or equivalent) or would you write to it with each animation
frame?
If its the former, we indeed need a buffer swapping mechanism of some
sort. If it's the latter the buffer can be swapped synchronously by
the API consumer during rAF (or right before? I'm not sure about the
particulars of this) if they're advised the buffer is about to be
filled, no?
```js
let gyro = new Gyroscope();
let bufferA = Float64Array(gyro.getReadingSize() * n);
let bufferB = Float64Array(gyro.getReadingSize() * n);
gyro.onbufferfull = _ => {
if (gyro.buffer === bufferA) {
gyro.buffer = bufferB;
} else {
gyro.buffer = bufferA;
}
};
```
--
GitHub Notification of comment by tobie
Please view or discuss this issue at
https://github.com/w3c/sensors/issues/171#issuecomment-282279751 using
your GitHub account
Received on Friday, 24 February 2017 12:27:35 UTC