Skip to content

Commit 34822e5

Browse files
committed
fix: debug display buffer index
1 parent e5d92ba commit 34822e5

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

Plugins/LfpDisplayNode/LfpDisplayCanvas.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,15 +1584,28 @@ float LfpDisplaySplitter::getStd(int chan)
15841584
// use 0.1s of sample to compute Mean and Std
15851585
float totalPoints = 0.1 * sampleRate;
15861586

1587+
//LOGD("DisplayBufferIndex ", displayBufferIndex[chan], " - ", totalPoints, " points required");
1588+
15871589
// avoid crash if no signal
1588-
if ((displayBufferIndex[chan] - totalPoints) <= 0)
1589-
return 0;
1590+
//if ((displayBufferIndex[chan] - totalPoints) <= 0) {
1591+
// LOGD("\tReturning ", 0);
1592+
// return 0;
1593+
//}
15901594

15911595
for (int samp = displayBufferIndex[chan] - totalPoints; samp < displayBufferIndex[chan]; samp += 1)
15921596
{
1593-
std += pow((*displayBuffer->getReadPointer(chan, samp) - mean),2);
1597+
float value = 0;
1598+
1599+
if (samp >= 0)
1600+
value = *displayBuffer->getReadPointer(chan, samp);
1601+
else
1602+
value = *displayBuffer->getReadPointer(chan, displayBuffer->getNumSamples() - samp);
1603+
1604+
std += pow((value - mean),2);
1605+
//LOGD("\tval ", *displayBuffer->getReadPointer(chan, samp));
15941606
numPts++;
15951607
}
1608+
LOGD("\tReturning ", sqrt(std / numPts));
15961609

15971610
return sqrt(std / numPts);
15981611

0 commit comments

Comments
 (0)