-
Stuart Layton authored
The SpikeDisplayNode object isn't working properly. Queueing of spikes there appeared to be what was causing the problem. I need to consider an alternative way of handling the SpikeObjects. In the past I've used a circular buffer but that has problems with having a set size. I can use an stl::queue but queues are not thread safe, which is something that we definitely need. Anyway the plots show up and dance when the viewer is turned on. I still need to implement a Stereotrode plot and then the tetrode plot. I'll probably derive them from the ElectrodePlot base class instead of creating a base classs from which all three plot types are derived from. Finally I need to get a better handle on the setup of the OpenGLCanvas and how its sized. How the "Magical" scroll bars work and how to auto place the plots. Do we force all the plots to be of the same type? Or do we mix in Electrode Plots with Tetrode Plots? If so how do we orient them all?
Stuart Layton authoredThe SpikeDisplayNode object isn't working properly. Queueing of spikes there appeared to be what was causing the problem. I need to consider an alternative way of handling the SpikeObjects. In the past I've used a circular buffer but that has problems with having a set size. I can use an stl::queue but queues are not thread safe, which is something that we definitely need. Anyway the plots show up and dance when the viewer is turned on. I still need to implement a Stereotrode plot and then the tetrode plot. I'll probably derive them from the ElectrodePlot base class instead of creating a base classs from which all three plot types are derived from. Finally I need to get a better handle on the setup of the OpenGLCanvas and how its sized. How the "Magical" scroll bars work and how to auto place the plots. Do we force all the plots to be of the same type? Or do we mix in Electrode Plots with Tetrode Plots? If so how do we orient them all?
SpikeDisplayNode.cpp 2.77 KiB
/*
------------------------------------------------------------------
This file is part of the Open Ephys GUI
Copyright (C) 2012 Open Ephys
------------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SpikeDisplayNode.h"
#include <stdio.h>
SpikeDisplayNode::SpikeDisplayNode()
: GenericProcessor("SpikeDisplay Viewer"),
bufferSize(0), abstractFifo(100)
{
// displayBuffer = new AudioSampleBuffer(8, 100);
eventBuffer = new MidiBuffer();
}
SpikeDisplayNode::~SpikeDisplayNode()
{
//deleteAndZero(displayBuffer);
//deleteAndZero(eventBuffer);
}
AudioProcessorEditor* SpikeDisplayNode::createEditor()
{
std::cout<<"SpikeDisplayNode Created!"<<std::endl;
editor = new SpikeDisplayEditor(this);
return editor;
}
void SpikeDisplayNode::updateSettings()
{
std::cout << "Setting num inputs on SpikeDisplayNode to " << getNumInputs() << std::endl;
}
bool SpikeDisplayNode::enable()
{
std::cout<<"SpikeDisplayNode::enable()"<<std::endl;
SpikeDisplayEditor* editor = (SpikeDisplayEditor*) getEditor();
editor->enable();
return true;
}
bool SpikeDisplayNode::disable()
{
std::cout<<"SpikeDisplayNode disabled!"<<std::endl;
SpikeDisplayEditor* editor = (SpikeDisplayEditor*) getEditor();
editor->disable();
return true;
}
int SpikeDisplayNode::getNumberOfChannelsForInput(int i){
std::cout<<"SpikeDisplayNode::getNumberOfChannelsForInput()"<<std::endl;
return 1;
}
void SpikeDisplayNode::setParameter (int parameterIndex, float newValue)
{
std::cout<<"SpikeDisplayNode setParameter!"<<std::endl;
}
void SpikeDisplayNode::process(AudioSampleBuffer &buffer, MidiBuffer &midiMessages, int& nSamples)
{
std::cout<<"SpikeDisplayNode::process"<<std::endl;
uint64_t ts = 00000;
int noise = 10;
SpikeObject newSpike;
generateSimulatedSpike(&newSpike, ts, noise);
spikebuffer.push(newSpike);
bufferSize++;
}
bool SpikeDisplayNode::getNextSpike(SpikeObject *spike){
std::cout<<"SpikeDisplayNode::getNextSpike()"<<std::endl;
if (bufferSize<1 || spikebuffer.empty())
return false;
else{
SpikeObject s = spikebuffer.front();
spikebuffer.pop();
bufferSize--;
*spike = s;
return true;
}
return false;
}