- 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>
41 sor
1.3 KiB
C++
41 sor
1.3 KiB
C++
#pragma once
|
|
#include <JuceHeader.h>
|
|
#include "DrumPad.h"
|
|
|
|
class PadComponent : public juce::Component,
|
|
public juce::FileDragAndDropTarget
|
|
{
|
|
public:
|
|
PadComponent (DrumPad& pad, std::function<void(int, const juce::File&)> loadCallback, int padIndex);
|
|
|
|
void paint (juce::Graphics& g) override;
|
|
void resized() override;
|
|
|
|
void mouseDown (const juce::MouseEvent& event) override;
|
|
void mouseUp (const juce::MouseEvent& event) override;
|
|
|
|
// Drag & Drop
|
|
bool isInterestedInFileDrag (const juce::StringArray& files) override;
|
|
void filesDropped (const juce::StringArray& files, int x, int y) override;
|
|
void fileDragEnter (const juce::StringArray& files, int x, int y) override;
|
|
void fileDragExit (const juce::StringArray& files) override;
|
|
|
|
void setSelected (bool sel) { selected = sel; repaint(); }
|
|
bool isSelected() const { return selected; }
|
|
|
|
// Callback when pad is selected (left click)
|
|
std::function<void(int)> onSelected;
|
|
|
|
private:
|
|
DrumPad& drumPad;
|
|
std::function<void(int, const juce::File&)> onLoadSample;
|
|
int index;
|
|
bool isPressed = false;
|
|
bool isDragOver = false;
|
|
bool selected = false;
|
|
|
|
void drawWaveformThumbnail (juce::Graphics& g, juce::Rectangle<float> area);
|
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PadComponent)
|
|
};
|