Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOre accessibility #94

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/sst/sst-jucegui
15 changes: 10 additions & 5 deletions src/ui/dahdsr-components.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,28 @@ template <typename Comp, typename PatchPart> struct DAHDSRComponents
auto osv = (int)std::round(patchPartPtr->envIsOneShot.value);

std::string LE = (osv ? u8"\U000000B9" : "");
std::string LEacc = (osv ? " (one shot)" : "");
std::string nm = "";
if (patchPartPtr)
nm = patchPartPtr->name();

switch (tmv)
{
case (int)TriggerMode::NEW_GATE:
triggerButton->setLabel("L" + LE);
triggerButton->setLabelAndTitle("L" + LE, nm + " Env Trigger Legato" + LEacc);
break;
case (int)TriggerMode::NEW_VOICE:
triggerButton->setLabel("S" + LE);
triggerButton->setLabelAndTitle("S" + LE, nm + " Env Trigger on Voice" + LEacc);
break;
case (int)TriggerMode::KEY_PRESS:
triggerButton->setLabel("K" + LE);
triggerButton->setLabelAndTitle("K" + LE, nm + " Env Trigger on Key" + LEacc);
break;
case (int)TriggerMode::ON_RELEASE:
triggerButton->setLabel("R"); // one shot does nothing with release
triggerButton->setLabelAndTitle("R", nm + " Env Trigger on Release" +
LEacc); // one shot does nothing with release
break;
case (int)TriggerMode::PATCH_DEFAULT:
triggerButton->setLabel("D" + LE);
triggerButton->setLabelAndTitle("D" + LE, nm + " Env Patch Default Trigger" + LEacc);
break;
}
triggerButton->repaint();
Expand Down
8 changes: 6 additions & 2 deletions src/ui/modulation-components.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ template <typename Comp, typename Patch> struct ModulationComponents
sourceMenu[i]->setLabel("");
return;
}
auto n = patchPtr->name();
auto v = (uint32_t)std::round(patchPtr->modsource[i].value);

auto p = asComp()->editor.modMatrixConfig.sourceByID.find(v);
if (p != asComp()->editor.modMatrixConfig.sourceByID.end())
{
sourceMenu[i]->setLabel(p->second.name);
sourceMenu[i]->setLabelAndTitle(
p->second.name, n + " Mod Source " + std::to_string(i + 1) + " " + p->second.name);
}
else
{
Expand All @@ -113,14 +115,16 @@ template <typename Comp, typename Patch> struct ModulationComponents
}
std::string res{"ERR"};
auto v = (uint32_t)std::round(patchPtr->modtarget[i].value);
auto n = patchPtr->name();
for (auto &[id, nm] : patchPtr->targetList)
{
if (id == v)
{
res = nm;
}
}
targetMenu[i]->setLabel(res);
targetMenu[i]->setLabelAndTitle(res,
n + " Mod Target " + std::to_string(i + 1) + " " + res);
}

void layoutModulation(const juce::Rectangle<int> &r)
Expand Down
9 changes: 6 additions & 3 deletions src/ui/playmode-sub-panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,16 @@ PlayModeSubPanel::PlayModeSubPanel(SixSinesEditor &e) : HasEditor(e)
voiceLimitL->setText("Voices");
addAndMakeVisible(*voiceLimitL);
voiceLimit = std::make_unique<jcmp::MenuButton>();
voiceLimit->setLabel(std::to_string(getPolyLimit()));
voiceLimit->setLabelAndTitle(std::to_string(getPolyLimit()),
"Voice Limit " + std::to_string(getPolyLimit()));
voiceLimit->setOnCallback([this]() { showPolyLimitMenu(); });
editor.componentRefreshByID[editor.patchCopy.output.polyLimit.meta.id] =
[w = juce::Component::SafePointer(this)]()
{
if (!w)
return;
w->voiceLimit->setLabel(std::to_string(w->getPolyLimit()));
w->voiceLimit->setLabelAndTitle(std::to_string(w->getPolyLimit()),
"Voice Limit " + std::to_string(w->getPolyLimit()));
};
addAndMakeVisible(*voiceLimit);

Expand Down Expand Up @@ -352,7 +354,8 @@ void PlayModeSubPanel::setPolyLimit(int plVal)
editor.uiToAudio.push({Synth::UIToAudioMsg::Action::SET_PARAM, pl.meta.id, (float)plVal});
editor.flushOperator();

voiceLimit->setLabel(std::to_string(getPolyLimit()));
voiceLimit->setLabelAndTitle(std::to_string(getPolyLimit()),
"Voice Limit " + std::to_string(getPolyLimit()));
voiceLimit->repaint();
}

Expand Down
5 changes: 5 additions & 0 deletions src/ui/six-sines-editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ struct MenuValueTypein : HasEditor, juce::PopupMenu::CustomComponent, juce::Text
{
if (underComp && underComp->continuous())
{
underComp->onBeginEdit();

if (s.empty())
{
underComp->continuous()->setValueFromGUI(
Expand All @@ -440,7 +442,10 @@ struct MenuValueTypein : HasEditor, juce::PopupMenu::CustomComponent, juce::Text
{
underComp->continuous()->setValueAsString(s);
}
underComp->onEndEdit();
underComp->repaint();
underComp->grabKeyboardFocus();
underComp->notifyAccessibleChange();
}
}

Expand Down
Loading