Skip to content

Commit 418f4f7

Browse files
committed
Only copy channels to display buffer for streams that are actively displayed
1 parent 8671583 commit 418f4f7

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

Plugins/LfpViewer/LfpDisplayNode.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,29 @@ void LfpDisplayNode::process (AudioBuffer<float>& buffer)
321321
initializeEventChannels();
322322
checkForEvents();
323323
finalizeEventChannels();
324+
auto isStreamDisplayed = [this] (uint16 streamId)
325+
{
326+
for (auto split : splitDisplays)
327+
{
328+
if (split != nullptr && split->isVisible() && split->selectedStreamId == streamId)
329+
return true;
330+
}
331+
332+
return false;
333+
};
324334

325335
for (int chan = 0; chan < buffer.getNumChannels(); ++chan)
326336
{
327337
const uint16 streamId = continuousChannels[chan]->getStreamId();
338+
if (! isStreamDisplayed (streamId))
339+
continue;
328340

329-
const uint32 nSamples = getNumSamplesInBlock (streamId);
330-
331-
String streamKey = getDataStream (streamId)->getKey();
341+
auto displayBufferIt = displayBufferMap.find (streamId);
342+
if (displayBufferIt == displayBufferMap.end() || displayBufferIt->second == nullptr)
343+
continue;
332344

333-
displayBufferMap[streamId]->addData (buffer, chan, nSamples);
345+
const uint32 nSamples = getNumSamplesInBlock (streamId);
346+
displayBufferIt->second->addData (buffer, chan, nSamples);
334347
}
335348
}
336349

0 commit comments

Comments
 (0)