Files
InstaDrums/Source/MasterPanel.cpp
hariel1985 4cc22e0bf0 Initial commit: InstaDrums VST3 drum sampler plugin
- 12-pad drum sampler with 4x3 grid (expandable by 4)
- Velocity layers with round-robin (Salamander-style filename parsing)
- Rhythm Engine-style GUI: pad grid (left), sample editor (right top),
  FX panel (right bottom), master panel (bottom)
- Waveform thumbnails on pads + large waveform in sample editor
- ADSR envelope, pitch, pan per pad
- Drag & drop sample/folder loading
- Kit save/load (.drumkit XML presets)
- Load Folder with smart name matching (kick, snare, hihat, etc.)
- Choke groups, one-shot/polyphonic mode
- Dark modern LookAndFeel with neon accent colors
- Built with JUCE framework, CMake, MSVC 2022

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 10:59:31 +01:00

63 sor
2.1 KiB
C++

#include "MasterPanel.h"
#include "LookAndFeel.h"
MasterPanel::MasterPanel()
{
masterTitle.setFont (juce::FontOptions (12.0f, juce::Font::bold));
masterTitle.setColour (juce::Label::textColourId, InstaDrumsLookAndFeel::textSecondary);
addAndMakeVisible (masterTitle);
setupKnob (volumeSlider, volumeLabel, "Volume", 0.0, 2.0, 1.0, 0.01);
setupKnob (tuneSlider, tuneLabel, "Tune", -12.0, 12.0, 0.0, 0.1);
setupKnob (panSlider, panLabel, "Pan", -1.0, 1.0, 0.0, 0.01);
addAndMakeVisible (vuMeter);
}
void MasterPanel::setupKnob (juce::Slider& s, juce::Label& l, const juce::String& name,
double min, double max, double val, double step)
{
s.setSliderStyle (juce::Slider::RotaryHorizontalVerticalDrag);
s.setTextBoxStyle (juce::Slider::NoTextBox, false, 0, 0);
s.setRange (min, max, step);
s.setValue (val, juce::dontSendNotification);
addAndMakeVisible (s);
l.setText (name, juce::dontSendNotification);
l.setFont (juce::FontOptions (9.0f));
l.setColour (juce::Label::textColourId, InstaDrumsLookAndFeel::textSecondary);
l.setJustificationType (juce::Justification::centred);
addAndMakeVisible (l);
}
void MasterPanel::paint (juce::Graphics& g)
{
auto bounds = getLocalBounds().toFloat();
g.setColour (InstaDrumsLookAndFeel::bgMedium.darker (0.2f));
g.fillRoundedRectangle (bounds, 4.0f);
g.setColour (InstaDrumsLookAndFeel::bgLight.withAlpha (0.3f));
g.drawRoundedRectangle (bounds, 4.0f, 1.0f);
}
void MasterPanel::resized()
{
auto area = getLocalBounds().reduced (4);
masterTitle.setBounds (area.removeFromLeft (55).reduced (0, 2));
// VU meter on the right
vuMeter.setBounds (area.removeFromRight (24).reduced (0, 2));
area.removeFromRight (4);
// Knobs
int knobW = area.getWidth() / 3;
juce::Slider* sliders[] = { &volumeSlider, &tuneSlider, &panSlider };
juce::Label* labels[] = { &volumeLabel, &tuneLabel, &panLabel };
for (int i = 0; i < 3; ++i)
{
auto col = area.removeFromLeft (knobW);
labels[i]->setBounds (col.removeFromBottom (12));
sliders[i]->setBounds (col);
}
}