Skip to content

Commit 25003b9

Browse files
authored
Merge pull request #330 from anjaldoshi/lfp-refactor
Support on-the-fly sub-processor switching in LFP Viewer
2 parents 4fb6923 + 343d1b6 commit 25003b9

6 files changed

Lines changed: 182 additions & 139 deletions

File tree

Plugins/LfpDisplayNode/LfpDisplayCanvas.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ void LfpDisplayCanvas::endAnimation()
212212

213213
void LfpDisplayCanvas::update()
214214
{
215-
nChans = jmax(processor->getNumSubprocessorChannels(), 0);
215+
displayBufferSize = displayBuffer->getNumSamples();
216+
217+
nChans = jmax(processor->getNumSubprocessorChannels(), 0);
216218

217219
std::cout << "Num chans: " << nChans << std::endl;
218220

@@ -631,6 +633,7 @@ void LfpDisplayCanvas::setDrawableSubprocessor(uint32 sp)
631633
{
632634
drawableSubprocessor = sp;
633635
std::cout << "Setting LFP canvas subprocessor to " << sp << std::endl;
636+
displayBuffer = processor->getDisplayBufferAddress();
634637
update();
635638
}
636639

@@ -816,7 +819,7 @@ LfpDisplayOptions::LfpDisplayOptions(LfpDisplayCanvas* canvas_, LfpTimescale* ti
816819
selectedVoltageRange[DataChannel::HEADSTAGE_CHANNEL] = 4;
817820
rangeGain[DataChannel::HEADSTAGE_CHANNEL] = 1; //uV
818821
rangeSteps[DataChannel::HEADSTAGE_CHANNEL] = 10;
819-
rangeUnits.add("uV");
822+
rangeUnits.add(CharPointer_UTF8("\xC2\xB5V"));
820823
typeNames.add("DATA");
821824

822825
UtilityButton* tbut;

Plugins/LfpDisplayNode/LfpDisplayCanvas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class LfpDisplayCanvas : public Visualizer,
182182
//float waves[MAX_N_CHAN][MAX_N_SAMP*2]; // we need an x and y point for each sample
183183

184184
LfpDisplayNode* processor;
185-
AudioSampleBuffer* displayBuffer; // sample wise data buffer for display
185+
std::shared_ptr<AudioSampleBuffer> displayBuffer; // sample wise data buffer for display
186186
ScopedPointer<AudioSampleBuffer> screenBuffer; // subsampled buffer- one int per pixel
187187

188188
//'define 3 buffers for min mean and max for better plotting of spikes

Plugins/LfpDisplayNode/LfpDisplayEditor.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ LfpDisplayEditor::~LfpDisplayEditor()
5858

5959
void LfpDisplayEditor::startAcquisition()
6060
{
61-
subprocessorSelection->setEnabled(false);
61+
//subprocessorSelection->setEnabled(false);
6262
}
6363

6464
void LfpDisplayEditor::stopAcquisition()
6565
{
66-
subprocessorSelection->setEnabled(true);
66+
//subprocessorSelection->setEnabled(true);
6767
}
6868

6969
Visualizer* LfpDisplayEditor::createNewCanvas()
@@ -170,6 +170,11 @@ void LfpDisplayEditor::updateSubprocessorSelectorOptions()
170170
}
171171
}
172172

173+
SortedSet<uint32> LfpDisplayEditor::getInputSubprocessors()
174+
{
175+
return inputSubprocessors;
176+
}
177+
173178
void LfpDisplayEditor::saveVisualizerParameters(XmlElement* xml)
174179
{
175180

Plugins/LfpDisplayNode/LfpDisplayEditor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ class LfpDisplayEditor : public VisualizerEditor,
7777
*/
7878
void updateSubprocessorSelectorOptions();
7979

80+
SortedSet<uint32> getInputSubprocessors();
81+
8082
private:
8183

8284
SortedSet<uint32> inputSubprocessors;

0 commit comments

Comments
 (0)