mirror of
https://codeberg.org/armin/trommelkiste.git
synced 2026-09-01 04:10:46 +02:00
Update plugin editor and processor
This commit is contained in:
parent
c774d521c8
commit
9bddd6076f
3 changed files with 127 additions and 78 deletions
|
|
@ -9,7 +9,7 @@ static const char* trackNames[] = {"BD", "RS", "SN", "CL", "CH", "PH", "OH", "R
|
|||
static const char* noteNames[] = {"C4","C#4","D4","D#4","E4","F4","F#4","G4","G#4","A4"};
|
||||
|
||||
static constexpr int ROW_H = 52;
|
||||
static constexpr int TOP = 82;
|
||||
static constexpr int TOP = 100;
|
||||
static constexpr int COL_LBL = 8;
|
||||
static constexpr int COL_KNOB = 44;
|
||||
static constexpr int KNOB_W = 44;
|
||||
|
|
@ -22,7 +22,7 @@ static constexpr int COL_REVERB = COL_DELAY + KNOB_W + KNOB_GAP;
|
|||
static constexpr int COL_RINGMOD = COL_REVERB + KNOB_W + KNOB_GAP;
|
||||
static constexpr int COL_DESTR = COL_RINGMOD + KNOB_W + KNOB_GAP;
|
||||
static constexpr int COL_SHUFFLE = COL_DESTR + KNOB_W + KNOB_GAP;
|
||||
static constexpr int TOTAL_W = COL_SHUFFLE + KNOB_W;
|
||||
static constexpr int TOTAL_W = COL_SHUFFLE + KNOB_W + 8;
|
||||
|
||||
// Header knob x positions (compact layout)
|
||||
static constexpr int HDR_KNOB = 36;
|
||||
|
|
@ -60,13 +60,30 @@ void TrommelkisteLookAndFeel::drawRotarySlider(Graphics& g, int x, int y, int w,
|
|||
|
||||
// Main body — vertical gradient (light top, dark bottom) for 3D cylinder feel
|
||||
{
|
||||
ColourGradient grad(Colour(0xFF323232), cx, cy - radius,
|
||||
Colour(0xFF1C1C1C), cx, cy + radius, true);
|
||||
grad.addColour(0.10, Colour(0x883D3D3D));
|
||||
ColourGradient grad(Colour(0xFF444444), cx, cy - radius,
|
||||
Colour(0xFF2C2C2C), cx, cy + radius, true);
|
||||
grad.addColour(0.35, Colour(0xFF3D3D3D));
|
||||
g.setGradientFill(grad);
|
||||
g.fillEllipse(cx - radius, cy - radius, radius * 2.0f, radius * 2.0f);
|
||||
}
|
||||
|
||||
// Top highlight ring (specular edge)
|
||||
{
|
||||
Path ring;
|
||||
ring.addCentredArc(cx, cy, radius - 0.5f, radius - 0.5f, 0.0f, 0.0f, MathConstants<float>::pi, true);
|
||||
g.setColour(Colour(0x1EFFFFFF));
|
||||
g.strokePath(ring, PathStrokeType(1.5f, PathStrokeType::curved, PathStrokeType::rounded));
|
||||
}
|
||||
|
||||
// Bottom dark ring
|
||||
{
|
||||
Path ring;
|
||||
ring.addCentredArc(cx, cy, radius - 0.5f, radius - 0.5f, 0.0f,
|
||||
MathConstants<float>::pi, MathConstants<float>::pi * 2.0f, true);
|
||||
g.setColour(Colour(0x1E000000));
|
||||
g.strokePath(ring, PathStrokeType(1.5f, PathStrokeType::curved, PathStrokeType::rounded));
|
||||
}
|
||||
|
||||
// Subtle specular highlight blob (top-left)
|
||||
{
|
||||
ColourGradient spec(Colour(0x18FFFFFF), cx - radius * 0.35f, cy - radius * 0.5f,
|
||||
|
|
@ -190,7 +207,7 @@ TrommelkisteEditor::TrommelkisteEditor(TrommelkisteProcessor& p)
|
|||
setLookAndFeel(&lnf);
|
||||
lnf.fontScale = 1.5f;
|
||||
uiScale = 1.5f;
|
||||
setSize(scaled(TOTAL_W), scaled(TOP + NUM_TRACKS * ROW_H));
|
||||
setSize(scaled(TOTAL_W), scaled(TOP + NUM_TRACKS * ROW_H + 12));
|
||||
setResizable(false, false);
|
||||
setWantsKeyboardFocus(false);
|
||||
|
||||
|
|
@ -371,7 +388,7 @@ TrommelkisteEditor::TrommelkisteEditor(TrommelkisteProcessor& p)
|
|||
globalShuffleDiv.setRange(0, 4, 1);
|
||||
globalShuffleDiv.setScrollWheelEnabled(false);
|
||||
globalShuffleDiv.formatFn = [](double v) {
|
||||
static const char* labels[] = { "OFF", "4", "8", "16", "32" };
|
||||
static const char* labels[] = { "1", "4", "8", "16", "32" };
|
||||
return labels[juce::jlimit(0, 4, (int)v)];
|
||||
};
|
||||
addAndMakeVisible(globalShuffleDiv);
|
||||
|
|
@ -416,7 +433,7 @@ void TrommelkisteEditor::timerCallback()
|
|||
const double now = juce::Time::getMillisecondCounterHiRes() / 1000.0;
|
||||
for (int i = 0; i < NUM_TRACKS; ++i)
|
||||
{
|
||||
if (proc.trackActive[i].exchange(false))
|
||||
if (proc.trackActive[i])
|
||||
trackActivatedTime[i] = now;
|
||||
}
|
||||
repaint();
|
||||
|
|
@ -430,7 +447,7 @@ void TrommelkisteEditor::scaleChanged()
|
|||
{
|
||||
uiScale = scales[selId - 1];
|
||||
lnf.fontScale = uiScale;
|
||||
setSize(scaled(TOTAL_W), scaled(TOP + NUM_TRACKS * ROW_H));
|
||||
setSize(scaled(TOTAL_W), scaled(TOP + NUM_TRACKS * ROW_H + 12));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -462,63 +479,52 @@ void TrommelkisteEditor::paint(Graphics& g)
|
|||
g.setFont(fontBold(16.0f, uiScale));
|
||||
g.drawText("TROMMELKISTE", scaled(10), scaled(4), scaled(400), scaled(20), Justification::centredLeft);
|
||||
|
||||
// VU meter
|
||||
{
|
||||
const float level = proc.outputLevel.load(std::memory_order_relaxed);
|
||||
const float meterX = 10.0f;
|
||||
const float meterY = 30.0f;
|
||||
const float meterW = 134.0f;
|
||||
const float meterH = 6.0f;
|
||||
|
||||
// Background
|
||||
g.setColour(Colour(0xFF111111));
|
||||
g.fillRect(scaled((int) meterX), scaled((int) meterY), scaled((int) meterW), scaled((int) meterH));
|
||||
|
||||
// Level bar
|
||||
float norm = jlimit(0.0f, 1.0f, level * 4.0f);
|
||||
float barW = meterW * norm;
|
||||
g.setColour(lnf.accent);
|
||||
g.fillRect(scaled((int) meterX), scaled((int) meterY), scaled((int) barW), scaled((int) meterH));
|
||||
}
|
||||
|
||||
g.setColour(lnf.accent.withAlpha(0.3f));
|
||||
g.fillRect(scaled(10), scaled(60), getWidth() - scaled(15), scaled(1));
|
||||
g.fillRect(scaled(10), scaled(71), scaled(getWidth() - 20), scaled(1));
|
||||
|
||||
// Section labels
|
||||
g.setColour(Colours::green.brighter(0.6f));
|
||||
g.setFont(font(8.0f, uiScale));
|
||||
int masterCenter = (HDR_VOL + HDR_DLYSYNC + HDR_KNOB) / 2;
|
||||
int shuffleCenter = (HDR_DIV + HDR_GRV + HDR_KNOB) / 2;
|
||||
g.drawText("MASTER", scaled(masterCenter - 20), scaled(0), scaled(40), scaled(8), Justification::centred);
|
||||
g.drawText("SHUFFLE", scaled(shuffleCenter - 20), scaled(0), scaled(40), scaled(8), Justification::centred);
|
||||
|
||||
g.setColour(Colours::white.withAlpha(0.9f));
|
||||
g.setFont(font(8.0f, uiScale));
|
||||
g.drawText("VOL", scaled(HDR_VOL), scaled(46), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("PAN", scaled(HDR_PAN), scaled(46), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("RING", scaled(HDR_RING), scaled(46), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("DEST", scaled(HDR_DEST), scaled(46), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("DLY", scaled(HDR_DELAY), scaled(46), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("REV", scaled(HDR_REVERB), scaled(46), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("SYNC", scaled(HDR_DLYSYNC), scaled(46), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("VOL", scaled(HDR_VOL), scaled(51), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("PAN", scaled(HDR_PAN), scaled(51), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("RING", scaled(HDR_RING), scaled(51), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("DEST", scaled(HDR_DEST), scaled(51), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("DLY", scaled(HDR_DELAY), scaled(51), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("REV", scaled(HDR_REVERB), scaled(51), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("SYNC", scaled(HDR_DLYSYNC), scaled(51), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
|
||||
// Shuffle section separator
|
||||
g.setColour(lnf.accent.withAlpha(0.5f));
|
||||
g.fillRect(scaled(HDR_DIV - 8), scaled(6), scaled(1), scaled(46));
|
||||
g.fillRect(scaled(HDR_DIV - 8), scaled(6), scaled(1), scaled(65));
|
||||
|
||||
g.setColour(Colours::white.withAlpha(0.9f));
|
||||
g.setFont(font(8.0f, uiScale));
|
||||
g.drawText("DIV", scaled(HDR_DIV), scaled(46), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("SHFL", scaled(HDR_SHFL), scaled(46), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("GRV", scaled(HDR_GRV), scaled(46), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("EVERY", scaled(HDR_DIV), scaled(51), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("AMT", scaled(HDR_SHFL), scaled(51), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
g.drawText("GROOVE", scaled(HDR_GRV), scaled(51), scaled(HDR_KNOB), scaled(10), Justification::centred);
|
||||
|
||||
g.setColour(Colours::white.withAlpha(0.9f));
|
||||
g.setFont(font(9.0f, uiScale));
|
||||
g.drawText("LVL", scaled(COL_KNOB), scaled(65), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("LEN", scaled(COL_KNOB + 1*(KNOB_W + KNOB_GAP)), scaled(65), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("VEL", scaled(COL_KNOB + 2*(KNOB_W + KNOB_GAP)), scaled(65), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("PIT", scaled(COL_KNOB + 3*(KNOB_W + KNOB_GAP)), scaled(65), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("TONE", scaled(COL_KNOB + 4*(KNOB_W + KNOB_GAP)), scaled(65), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("PAN", scaled(COL_KNOB + 5*(KNOB_W + KNOB_GAP)), scaled(65), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("DECAY", scaled(COL_DECAY), scaled(65), scaled(68), scaled(12), Justification::centred);
|
||||
g.drawText("SAMPLE", scaled(COL_FILE), scaled(65), scaled(SAMPLE_W), scaled(12), Justification::centred);
|
||||
g.drawText("DELAY", scaled(COL_DELAY), scaled(65), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("REVERB", scaled(COL_REVERB), scaled(65), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("RING", scaled(COL_RINGMOD), scaled(65), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("DESTR", scaled(COL_DESTR), scaled(65), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("SHFL", scaled(COL_SHUFFLE), scaled(65), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("LVL", scaled(COL_KNOB), scaled(78), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("LEN", scaled(COL_KNOB + 1*(KNOB_W + KNOB_GAP)), scaled(78), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("VEL", scaled(COL_KNOB + 2*(KNOB_W + KNOB_GAP)), scaled(78), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("PIT", scaled(COL_KNOB + 3*(KNOB_W + KNOB_GAP)), scaled(78), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("TONE", scaled(COL_KNOB + 4*(KNOB_W + KNOB_GAP)), scaled(78), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("PAN", scaled(COL_KNOB + 5*(KNOB_W + KNOB_GAP)), scaled(78), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("DECAY", scaled(COL_DECAY), scaled(78), scaled(68), scaled(12), Justification::centred);
|
||||
g.drawText("SAMPLE", scaled(COL_FILE), scaled(78), scaled(SAMPLE_W), scaled(12), Justification::centred);
|
||||
g.drawText("DELAY", scaled(COL_DELAY), scaled(78), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("REVERB", scaled(COL_REVERB), scaled(78), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("RING", scaled(COL_RINGMOD), scaled(78), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("DESTR", scaled(COL_DESTR), scaled(78), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
g.drawText("SHFL", scaled(COL_SHUFFLE), scaled(78), scaled(KNOB_W), scaled(12), Justification::centred);
|
||||
|
||||
const double now = juce::Time::getMillisecondCounterHiRes() / 1000.0;
|
||||
for (int i = 0; i < NUM_TRACKS; ++i)
|
||||
|
|
@ -553,11 +559,11 @@ void TrommelkisteEditor::paint(Graphics& g)
|
|||
|
||||
g.setColour(Colours::white);
|
||||
g.setFont(fontBold(12.0f, uiScale));
|
||||
g.drawText(trackNames[i], scaled(COL_LBL), scaled(ry + 14), scaled(32), scaled(16), Justification::centredLeft);
|
||||
g.drawText(trackNames[i], scaled(COL_LBL), scaled(ry + 6), scaled(32), scaled(16), Justification::centredLeft);
|
||||
|
||||
g.setColour(Colour(0xFF666666));
|
||||
g.setFont(font(9.0f, uiScale));
|
||||
g.drawText(noteNames[i], scaled(COL_LBL), scaled(ry + 28), scaled(32), scaled(14), Justification::centredLeft);
|
||||
g.drawText(noteNames[i], scaled(COL_LBL), scaled(ry + 24), scaled(32), scaled(14), Justification::centredLeft);
|
||||
|
||||
const double elapsed = now - trackActivatedTime[i];
|
||||
if (elapsed < 0.4)
|
||||
|
|
@ -579,16 +585,16 @@ void TrommelkisteEditor::resized()
|
|||
|
||||
// Header knobs
|
||||
const int hk = HDR_KNOB;
|
||||
masterVolume.setBounds(scaled(HDR_VOL), scaled(8), scaled(hk), scaled(hk));
|
||||
masterPan.setBounds(scaled(HDR_PAN), scaled(8), scaled(hk), scaled(hk));
|
||||
globalRingFreq.setBounds(scaled(HDR_RING), scaled(8), scaled(hk), scaled(hk));
|
||||
globalDestruction.setBounds(scaled(HDR_DEST), scaled(8), scaled(hk), scaled(hk));
|
||||
masterDelay.setBounds(scaled(HDR_DELAY), scaled(8), scaled(hk), scaled(hk));
|
||||
masterReverb.setBounds(scaled(HDR_REVERB), scaled(8), scaled(hk), scaled(hk));
|
||||
delaySyncDiv.setBounds(scaled(HDR_DLYSYNC), scaled(8), scaled(hk), scaled(hk));
|
||||
globalShuffleDiv.setBounds(scaled(HDR_DIV), scaled(8), scaled(hk), scaled(hk));
|
||||
globalShuffleAmt.setBounds(scaled(HDR_SHFL), scaled(8), scaled(hk), scaled(hk));
|
||||
globalGroove.setBounds(scaled(HDR_GRV), scaled(8), scaled(hk), scaled(hk));
|
||||
masterVolume.setBounds(scaled(HDR_VOL), scaled(13), scaled(hk), scaled(hk));
|
||||
masterPan.setBounds(scaled(HDR_PAN), scaled(13), scaled(hk), scaled(hk));
|
||||
globalRingFreq.setBounds(scaled(HDR_RING), scaled(13), scaled(hk), scaled(hk));
|
||||
globalDestruction.setBounds(scaled(HDR_DEST), scaled(13), scaled(hk), scaled(hk));
|
||||
masterDelay.setBounds(scaled(HDR_DELAY), scaled(13), scaled(hk), scaled(hk));
|
||||
masterReverb.setBounds(scaled(HDR_REVERB), scaled(13), scaled(hk), scaled(hk));
|
||||
delaySyncDiv.setBounds(scaled(HDR_DLYSYNC), scaled(13), scaled(hk), scaled(hk));
|
||||
globalShuffleDiv.setBounds(scaled(HDR_DIV), scaled(13), scaled(hk), scaled(hk));
|
||||
globalShuffleAmt.setBounds(scaled(HDR_SHFL), scaled(13), scaled(hk), scaled(hk));
|
||||
globalGroove.setBounds(scaled(HDR_GRV), scaled(13), scaled(hk), scaled(hk));
|
||||
|
||||
for (int i = 0; i < NUM_TRACKS; ++i)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue