Skip to content
Snippets Groups Projects
Commit 2b3e1058 authored by Stuart Layton's avatar Stuart Layton
Browse files

fixed the SignalGenerator to decrease the rate of spike generation

parent b26f6d39
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ SignalGenerator::SignalGenerator()
defaultFrequency(10.0),
defaultAmplitude (100.0f),
nOut(5), previousPhase(1000), spikeDelay(-1)
nOut(5), previousPhase(1000), spikeDelay(0)
{
......@@ -273,12 +273,16 @@ float SignalGenerator::generateSpikeSample(double amp, double phase, double nois
// if the current phase is less than the previous phase we've probably wrapped and its time to select a new spike
// if we've delayed long enough then draw a new spike otherwise wait until spikeDelay==0
if (phase < previousPhase){
spikeIdx = rand()%5;
spikeDelay = rand()%100;
if( spikeDelay <= 0)
spikeDelay = rand()%200 + 50;
if (spikeDelay > 0)
spikeDelay --;
}
previousPhase = phase;
......
......@@ -28,7 +28,7 @@ SpikeDisplayCanvas::SpikeDisplayCanvas(SpikeDisplayNode* n) :
plotsInitialized(false), newSpike(false),
processor(n), totalScrollPix(0)
{
nCols = 8;
nCols = 6;
update();
......@@ -137,7 +137,7 @@ void SpikeDisplayCanvas::repositionSpikePlots(){
int w,h;
int yIncrement = 0;
bool loopCheck = false;
std::cout<<"Positioning Spike Plots"<<std::endl;
//std::cout<<"Positioning Spike Plots"<<std::endl;
while (p < plots.size()){
// Ask the current plot for its desired dims
......@@ -147,7 +147,7 @@ void SpikeDisplayCanvas::repositionSpikePlots(){
// Check to see if plot exceeds width of canvas, if yes, set x back to 0 and go to the bottom most plot on the canvas
if ( (x + w + xBuffer > canvasWidth - xBuffer) && !loopCheck){
std::cout<<"Collision with the edge of the canvas, going down a row"<<std::endl;
//std::cout<<"Collision with the edge of the canvas, going down a row"<<std::endl;
x = xBuffer;
y = y - yIncrement - yBuffer;
yIncrement = 0;
......@@ -156,7 +156,7 @@ void SpikeDisplayCanvas::repositionSpikePlots(){
}
// else place the plot
else{
std::cout<<"Positioning p:"<<p<<" at "<<x<<","<<y - h<<" "<<w<<","<<h<<std::endl;
//std::cout<<"Positioning p:"<<p<<" at "<<x<<","<<y - h<<" "<<w<<","<<h<<std::endl;
plots[p]->setPosition(x, y - h + getScrollAmount(), w, h);
x = x + w + xBuffer;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment