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

Add a 'Announce State' Accessible option #6776

Merged
merged 1 commit into from
Jan 8, 2023
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
27 changes: 26 additions & 1 deletion src/surge-xt/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3547,7 +3547,7 @@ juce::PopupMenu SurgeGUIEditor::makeTuningMenu(const juce::Point<int> &where, bo

auto canMaster = MTS_CanRegisterMaster();

std::string mtxt = "Act as ODDSound" + Surge::GUI::toOSCase(" MTS-ESP Main");
std::string mtxt = "Act as ODDSound" + Surge::GUI::toOSCase(" MTS-ESP Source");
tuningSubMenu.addItem(mtxt, canMaster || getStorage()->oddsound_mts_active_as_main,
getStorage()->oddsound_mts_active_as_main, [this]() {
if (getStorage()->oddsound_mts_active_as_main)
Expand Down Expand Up @@ -7079,6 +7079,7 @@ void SurgeGUIEditor::setupKeymapManager()

keyMapManager->addBinding(Surge::GUI::OPEN_MANUAL, {juce::KeyPress::F1Key});
keyMapManager->addBinding(Surge::GUI::TOGGLE_ABOUT, {juce::KeyPress::F12Key});
keyMapManager->addBinding(Surge::GUI::ANNOUNCE_STATE, {keymap_t::Modifiers::ALT, (int)'0'});

keyMapManager->unstreamFromXML();
}
Expand Down Expand Up @@ -7491,6 +7492,9 @@ bool SurgeGUIEditor::keyPressed(const juce::KeyPress &key, juce::Component *orig
juce::URL(thingToOpen).launchInDefaultBrowser();
return true;
}
case Surge::GUI::ANNOUNCE_STATE:
announceGuiState();
break;
case Surge::GUI::SKIN_LAYOUT_GRID:
case Surge::GUI::TOGGLE_ABOUT:
{
Expand Down Expand Up @@ -7592,6 +7596,27 @@ std::string SurgeGUIEditor::showShortcutDescription(const std::string &shortcutD
}
}

void SurgeGUIEditor::announceGuiState()
{
std::ostringstream oss;

auto s = getStorage();
auto ot = s->getPatch().scene[current_scene].osc[current_osc[current_scene]].type.val.i;
auto ft = s->getPatch().fx[current_fx].type.val.i;
auto ms = s->getPatch()
.scene[current_scene]
.lfo[modsource_editor[current_scene] - ms_lfo1]
.shape.val.i;

oss << "SurgeXT. Patch '" << s->getPatch().name << "'. Scene "
<< (current_scene == 0 ? "A" : "B") << ". "
<< " Oscillator " << (current_osc[current_scene] + 1) << " " << osc_type_names[ot] << "."
<< " Modulator " << modulatorName(modsource_editor[current_scene], false) << " "
<< lt_names[ms] << ". " << fxslot_names[current_fx] << " " << fx_type_names[ft] << "."
<< std::endl;
enqueueAccessibleAnnouncement(oss.str());
}

std::string SurgeGUIEditor::showShortcutDescription(const std::string &shortcutDesc)
{
if (getUseKeyboardShortcuts())
Expand Down
1 change: 1 addition & 0 deletions src/surge-xt/gui/SurgeGUIEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ class SurgeGUIEditor : public Surge::GUI::IComponentTagValue::Listener,

std::deque<std::pair<std::string, int>> accAnnounceStrings;
void enqueueAccessibleAnnouncement(const std::string &s);
void announceGuiState();
void setAccessibilityInformationByParameter(juce::Component *c, Parameter *p,
const std::string &action);

Expand Down
7 changes: 7 additions & 0 deletions src/surge-xt/gui/SurgeGUIEditorKeyboardActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ enum KeyboardActions
OPEN_MANUAL,
TOGGLE_ABOUT,

ANNOUNCE_STATE,

n_kbdActions
};

Expand Down Expand Up @@ -169,6 +171,8 @@ inline std::string keyboardActionName(KeyboardActions a)
return "OPEN_MANUAL";
case TOGGLE_ABOUT:
return "TOGGLE_ABOUT";
case ANNOUNCE_STATE:
return "ANNOUNCE_STATE";

case n_kbdActions:
jassert(false);
Expand Down Expand Up @@ -316,6 +320,9 @@ inline std::string keyboardActionDescription(KeyboardActions a)
desc = "About Surge XT";
skipOSCase = true;
break;
case ANNOUNCE_STATE:
desc = "Announce Editor State with Accessible API";
break;

default:
jassert(false);
Expand Down