@@ -494,42 +494,43 @@ void SpikeSorterEditor::setThresholdValue(int channel, double threshold)
494494 repaint ();
495495}
496496
497- void SpikeSorterEditor::channelChanged (int chan )
497+ void SpikeSorterEditor::channelChanged (int channel, bool newState )
498498{
499499 // std::cout << "New channel: " << chan << std::endl;
500- if (chan <=0 )
500+ if (channel <= 0 )
501501 return ;
502502
503- for (int i = 0 ; i < electrodeButtons.size (); i++)
503+ const int numElectrodeButtons = electrodeButtons.size ();
504+ for (int i = 0 ; i < numElectrodeButtons; ++i)
504505 {
505506 if (electrodeButtons[i]->getToggleState ())
506507 {
507- electrodeButtons[i]->setChannelNum (chan );
508+ electrodeButtons[i]->setChannelNum (channel );
508509 electrodeButtons[i]->repaint ();
510+
509511 Array<int > a;
510- a.add (chan-1 );
511- channelSelector->setActiveChannels (a);
512+ a.add (channel - 1 );
513+ channelSelector->setActiveChannels (a);
514+
512515 SpikeSorter* processor = (SpikeSorter*) getProcessor ();
513516 processor->setChannel (electrodeList->getSelectedItemIndex (),
514517 i,
515- chan- 1 );
518+ channel - 1 );
516519
517520 // if DAC is selected, update the mapping.
518- int dacchannel = dacCombo->getSelectedId ()- 2 ;
521+ int dacchannel = dacCombo->getSelectedId () - 2 ;
519522 if (dacchannel >=0 )
520523 {
521- processor->assignDACtoChannel (dacchannel, chan- 1 );
524+ processor->assignDACtoChannel (dacchannel, channel - 1 );
522525 }
523526 if (processor->getAutoDacAssignmentStatus ())
524527 {
525- processor->assignDACtoChannel (0 ,chan- 1 );
526- processor->assignDACtoChannel (1 ,chan- 1 );
528+ processor->assignDACtoChannel (0 , channel - 1 );
529+ processor->assignDACtoChannel (1 , channel - 1 );
527530 break ;
528531 }
529-
530532 }
531533 }
532-
533534}
534535
535536int SpikeSorterEditor::getSelectedElectrode ()
0 commit comments