Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Source/Devices/AnalogIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,12 @@ void AnalogIO::processFrame (uint64_t eventWord)

currentAverageFrame = 0;

timestamps[currentFrame] = deviceContext->convertTimestampToSeconds (frame->time);
// NB: In ONI v1.0 frame clock is when the frame is created, not necessarily when the data is received.
// For local and passthrough devices, we will instead use the hub clock for the timestamp; in
// ONI v2.0 this behavior may change, and frame->time can be used instead for consistency across devices.
auto hubClock = (uint64_t*) frame->data;

timestamps[currentFrame] = deviceContext->convertTimestampToSeconds (*hubClock);
sampleNumbers[currentFrame] = sampleNumber++;
eventCodes[currentFrame] = eventWord;

Expand Down
9 changes: 7 additions & 2 deletions Source/Devices/DigitalIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,19 @@ void DigitalIO::processFrames()
{
size_t offset = 0;

uint16_t* dataPtr = (uint16_t*) frame->data;
// NB: In ONI v1.0 frame clock is when the frame is created, not necessarily when the data is received.
// For local and passthrough devices, we will instead use the hub clock for the timestamp; in
// ONI v2.0 this behavior may change, and frame->time can be used instead for consistency across devices.
auto hubClock = (uint64_t*) frame->data;

timestamps[currentFrame] = deviceContext->convertTimestampToSeconds (frame->time);
timestamps[currentFrame] = deviceContext->convertTimestampToSeconds (*hubClock);
sampleNumbers[currentFrame] = sampleNumber++;

constexpr int inputDataOffset = 4;
constexpr int buttonDataOffset = inputDataOffset + 1;

uint16_t* dataPtr = (uint16_t*) frame->data;

uint64_t inputState = *(dataPtr + inputDataOffset);
uint64_t buttonState = *(dataPtr + buttonDataOffset);

Expand Down
9 changes: 7 additions & 2 deletions Source/Devices/HarpSyncInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,14 @@ void HarpSyncInput::processFrames()
oni_frame_t* frame;
while (frameQueue.try_dequeue (frame))
{
uint32_t* dataPtr = (uint32_t*) frame->data;
// NB: In ONI v1.0 frame clock is when the frame is created, not necessarily when the data is received.
// For local and passthrough devices, we will instead use the hub clock for the timestamp; in
// ONI v2.0 this behavior may change, and frame->time can be used instead for consistency across devices.
auto hubClock = (uint64_t*) frame->data;

timestamps[currentFrame] = deviceContext->convertTimestampToSeconds (*hubClock);

timestamps[currentFrame] = deviceContext->convertTimestampToSeconds (frame->time);
uint32_t* dataPtr = (uint32_t*) frame->data;

harpTimeSamples[currentFrame] = *(dataPtr + 2) + 1;

Expand Down
6 changes: 5 additions & 1 deletion Source/Devices/MemoryMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,12 @@ void MemoryMonitor::processFrames()

while (frameQueue.try_dequeue (frame))
{
// NB: In ONI v1.0 frame clock is when the frame is created, not necessarily when the data is received.
// For local and passthrough devices, we will instead use the hub clock for the timestamp; in
// ONI v2.0 this behavior may change, and frame->time can be used instead for consistency across devices.
auto hubClock = (uint64_t*) frame->data;
auto t = deviceContext->convertTimestampToSeconds (*hubClock);
uint32_t* dataPtr = (uint32_t*) frame->data;
auto t = deviceContext->convertTimestampToSeconds (frame->time);
auto p = 100.0f * float (*(dataPtr + 2)) / totalMemory;
lastPercentUsedValue = p;
oni_destroy_frame (frame);
Expand Down
11 changes: 8 additions & 3 deletions Source/Devices/Neuropixels1e.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,17 @@ void Neuropixels1e::processFrames()
oni_frame_t* frame;
while (frameQueue.try_dequeue (frame))
{
uint16_t* dataPtr = (uint16_t*) frame->data;
dataPtr += dataOffset;
// NB: In ONI v1.0 frame clock is when the frame is created, not necessarily when the data is received.
// For local and passthrough devices, we will instead use the hub clock for the timestamp; in
// ONI v2.0 this behavior may change, and frame->time can be used instead for consistency across devices.
auto hubClock = (uint64_t*) frame->data;

apTimestamps[superFrameCount] = deviceContext->convertTimestampToSeconds (frame->time);
apTimestamps[superFrameCount] = deviceContext->convertTimestampToSeconds (*hubClock);
apSampleNumbers[superFrameCount] = apSampleNumber++;

uint16_t* dataPtr = (uint16_t*) frame->data;
dataPtr += dataOffset;

for (size_t i = 0; i < framesPerSuperFrame; i++)
{
if (i == 0) // LFP data
Expand Down
8 changes: 7 additions & 1 deletion Source/Devices/Neuropixels2e.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,13 @@ void Neuropixels2e::processFrames()
uint16_t* amplifierData = dataPtr + 9;

sampleNumbers[probeIndex][frameCount[probeIndex]] = sampleNumber[probeIndex]++;
timestamps[probeIndex][frameCount[probeIndex]] = deviceContext->convertTimestampToSeconds (frame->time);

// NB: In ONI v1.0 frame clock is when the frame is created, not necessarily when the data is received.
// For local and passthrough devices, we will instead use the hub clock for the timestamp; in
// ONI v2.0 this behavior may change, and frame->time can be used instead for consistency across devices.
auto hubClock = (uint64_t*) frame->data;

timestamps[probeIndex][frameCount[probeIndex]] = deviceContext->convertTimestampToSeconds (*hubClock);

for (int i = 0; i < FramesPerSuperFrame; i++)
{
Expand Down