From 004683a94c54eaaae67226392755c90c44352e2c Mon Sep 17 00:00:00 2001 From: Josh Siegle <jsiegle@mit.edu> Date: Thu, 27 Mar 2014 20:53:29 -0400 Subject: [PATCH] Change SpikeDetector dataBuffer to pointer, rather than reference --- Source/Processors/SpikeDetector.cpp | 10 +++++----- Source/Processors/SpikeDetector.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/Processors/SpikeDetector.cpp b/Source/Processors/SpikeDetector.cpp index ba397d002..a025f67e8 100755 --- a/Source/Processors/SpikeDetector.cpp +++ b/Source/Processors/SpikeDetector.cpp @@ -28,7 +28,7 @@ SpikeDetector::SpikeDetector() : GenericProcessor("Spike Detector"), - overflowBuffer(2,100), dataBuffer(overflowBuffer), + overflowBuffer(2,100), dataBuffer(nullptr), overflowBufferSize(100), currentElectrode(-1) { //// the standard form: @@ -412,7 +412,7 @@ void SpikeDetector::process(AudioSampleBuffer& buffer, // cycle through electrodes Electrode* electrode; - dataBuffer = buffer; + dataBuffer = &buffer; checkForEvents(events); // need to find any timestamp events before extracting spikes @@ -571,8 +571,8 @@ float SpikeDetector::getNextSample(int& chan) // useOverflowBuffer = false; // std::cout << " sample index " << sampleIndex << "from regular buffer" << std::endl; - if (sampleIndex < dataBuffer.getNumSamples()) - return *dataBuffer.getSampleData(chan, sampleIndex); + if (sampleIndex < dataBuffer->getNumSamples()) + return *dataBuffer->getSampleData(chan, sampleIndex); else return 0; } @@ -602,7 +602,7 @@ float SpikeDetector::getCurrentSample(int& chan) { // useOverflowBuffer = false; // std::cout << " sample index " << sampleIndex << "from regular buffer" << std::endl; - return *dataBuffer.getSampleData(chan, sampleIndex - 1); + return *dataBuffer->getSampleData(chan, sampleIndex - 1); } //} else { diff --git a/Source/Processors/SpikeDetector.h b/Source/Processors/SpikeDetector.h index 3a5350f0f..c84ec682b 100755 --- a/Source/Processors/SpikeDetector.h +++ b/Source/Processors/SpikeDetector.h @@ -155,8 +155,8 @@ public: void loadCustomParametersFromXml(); private: - /** Reference to a continuous buffer. */ - AudioSampleBuffer& dataBuffer; + /** Pointer to a continuous buffer. */ + AudioSampleBuffer* dataBuffer; float getDefaultThreshold(); -- GitLab