Skip to content

Commit

Permalink
Accessible Improvements, dj.tuBIG/MaliceX factory patches
Browse files Browse the repository at this point in the history
* Accessible Improvements, One

1. Discrete items now have accessible gestures
2. Focus debugger lets me at least see gaps and bad tab order
3. Lots of little repaint fixes when using keyboard (and
   one when using mouse, Closes #92)

Add dj.tuBIG/MaliceX factory patches
  • Loading branch information
baconpaul authored Jan 5, 2025
1 parent d064dba commit d8aaaf2
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libs/sst/sst-clap-helpers
1 change: 1 addition & 0 deletions resources/factory_patches/Keys/Hello Supersaw.sxsnp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/factory_patches/Keys/Surge DX Piano Port.sxsnp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/factory_patches/Leads/Rounded PWM.sxsnp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/factory_patches/Leads/Rounded Sync.sxsnp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/factory_patches/Leads/Rounded Sync2.sxsnp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/factory_patches/Leads/Rounded Sync3.sxsnp

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions src/synth/patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,20 @@ struct Patch
}))

{
index = idx;
}

std::string name(int idx) const { return "Op " + std::to_string(idx + 1) + " Source"; }
uint32_t id(int f, int idx) const { return idBase + idStride * idx + f; }

int index{-1};
std::string name() const
{
if (index < 0)
throw std::runtime_error("Only call this post setup");
return name(index);
}

Param ratio;
Param active;

Expand Down Expand Up @@ -586,11 +595,20 @@ struct Patch
.withID(id(55 + i, idx));
}))
{
index = idx;
}

std::string name(int idx) const { return "Op " + std::to_string(idx + 1) + " Feedback"; }
uint32_t id(int f, int idx) const { return idBase + idStride * idx + f; }

int index{-1};
std::string name() const
{
if (index < 0)
throw std::runtime_error("Only call this post setup");
return name(index);
}

Param fbLevel, lfoToFB, envToFB;
Param active;

Expand Down Expand Up @@ -685,6 +703,7 @@ struct Patch
}))

{
index = idx;
}

Param level;
Expand All @@ -695,12 +714,22 @@ struct Patch

std::array<Param, numModsPer> modtarget;

// Use *this* version in constructor
std::string name(int idx) const
{
return "Op " + std::to_string(MatrixIndex::sourceIndexAt(idx) + 1) + " to Op " +
std::to_string(MatrixIndex::targetIndexAt(idx) + 1);
}
uint32_t id(int f, int idx) const { return idBase + idStride * idx + f; }

int index{-1};
std::string name() const
{
if (index < 0)
throw std::runtime_error("Only call this post setup");
return name(index);
}

std::vector<Param *> params()
{
std::vector<Param *> res{&level, &active, &pmOrRM, &lfoToDepth, &envToLevel};
Expand Down Expand Up @@ -798,11 +827,20 @@ struct Patch
}))

{
index = idx;
}

std::string name(int idx) const { return "Op " + std::to_string(idx + 1) + " Mixer"; }
uint32_t id(int f, int idx) const { return idBase + idStride * idx + f; }

int index{-1};
std::string name() const
{
if (index < 0)
throw std::runtime_error("Only call this post setup");
return name(index);
}

Param level, pan, lfoToLevel, lfoToPan, envToLevel;
Param active;
std::array<Param, numModsPer> modtarget;
Expand Down Expand Up @@ -911,8 +949,12 @@ struct Patch
if (id == TargetID::DIRECT)
n = outn;
}
cacheName = opName;
}

std::string cacheName{};
std::string name() const { return cacheName; }

uint32_t id(int f, int idx) const { return idBase + idStride * idx + f; }

Param lfoDepth, envDepth;
Expand Down
34 changes: 34 additions & 0 deletions src/ui/six-sines-editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ SixSinesEditor::SixSinesEditor(Synth::audioToUIQueue_t &atou, Synth::uiToAudioQu
uiToAudio.push({Synth::UIToAudioMsg::REQUEST_REFRESH, true});
if (flushOperator)
flushOperator();

#define DEBUG_FOCUS 0
#if DEBUG_FOCUS
focusDebugger = std::make_unique<sst::jucegui::accessibility::FocusDebugger>(*this);
focusDebugger->setDoFocusDebug(true);
#endif
}
SixSinesEditor::~SixSinesEditor()
{
Expand Down Expand Up @@ -678,4 +684,32 @@ void SixSinesEditor::postPatchChange(const std::string &dn)
repaint();
}

bool SixSinesEditor::keyPressed(const juce::KeyPress &key)
{
if (key.getModifiers().isCommandDown() && (char)key.getKeyCode() == 78)
{
SXSNLOG("Navigation Menu");
return true;
}
return false;
}

void SixSinesEditor::visibilityChanged()
{
if (isVisible() && isShowing())
{
presetButton->setWantsKeyboardFocus(true);
presetButton->grabKeyboardFocus();
}
}

void SixSinesEditor::parentHierarchyChanged()
{
if (isVisible() && isShowing())
{
presetButton->setWantsKeyboardFocus(true);
presetButton->grabKeyboardFocus();
}
}

} // namespace baconpaul::six_sines::ui
8 changes: 8 additions & 0 deletions src/ui/six-sines-editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <sst/jucegui/components/MenuButton.h>
#include <sst/jucegui/components/JogUpDownButton.h>
#include <sst/jucegui/components/VUMeter.h>
#include <sst/jucegui/accessibility/FocusDebugger.h>
#include <sst/jucegui/data/Continuous.h>

#include "synth/synth.h"
Expand Down Expand Up @@ -119,7 +120,14 @@ struct SixSinesEditor : jcmp::WindowPanel
void sendEntirePatchToAudio(const std::string &patchName);
void setParamValueOnCopy(uint32_t id, float value, bool notifyAudio);

bool keyPressed(const juce::KeyPress &key) override;

std::unique_ptr<jcmp::VUMeter> vuMeter;

// To turn this on, recompile with it on in six-sines-editor.cpp
void visibilityChanged() override;
void parentHierarchyChanged() override;
std::unique_ptr<sst::jucegui::accessibility::FocusDebugger> focusDebugger;
};

struct HasEditor
Expand Down

0 comments on commit d8aaaf2

Please sign in to comment.