File tree Expand file tree Collapse file tree
Source/Processors/Parameter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -361,10 +361,24 @@ SelectedChannelsParameter::SelectedChannelsParameter(GenericProcessor* processor
361361void SelectedChannelsParameter::setNextValue (var newValue_)
362362{
363363
364- if (newValue_.getArray ()->size () <= maxSelectableChannels)
364+ if (newValue_ == currentValue)
365+ return ;
366+
367+ int arraySize = newValue_.getArray ()->size ();
368+ if (arraySize <= maxSelectableChannels && arraySize <= channelCount)
365369 {
370+ for (int i = 0 ; i < arraySize; i++)
371+ {
372+ if ((int ) newValue_[i] < 0 || (int ) newValue_[i] >= channelCount)
373+ return ;
374+ }
375+
366376 newValue = newValue_;
367377 }
378+ else
379+ {
380+ return ;
381+ }
368382
369383 processor->parameterChangeRequest (this );
370384}
@@ -446,9 +460,23 @@ Array<var> SelectedChannelsParameter::parseSelectedString(const String& input)
446460 return selectedChannels;
447461}
448462
449- void SelectedChannelsParameter::setChannelCount (int count )
463+ void SelectedChannelsParameter::setChannelCount (int newCount )
450464{
451- channelCount = count;
465+ if (channelCount > newCount && getScope () != ParameterScope::SPIKE_CHANNEL_SCOPE)
466+ {
467+ Array<var> values;
468+ for (int i = 0 ; i < currentValue.getArray ()->size (); i++)
469+ {
470+ if ((int ) currentValue[i] < newCount)
471+ {
472+ values.add (currentValue[i]);
473+ }
474+ }
475+
476+ currentValue = values;
477+ }
478+
479+ channelCount = newCount;
452480
453481 // std::cout << "Setting selected channels channels count to " << count << " at " << this << std::endl;
454482}
You can’t perform that action at this time.
0 commit comments