Skip to content

Commit eeaaa4f

Browse files
committed
Fix MaskChannelsParameter value copying when actual channel count exceeds saved count
1 parent 8553e28 commit eeaaa4f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Source/Processors/Parameter/ParameterCollection.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ void ParameterCollection::copyParameterValuesTo (ParameterOwner* pOwner)
9696
{
9797
MaskChannelsParameter* targetMaskParam = (MaskChannelsParameter*) targetParam;
9898
int targetChannelCount = targetMaskParam->getChannelCount();
99+
const int savedChannelCount = owner.channel_count;
99100

100101
Array<var> filteredValues;
101102
for (int i = 0; i < parameter->getValue().getArray()->size(); i++)
@@ -104,6 +105,15 @@ void ParameterCollection::copyParameterValuesTo (ParameterOwner* pOwner)
104105
if (channelIndex >= 0 && channelIndex < targetChannelCount)
105106
filteredValues.add (channelIndex);
106107
}
108+
109+
// Auto-include any channels that exist on the device but were absent in the
110+
// saved configuration (e.g., saved with fewer channels than currently available).
111+
if (targetChannelCount > savedChannelCount)
112+
{
113+
for (int ch = savedChannelCount; ch < targetChannelCount; ++ch)
114+
filteredValues.addIfNotAlreadyThere (ch);
115+
}
116+
107117
targetParam->currentValue = filteredValues;
108118
}
109119
else if (parameter->getType() == Parameter::SELECTED_CHANNELS_PARAM)

0 commit comments

Comments
 (0)