==============================================================================
| 28 | |
| 29 | //============================================================================== |
| 30 | GRainbowAudioProcessorEditor::GRainbowAudioProcessorEditor(GranularSynth& synth) |
| 31 | : AudioProcessorEditor(&synth), |
| 32 | mSynth(synth), |
| 33 | mParameters(synth.getParams()), |
| 34 | mArcSpec(synth.getParams()), |
| 35 | mTrimSelection(synth.getFormatManager(), synth.getParamUI()), |
| 36 | mProgressBar(PROGRESS_VALUE), |
| 37 | mTabsGrains(juce::TabbedButtonBar::Orientation::TabsAtTop), |
| 38 | mTabsLFOs(juce::TabbedButtonBar::Orientation::TabsAtTop), |
| 39 | mTabsEnvs(juce::TabbedButtonBar::Orientation::TabsAtTop), |
| 40 | mEnvAdsr(synth.getParams()), |
| 41 | mEnvGrain(synth.getParams()), |
| 42 | mAdjustPanel(synth.getParams()), |
| 43 | mModEnv1(0, synth.getParams()), |
| 44 | mModEnv2(1, synth.getParams()), |
| 45 | mModLFO1(0, synth.getParams()), |
| 46 | mModLFO2(1, synth.getParams()), |
| 47 | mModLFO3(2, synth.getParams()), |
| 48 | mMasterPanel(synth.getParams(), synth.getMeterSource()), |
| 49 | mPianoPanel(synth.getKeyboardState(), synth.getParams()) { |
| 50 | setLookAndFeel(&mRainbowLookAndFeel); |
| 51 | mRainbowLookAndFeel.setColour(juce::ComboBox::ColourIds::backgroundColourId, Utils::Colour::GLOBAL); |
| 52 | mRainbowLookAndFeel.setColour(juce::PopupMenu::ColourIds::backgroundColourId, Utils::Colour::GLOBAL); |
| 53 | juce::LookAndFeel::getDefaultLookAndFeel().setDefaultSansSerifTypeface(RainbowLookAndFeel::getCustomTypeface()); |
| 54 | |
| 55 | mErrorMessage.clear(); |
| 56 | |
| 57 | // Title and preset panel |
| 58 | mTitlePresetPanel.btnOpenFile.onClick = [this] { openNewFile(); }; |
| 59 | mTitlePresetPanel.btnSavePreset.onClick = [this] { savePreset(); }; |
| 60 | addAndMakeVisible(mTitlePresetPanel); |
| 61 | |
| 62 | if (!mParameters.ui.fileName.isEmpty()) { |
| 63 | mTitlePresetPanel.labelFileName.setText(mParameters.ui.fileName, juce::dontSendNotification); |
| 64 | } |
| 65 | |
| 66 | // Envelope/adjust tabs |
| 67 | juce::Image tabImage = juce::PNGImageFormat::loadFrom(BinaryData::grainEnv_png, BinaryData::grainEnv_pngSize); |
| 68 | auto* tabImageComp = new juce::ImageComponent(); |
| 69 | tabImageComp->setInterceptsMouseClicks(false, false); |
| 70 | tabImageComp->setImage(tabImage, juce::RectanglePlacement::onlyReduceInSize); |
| 71 | mTabsGrains.addTab("grain env", Utils::Colour::BACKGROUND, &mEnvGrain, false); |
| 72 | mTabsGrains.getTabbedButtonBar().getTabButton(0)->setExtraComponent(tabImageComp, juce::TabBarButton::ExtraComponentPlacement::beforeText); |
| 73 | |
| 74 | tabImage = juce::PNGImageFormat::loadFrom(BinaryData::adjust_png, BinaryData::adjust_pngSize); |
| 75 | tabImageComp = new juce::ImageComponent(); |
| 76 | tabImageComp->setInterceptsMouseClicks(false, false); |
| 77 | tabImageComp->setImage(tabImage, juce::RectanglePlacement::onlyReduceInSize); |
| 78 | mTabsGrains.addTab("adjust", Utils::Colour::BACKGROUND, &mAdjustPanel, false); |
| 79 | mTabsGrains.getTabbedButtonBar().getTabButton(1)->setExtraComponent(tabImageComp, juce::TabBarButton::ExtraComponentPlacement::beforeText); |
| 80 | mTabsGrains.getTabbedButtonBar().setColour(juce::TabbedButtonBar::ColourIds::tabTextColourId, Utils::Colour::GLOBAL); |
| 81 | mTabsGrains.getTabbedButtonBar().setColour(juce::TabbedButtonBar::ColourIds::frontTextColourId, Utils::Colour::GLOBAL); |
| 82 | mTabsGrains.setTabBarDepth(Utils::TAB_HEIGHT); |
| 83 | mTabsGrains.setOutline(0); |
| 84 | addAndMakeVisible(mTabsGrains); |
| 85 | |
| 86 | // Mod LFO tabs |
| 87 | mTabsLFOs.setTabBarDepth(Utils::TAB_HEIGHT); |
nothing calls this directly
no test coverage detected