Skip to content

Commit 9476b7e

Browse files
committed
Add vector of indexes for lfp to filter
1 parent 70bbc70 commit 9476b7e

1 file changed

Lines changed: 25 additions & 17 deletions

File tree

Plugins/LfpDisplayNode/LfpDisplay.cpp

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5050

5151
#include <math.h>
5252
#include <numeric>
53+
#include <vector>
5354

5455
using namespace LfpViewer;
5556

@@ -981,27 +982,34 @@ void LfpDisplay::rebuildDrawableChannelsList()
981982
removeAllChildren(); // start with clean slate
982983

983984
Array<LfpChannelTrack> channelsToDraw; // all visible channels will be added to this array
984-
985+
std::vector<int> filteredChannels;
986+
for(int i = 0 ; i < 64; i++) {
987+
filteredChannels.push_back(i + 32 + (64 * (i/16)));
988+
}
989+
int filteredChannelsSize = filteredChannels.size();
985990
// iterate over all channels and select drawable ones
986-
for (int i = 0, drawableChannelNum = 0; i < channels.size(); i++)
991+
for (int i = 0, drawableChannelNum = 0, filterChannelIndex = 0; i < channels.size(); i++)
987992
{
988993

989994
//std::cout << "Checking for hidden channels" << std::endl;
990-
if (displaySkipAmt == 0 || (i % displaySkipAmt == 0)) // no skips, add all channels
991-
{
992-
channels[i]->setHidden(false);
993-
channelInfo[i]->setHidden(false);
994-
995-
channelInfo[i]->setDrawableChannelNumber(drawableChannelNum++);
996-
channelInfo[i]->resized(); // to update the conditional drawing of enableButton and channel num
997-
998-
channelsToDraw.add(LfpDisplay::LfpChannelTrack{
999-
channels[i],
1000-
channelInfo[i]
1001-
});
1002-
1003-
addAndMakeVisible(channels[i]);
1004-
addAndMakeVisible(channelInfo[i]);
995+
if(filteredChannelsSize == 0 || (filterChannelIndex < filteredChannelsSize && i == filteredChannels[filterChannelIndex])) {
996+
if (displaySkipAmt == 0 || ((filteredChannelsSize ? filterChannelIndex : i) % displaySkipAmt == 0)) // no skips, add all channels
997+
{
998+
filterChannelIndex++;
999+
channels[i]->setHidden(false);
1000+
channelInfo[i]->setHidden(false);
1001+
1002+
channelInfo[i]->setDrawableChannelNumber(drawableChannelNum++);
1003+
channelInfo[i]->resized(); // to update the conditional drawing of enableButton and channel num
1004+
1005+
channelsToDraw.add(LfpDisplay::LfpChannelTrack{
1006+
channels[i],
1007+
channelInfo[i]
1008+
});
1009+
1010+
addAndMakeVisible(channels[i]);
1011+
addAndMakeVisible(channelInfo[i]);
1012+
}
10051013
}
10061014
else // skip some channels
10071015
{

0 commit comments

Comments
 (0)