diff --git a/Source/Processors/SpikeDetector.cpp b/Source/Processors/SpikeDetector.cpp index ba397d0025b52f765241610b715be81724a6745c..a025f67e8304af93010b99f3c9d5072a262dd2cb 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 3a5350f0f3432008ca35db220537d86d2bff317c..c84ec682b8962b9cc479a28f0a33d019c45e8a98 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();