Hi,
I’m having a problem with the ComboBox component. I connected it to an AudioProcessorValueTree as shown below. It does what I expect for the first couple of values in the enum
until it skips Position 5. Adding or removing values from the enum does not make a difference. you can see DBG
output in the code samples below.
Any ideas what the problem could be?
Setup
- Windows 10 64bit
- Visual Studio 2017
- JUCE 5.4.3
enum FilterType
{
NoFilter = 0,
HighPass,
HighPass1st,
LowShelf,
BandPass,
AllPass,
Notch,
Peak,
HighShelf,
LowPass1st,
LowPass,
LastFilterID
};
// IN EDITOR
for (int j = 0; j < LastFilterID; ++j)
{
String label(EQ::getFilterTypeName(static_cast<EQ::FilterType>(j));)
DBG(label+ ": " + String(j));
combobox.addItem(label, j+1);
}
boxAttachments.add(new ComboBoxAttachment(state, type_id, combobox));
// DBG Output
//
// No Filter: 0
// High Pass: 1
// 1st High Pass: 2
// Low Shelf: 3
// Band Pass: 4
// All Pass: 5
// Notch: 6
// Peak: 7
// High Shelf: 8
// 1st Low Pass: 9
// Low Pass: 10
// IN PROCESSOR
void EqualizerProcessor::parameterChanged(const String& parameter, float newValue)
{
DBG("CASTING " + String(newValue));
bands[i].type = static_cast<FilterType>(static_cast<int>(newValue));
}
// DBG Output selecting every combobox item in order
// CASTING 0
// CASTING 1
// CASTING 2
// CASTING 3
// CASTING 4
// CASTING 6