Skip to content

Commit 75b5368

Browse files
committed
Add LFPViewer updates channel names when switching processors
1 parent 9a704fb commit 75b5368

1 file changed

Lines changed: 7 additions & 15 deletions

File tree

Plugins/LfpDisplayNode/LfpDisplayCanvas.cpp

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
3737
{
3838

3939
nChans = processor->getNumSubprocessorChannels();
40-
std::cout << "Setting num inputs on LfpDisplayCanvas to " << nChans << std::endl;
4140

4241
displayBuffer = processor->getDisplayBufferAddress();
4342
displayBufferSize = displayBuffer->getNumSamples();
44-
std::cout << "Setting displayBufferSize on LfpDisplayCanvas to " << displayBufferSize << std::endl;
4543

4644
screenBuffer = new AudioSampleBuffer(MAX_N_CHAN, MAX_N_SAMP);
4745
screenBuffer->clear();
@@ -184,7 +182,6 @@ void LfpDisplayCanvas::resizeToChannels(bool respectViewportPosition)
184182

185183
void LfpDisplayCanvas::beginAnimation()
186184
{
187-
std::cout << "Beginning animation." << std::endl;
188185

189186
if (true)
190187
{
@@ -204,20 +201,18 @@ void LfpDisplayCanvas::endAnimation()
204201
{
205202
if (true)
206203
{
207-
std::cout << "Ending animation." << std::endl;
208204

209205
stopCallbacks();
210206
}
211207
}
212208

213209
void LfpDisplayCanvas::update()
214210
{
211+
215212
displayBufferSize = displayBuffer->getNumSamples();
216213

217214
nChans = jmax(processor->getNumSubprocessorChannels(), 0);
218215

219-
std::cout << "Num chans: " << nChans << std::endl;
220-
221216
resizeSamplesPerPixelBuffer(nChans);
222217

223218
sampleRate = 30000; // default
@@ -232,32 +227,31 @@ void LfpDisplayCanvas::update()
232227
// must manually ensure that overlapSelection propagates up to canvas
233228
channelOverlapFactor = options->selectedOverlapValue.getFloatValue();
234229

235-
std::cout << "Checking channels: " << nChans << std::endl;
236-
230+
int firstChannelInSubprocessor = 0;
237231
for (int i = 0, nInputs = processor->getNumInputs(); i < nInputs; i++)
238232
{
233+
239234
if (processor->getDataSubprocId(i) == drawableSubprocessor)
240235
{
241236
sampleRate = processor->getDataChannel(i)->getSampleRate();
237+
firstChannelInSubprocessor = i;
242238
break;
243239
}
240+
244241
}
245242

246-
std::cout << "Checking channel alignment: " << nChans << std::endl;
247243
if (nChans != lfpDisplay->getNumChannels())
248244
{
249-
std::cout << "Refreshing screen buffer" << std::endl;
250245
refreshScreenBuffer();
251246

252-
std::cout << "Changing channels on LFP display" << std::endl;
253247
if (nChans > 0)
254248
lfpDisplay->setNumChannels(nChans);
255249

256250
// update channel names
257251
//std::cout << "Updating channel names" << std::endl;
258252
for (int i = 0; i < nChans; i++)
259253
{
260-
String chName = processor->getDataChannel(i)->getName();
254+
String chName = processor->getDataChannel(firstChannelInSubprocessor + i)->getName();
261255
lfpDisplay->channelInfo[i]->setName(chName);
262256
lfpDisplay->setEnabledState(isChannelEnabled[i], i);
263257
}
@@ -274,15 +268,14 @@ void LfpDisplayCanvas::update()
274268
{
275269
for (int i = 0; i < nChans; i++)
276270
{
277-
String chName = processor->getDataChannel(i)->getName();
271+
String chName = processor->getDataChannel(firstChannelInSubprocessor + i)->getName();
278272
lfpDisplay->channelInfo[i]->setName(chName);
279273
lfpDisplay->channels[i]->updateType();
280274
lfpDisplay->channelInfo[i]->updateType();
281275
}
282276

283277
if (nChans > 0)
284278
{
285-
std::cout << "Rebuilding drawable channels" << std::endl;
286279
lfpDisplay->rebuildDrawableChannelsList();
287280
}
288281
}
@@ -632,7 +625,6 @@ void LfpDisplayCanvas::setDrawableSampleRate(float samplerate)
632625
void LfpDisplayCanvas::setDrawableSubprocessor(uint32 sp)
633626
{
634627
drawableSubprocessor = sp;
635-
std::cout << "Setting LFP canvas subprocessor to " << sp << std::endl;
636628
displayBuffer = processor->getDisplayBufferAddress();
637629
update();
638630
}

0 commit comments

Comments
 (0)