- 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>
48 sor
1.2 KiB
C++
48 sor
1.2 KiB
C++
#pragma once
|
|
#include <JuceHeader.h>
|
|
|
|
class VuMeter : public juce::Component
|
|
{
|
|
public:
|
|
void setLevel (float left, float right)
|
|
{
|
|
levelL = left;
|
|
levelR = right;
|
|
repaint();
|
|
}
|
|
|
|
void paint (juce::Graphics& g) override
|
|
{
|
|
auto bounds = getLocalBounds().toFloat().reduced (1);
|
|
float halfW = bounds.getWidth() / 2.0f - 1;
|
|
auto leftBar = bounds.removeFromLeft (halfW);
|
|
bounds.removeFromLeft (2);
|
|
auto rightBar = bounds;
|
|
|
|
drawBar (g, leftBar, levelL);
|
|
drawBar (g, rightBar, levelR);
|
|
}
|
|
|
|
private:
|
|
float levelL = 0.0f, levelR = 0.0f;
|
|
|
|
void drawBar (juce::Graphics& g, juce::Rectangle<float> bar, float level)
|
|
{
|
|
g.setColour (juce::Colour (0xff222233));
|
|
g.fillRoundedRectangle (bar, 2.0f);
|
|
|
|
float h = bar.getHeight() * juce::jlimit (0.0f, 1.0f, level);
|
|
auto filled = bar.removeFromBottom (h);
|
|
|
|
// Green -> Yellow -> Red gradient
|
|
if (level < 0.6f)
|
|
g.setColour (juce::Colour (0xff00cc44));
|
|
else if (level < 0.85f)
|
|
g.setColour (juce::Colour (0xffcccc00));
|
|
else
|
|
g.setColour (juce::Colour (0xffff3333));
|
|
|
|
g.fillRoundedRectangle (filled, 2.0f);
|
|
}
|
|
};
|