Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- the code of the button event
- the code of the plugin can be found at https://drive.google.com/drive/folders/0B_B0Mi9z64F4Q3F4ZDJhbm9nRjg
- SpikeDetectorEditor.cpp and SpikeDetectorEditor.h concerns with gui and button behaviour,,
- so i believe its better to check them first
- SpikeDetector.cpp and SpikeDetector.h contains the functionality of these buttons
- i am facing problem in erratic behaviour of one button DTHR,,
- here is the code of button Event for the particualr button,
- guys, any suggestion is welcome,,
- will changing the button to a checkbox help ,, but i think juce does not provide functionality of a checkbox,,
- a sister thread can be found at
- https://forum.juce.com/t/weird-gui-and-geometry-errors-while-implementing-a-circular-buffer/18656/2
- else if(button == electrodeEditorButtons[3]) // DYNAMIC THRESH
- {
- SpikeDetector* processor = (SpikeDetector*) getProcessor();
- Array<SimpleElectrode*> electrodes;
- processor->getElectrodes(electrodes);
- if(button->getToggleState())
- {
- std::cout<<" setting dynamic threshold for all channels"<<std::endl;
- // need to think of cases when Edit or delete is clicked and so on
- std::cout<<"DTHR button clicked ,, setting dynamic threshold for all elctrodes,, and all channels"<<std::endl;
- for (int i = 0; i < electrodes.size(); i++)
- {
- for(int chan = 0; chan < electrodes[i]->numChannels; chan++)
- {
- int theChannel = *(electrodes[i]->channels + chan);
- float dynamicThreshold = processor->getDynamicThreshold(theChannel);
- processor->setChannelThreshold(i, theChannel, dynamicThreshold);
- std::cout<<"In DTHR button loop Setting electrode number " << i <<" channel number "<< theChannel << "the dynamic threshold is "<< dynamicThreshold<<std::endl;
- }
- }
- }
- else if(!button->getToggleState())
- {
- std::cout<<"setting default threshold for all channels"<<std::endl;
- float defaultThreshold = processor->detectorBuffers.defthresh;
- for (int i = 0; i < electrodes.size(); i++)
- {
- for(int chan = 0; chan < electrodes[i]->numChannels; chan++)
- {
- processor->setChannelThreshold(i, *(electrodes[i]->channels+chan), defaultThreshold);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment