Skip to content

Commit

Permalink
Make WaveShaper analysis a hoverable button (#4990)
Browse files Browse the repository at this point in the history
Button below the jog with an asset and a hover.
Needs a new asset obviously
And state management not perfect
but checkpointing so designers can make proper assets for all the skins

Addresses #1964
  • Loading branch information
baconpaul authored Sep 5, 2021
1 parent 911334f commit 8d1d28e
Show file tree
Hide file tree
Showing 12 changed files with 260 additions and 226 deletions.
411 changes: 204 additions & 207 deletions resources/classic-skin-svgs/bmp00102.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions resources/classic-skin-svgs/bmp00184.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions resources/data/skins/default.surge-skin/SVG/hover00184.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/common/SkinModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,9 @@ Connector waveshaper_type =
.withHSwitch2Properties(IDB_WAVESHAPER_MODE, 6, 6, 1);
Connector waveshaper_jog =
Connector("filter.waveshaper_jog", 385, 311 + 49, Connector::JOG_WAVESHAPE).asJogPlusMinus();
Connector waveshaper_analyze = Connector("filter.waveshaper_analyze", 384 + 11, 311 + 49 + 14, 12,
12, Components::Switch, Connector::ANALYZE_WAVESHAPE)
.withBackground(IDB_WAVESHAPER_ANALYSIS);

Connector highpass = Connector("filter.highpass", 354, 301).asVertical().asWhite();
} // namespace Filter
Expand Down
3 changes: 2 additions & 1 deletion src/common/SkinModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ struct Connector
JOG_PATCH,
JOG_FX,
JOG_WAVESHAPE,
ANALYZE_WAVESHAPE,

STORE_PATCH,
STORE_PATCH_DIALOG,
Expand Down Expand Up @@ -374,7 +375,7 @@ namespace Filter
extern Surge::Skin::Connector balance, config, cutoff_1, cutoff_2, envmod_1, envmod_2,
f2_link_resonance, f2_offset_mode, feedback, highpass, keytrack_1, keytrack_2, resonance_1,
resonance_2, subtype_1, subtype_2, type_1, type_2, waveshaper_drive, waveshaper_type,
waveshaper_jog;
waveshaper_jog, waveshaper_analyze;
}
namespace Global
{
Expand Down
1 change: 1 addition & 0 deletions src/common/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#define IDB_FILTER_MENU 168
#define IDB_FILTER_ICONS 169
#define IDB_WAVESHAPER_BG 183
#define IDB_WAVESHAPER_ANALYSIS 184

// == SVG == Do not remove this comment - it indicates the start of the automated SVG adding block
#define IDB_MSEG_NODES 301
Expand Down
2 changes: 2 additions & 0 deletions src/gui/SkinImageMaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ inline std::unordered_map<std::string, int> createIdNameMap()
res["VUMETER_BARS"] = 181;
res["MIDI_LEARN"] = 182;
res["WAVESHAPER_BG"] = 183;
res["WAVESHAPER_ANALYSIS"] = 184;
res["MSEG_NODES"] = 301;
res["MSEG_MOVEMENT_MODE"] = 302;
res["MSEG_VERTICAL_SNAP"] = 303;
Expand Down Expand Up @@ -125,6 +126,7 @@ inline std::unordered_set<int> allowedImageIds()
allowed.insert(181);
allowed.insert(182);
allowed.insert(183);
allowed.insert(184);
allowed.insert(301);
allowed.insert(302);
allowed.insert(303);
Expand Down
11 changes: 11 additions & 0 deletions src/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,13 @@ void SurgeGUIEditor::openOrRecreateEditor()
"Jog");
break;
}
case Surge::Skin::Connector::NonParameterConnection::ANALYZE_WAVESHAPE:
{
auto q = layoutComponentForSkin(skinCtrl, tag_analyzewaveshape);
setAccessibilityInformationByTitleAndAction(q->asJuceComponent(), "Analyze Waveshape",
"Open");
break;
}
case Surge::Skin::Connector::NonParameterConnection::JOG_FX:
{
auto q = layoutComponentForSkin(skinCtrl, tag_mp_jogfx);
Expand Down Expand Up @@ -4312,6 +4319,10 @@ SurgeGUIEditor::layoutComponentForSkin(std::shared_ptr<Surge::GUI::Skin::Control
case tag_lfo_menu:
frame->getControlGroupLayer(cg_LFO)->addAndMakeVisible(*hsw);
break;
case tag_analyzewaveshape:
frame->getControlGroupLayer(cg_FILTER)->addAndMakeVisible(*hsw);
break;

default:
std::cout << tag << std::endl;
jassert(false);
Expand Down
1 change: 1 addition & 0 deletions src/gui/SurgeGUIEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ class SurgeGUIEditor : public Surge::GUI::IComponentTagValue::Listener,
std::unique_ptr<Surge::Widgets::OscillatorMenu> oscMenu;
std::unique_ptr<Surge::Widgets::FxMenu> fxMenu;
std::unique_ptr<Surge::Widgets::WaveShaperSelector> waveshaperSelector;
std::unique_ptr<Surge::Widgets::Switch> waveshaperAnalysis;

/* Infowindow members and functions */
std::unique_ptr<Surge::Widgets::ParameterInfowindow> paramInfowindow;
Expand Down
1 change: 1 addition & 0 deletions src/gui/SurgeGUIEditorTags.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enum SurgeGUIEditorTags
tag_mp_category,
tag_mp_patch,
tag_mp_jogwaveshape,
tag_analyzewaveshape,
tag_store,
tag_mod_source0,
tag_mod_source_end = tag_mod_source0 + n_modsources,
Expand Down
30 changes: 12 additions & 18 deletions src/gui/SurgeGUIEditorValueCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,24 +1239,6 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c
contextMenu.addSubMenu(grpN, sub, true, nullptr, isSubChecked, 0);
}
}

if (p->ctrltype == ct_wstype)
{
contextMenu.addSeparator();

std::string tg = "Show Waveshaper Analyzer...";

if (waveshaperSelector && waveshaperSelector->isAnalysisOpen())
{
tg = "Hide Waveshaper Analyzer";
}

contextMenu.addItem(Surge::GUI::toOSCaseForMenu(tg), true, false,
[this]() {
if (this->waveshaperSelector)
this->waveshaperSelector->toggleAnalysis();
});
}
}
else
{
Expand Down Expand Up @@ -2499,6 +2481,18 @@ void SurgeGUIEditor::valueChanged(Surge::GUI::IComponentTagValue *control)
}
}
break;
case tag_analyzewaveshape:
{
if (this->waveshaperSelector)
{
control->asJuceComponent()->getParentComponent()->toFront(false);
if (control->getValue() > 0.5f)
this->waveshaperSelector->openAnalysis();
else
this->waveshaperSelector->closeAnalysis();
}
}
break;
case tag_mp_patch:
{
if (isAnyOverlayPresent(STORE_PATCH))
Expand Down
1 change: 1 addition & 0 deletions src/gui/SurgeImageStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ void SurgeImageStore::setupBuiltinBitmaps()
addEntry(IDB_FILTER_ICONS);
addEntry(IDB_MIDI_LEARN);
addEntry(IDB_WAVESHAPER_BG);
addEntry(IDB_WAVESHAPER_ANALYSIS);

// == SVG == Do not remove this comment - it indicates the start of the automated SVG adding
// block
Expand Down

0 comments on commit 8d1d28e

Please sign in to comment.