==============================================================================
| 12 | #include <algorithm> |
| 13 | //============================================================================== |
| 14 | Multiband::Multiband(FireAudioProcessor& p, state::StateComponent& sc) : processor(p), stateComponent(sc) |
| 15 | { |
| 16 | bandUIs.resize(4); |
| 17 | for (int i = 0; i < 4; ++i) |
| 18 | { |
| 19 | bandUIs[i].id = i; |
| 20 | |
| 21 | bandUIs[i].soloButton = std::make_unique<SoloButton>(); |
| 22 | addAndMakeVisible(*bandUIs[i].soloButton); |
| 23 | bandUIs[i].soloButton->addListener(this); |
| 24 | |
| 25 | bandUIs[i].enableButton = std::make_unique<EnableButton>(); |
| 26 | addAndMakeVisible(*bandUIs[i].enableButton); |
| 27 | bandUIs[i].enableButton->addListener(this); |
| 28 | |
| 29 | bandUIs[i].closeButton = std::make_unique<CloseButton>(); |
| 30 | addAndMakeVisible(*bandUIs[i].closeButton); |
| 31 | bandUIs[i].closeButton->addListener(this); |
| 32 | } |
| 33 | |
| 34 | // Init Vertical Lines |
| 35 | for (int i = 0; i < 3; i++) |
| 36 | { |
| 37 | freqDividerGroup[i] = std::make_unique<FreqDividerGroup>(processor, i); // set index |
| 38 | addAndMakeVisible(*freqDividerGroup[i]); |
| 39 | (freqDividerGroup[i]->getVerticalLine()).addListener(this); |
| 40 | (freqDividerGroup[i]->getVerticalLine()).addMouseListener(this, true); |
| 41 | float freqValue = freqDividerGroup[i]->getVerticalLine().getValue(); |
| 42 | float xPercent = static_cast<float>(transformToLog(freqValue)); |
| 43 | freqDividerGroup[i]->getVerticalLine().setXPercent(xPercent); |
| 44 | } |
| 45 | |
| 46 | // Initialize parameter arrays for each band |
| 47 | paramsArrays.resize(4); |
| 48 | const auto& bandParams = ParameterIDAndName::getBandParameterInfo(); |
| 49 | for (int i = 0; i < 4; ++i) |
| 50 | { |
| 51 | paramsArrays[i].clear(); |
| 52 | for (const auto& paramInfo : bandParams) |
| 53 | { |
| 54 | paramsArrays[i].push_back(ParameterIDAndName::getIDString(paramInfo.idBase, i)); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | // Initialize attachments using loops |
| 59 | multiEnableAttachments.resize(4); |
| 60 | multiSoloAttachments.resize(4); |
| 61 | for (int i = 0; i < 4; ++i) |
| 62 | { |
| 63 | multiEnableAttachments[i] = std::make_unique<juce::AudioProcessorValueTreeState::ButtonAttachment>( |
| 64 | processor.treeState, ParameterIDAndName::getIDString(BAND_ENABLE_ID, i), *bandUIs[i].enableButton); |
| 65 | |
| 66 | multiSoloAttachments[i] = std::make_unique<juce::AudioProcessorValueTreeState::ButtonAttachment>( |
| 67 | processor.treeState, ParameterIDAndName::getIDString(BAND_SOLO_ID, i), *bandUIs[i].soloButton); |
| 68 | } |
| 69 | |
| 70 | freqDividerGroupAttachments.resize(3); |
| 71 | for (int i = 0; i < 3; ++i) |
nothing calls this directly
no test coverage detected