void SpikeDetectorEditor::drawElectrodeButtons(int ID) { SpikeDetector* processor = (SpikeDetector*) getProcessor(); electrodeButtons.clear(); int width = 20; int height = 15; int numChannels = processor->getNumChannels(ID); int row = 0; int column = 0; Array<int> activeChannels; Array<double> thresholds; for (int i = 0; i < numChannels; i++) { ElectrodeButton* button = new ElectrodeButton(processor->getChannel(ID,i)+1); electrodeButtons.add(button); thresholds.add(processor->getChannelThreshold(ID,i)); if (electrodeEditorButtons[0]->getToggleState()) { button->setToggleState(false, dontSendNotification); button->setRadioGroupId(299); } else { activeChannels.add(processor->getChannel(ID,i)); button->setToggleState(processor->isChannelActive(ID,i), dontSendNotification); } if (numChannels < 3) button->setBounds(145+(column++)*width, 78+row*height, width, 15); else button->setBounds(145+(column++)*width, 70+row*height, width, 15); addAndMakeVisible(button); button->addListener(this); if (column%2 == 0) { column = 0; row++; } } channelSelector->setActiveChannels(activeChannels); thresholdSlider->setValues(thresholds); }