mirror of
https://codeberg.org/armin/sm-26.git
synced 2026-10-11 17:01:53 +02:00
Fetch JUCE into build/, tidy gitignore, expand README
This commit is contained in:
parent
4a761729f8
commit
ab9ea542a7
12 changed files with 350 additions and 149 deletions
|
|
@ -68,10 +68,17 @@ void SM26AudioProcessorEditor::setupKnobs()
|
|||
}
|
||||
}
|
||||
|
||||
juce::Font SM26AudioProcessorEditor::NavButtonLookAndFeel::getTextButtonFont (juce::TextButton&, int)
|
||||
{
|
||||
return juce::Font (juce::FontOptions { juce::Font::getDefaultMonospacedFontName(),
|
||||
10.5f, juce::Font::bold });
|
||||
}
|
||||
|
||||
void SM26AudioProcessorEditor::setupNavButtons()
|
||||
{
|
||||
auto setup = [this](juce::TextButton& btn, juce::Colour bg)
|
||||
{
|
||||
btn.setLookAndFeel (&navLookAndFeel);
|
||||
btn.setColour (juce::TextButton::buttonColourId, bg);
|
||||
btn.setColour (juce::TextButton::textColourOffId, juce::Colour (0xFFE0E0C0));
|
||||
btn.setColour (juce::ComboBox::outlineColourId, juce::Colour (0xFF2A4A18));
|
||||
|
|
@ -85,14 +92,22 @@ void SM26AudioProcessorEditor::setupNavButtons()
|
|||
setup (navEnter, juce::Colour (0xFF3A6A28));
|
||||
setup (navEsc, juce::Colour (0xFF3A2A18));
|
||||
|
||||
navUp.onClick = [this] { menu.up(); };
|
||||
navDown.onClick = [this] { menu.down(); };
|
||||
navUp.onClick = [this] { if (menu.isOpen()) menu.up(); else cyclePreset (-1); };
|
||||
navDown.onClick = [this] { if (menu.isOpen()) menu.down(); else cyclePreset (+1); };
|
||||
navLeft.onClick = [this] { menu.left(); };
|
||||
navRight.onClick = [this] { menu.right(); };
|
||||
navEnter.onClick = [this] { menu.open(); };
|
||||
navEsc.onClick = [this] { if (menu.isOpen()) menu.escape(); else menu.close(); };
|
||||
}
|
||||
|
||||
void SM26AudioProcessorEditor::cyclePreset (int delta)
|
||||
{
|
||||
const int count = sm26::PresetStore::count();
|
||||
if (count <= 0) return;
|
||||
const int idx = proc.engine.presetIndex();
|
||||
proc.setPresetByIndex ((idx + delta + count) % count);
|
||||
}
|
||||
|
||||
void SM26AudioProcessorEditor::buildRootMenu()
|
||||
{
|
||||
auto builder = [this]() -> MenuScreen
|
||||
|
|
@ -356,7 +371,7 @@ void SM26AudioProcessorEditor::buildRootMenu()
|
|||
}
|
||||
{
|
||||
MenuItem m2;
|
||||
m2.label = "48 presets | VST3 + AU";
|
||||
m2.label = "52 presets | VST3 + AU";
|
||||
m2.kind = MenuItem::Action;
|
||||
as.items.push_back (m2);
|
||||
}
|
||||
|
|
@ -463,7 +478,7 @@ void SM26AudioProcessorEditor::resized()
|
|||
float knobGap = 18.0f;
|
||||
float knobsW = 4.0f * knobSize + 3.0f * knobGap;
|
||||
float knobsX = (totalW - knobsW) / 2.0f;
|
||||
float knobsY = totalH - 135.0f;
|
||||
float knobsY = juce::jmax (190.0f, totalH - 265.0f);
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
|
|
@ -504,7 +519,11 @@ void SM26AudioProcessorEditor::timerCallback()
|
|||
{
|
||||
auto kv = proc.engine.knobView (i);
|
||||
float val = proc.engine.getParam (kv.param);
|
||||
knobSliders[i].setValue (val, juce::dontSendNotification);
|
||||
if (! knobDragging[i])
|
||||
{
|
||||
float pos = sm26::clamp01 ((val - kv.lo) / (kv.hi - kv.lo + 1e-9f));
|
||||
knobSliders[i].setValue (pos, juce::dontSendNotification);
|
||||
}
|
||||
knobLabels[i].setText (kv.name, juce::dontSendNotification);
|
||||
knobValueLabels[i].setText (sm26::formatParamReal (kv.param, val), juce::dontSendNotification);
|
||||
}
|
||||
|
|
@ -526,11 +545,27 @@ void SM26AudioProcessorEditor::sliderValueChanged (juce::Slider* s)
|
|||
auto kv = proc.engine.knobView (i);
|
||||
float paramVal = sm26::clamp01 (kv.lo + v * (kv.hi - kv.lo));
|
||||
proc.engine.setParam (kv.param, paramVal);
|
||||
knobValueLabels[i].setText (sm26::formatParamReal (kv.param, paramVal),
|
||||
juce::dontSendNotification);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SM26AudioProcessorEditor::sliderDragStarted (juce::Slider* s)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
if (s == &knobSliders[i])
|
||||
knobDragging[i] = true;
|
||||
}
|
||||
|
||||
void SM26AudioProcessorEditor::sliderDragEnded (juce::Slider* s)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
if (s == &knobSliders[i])
|
||||
knobDragging[i] = false;
|
||||
}
|
||||
|
||||
void SM26AudioProcessorEditor::updateLCD()
|
||||
{
|
||||
if (! menu.isOpen())
|
||||
|
|
@ -563,7 +598,8 @@ void SM26AudioProcessorEditor::updateLCD()
|
|||
int notes = proc.engine.notesPlaying();
|
||||
juce::String notesStr = notes > 0 ? "NOTES:" + juce::String (notes) : "";
|
||||
|
||||
lcd.setLine (3, juce::String ("SM-26") + " " + bpmStr + " " + notesStr);
|
||||
lcd.setLine (3, juce::String ("SM-26") + " " + bpmStr + " " + notesStr
|
||||
+ " UP/DN=PATCH OK=MENU");
|
||||
lcd.showCursor (false);
|
||||
}
|
||||
else
|
||||
|
|
@ -582,7 +618,7 @@ void SM26AudioProcessorEditor::updateLCD()
|
|||
line = line + " [ENTER]";
|
||||
lcd.setLine (1 + row, line);
|
||||
}
|
||||
lcd.setLine (3, "UP/DOWN=SEL L/R=VAL ENTER=OK ESC=BACK");
|
||||
lcd.setLine (3, "UP/DN=SEL L/R=VAL OK=OK ESC=BACK");
|
||||
lcd.showCursor (false);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue