Skip to content

Commit

Permalink
fixed singleton-modules in plugin-usage
Browse files Browse the repository at this point in the history
  • Loading branch information
stoermelder committed Nov 2, 2024
1 parent 4074c3d commit abec859
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
- Fixed behavior of attenuvertors for X/Y/MOD-inputs (#394)
- Module [GOTO](./docs/Goto.md)
- Implemented smooth transition for "top left" jump destination (#388)
- Module [MB](./docs/Mb.md)
- Fixed usage in multiple plugin-instances
- Module [ME](./docs/Me.md)
- Fixed usage in multiple plugin-instances
- Module [MIDI-CAT](./docs/MidiCat.md)
- Implemented response curves (logarithmic/exponential) (#258)
- Fixed MIDI-feedback for snapped parameters (#374)
Expand All @@ -40,6 +44,7 @@
- Ask to view unavailable modules on the VCV Library when loading a strip (#18)
- Module [STRIP++](./docs/StripPp.md)
- Ask to view unavailable modules on the VCV Library when loading a selection
- Fixed usage in multiple plugin-instances
- Module [TRANSIT](./docs/Transit.md)
- Added fade setting per slot
- Improved handling on mapped switches (skipping all immediate values)
Expand Down
10 changes: 5 additions & 5 deletions src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ void init(rack::Plugin* p) {

namespace StoermelderPackOne {

std::map<std::string, Widget*> singletons;
std::map<std::tuple<std::string, Context*>, Widget*> singletons;

bool registerSingleton(std::string name, Widget* mw) {
auto it = singletons.find(name);
auto it = singletons.find(std::make_tuple(name, APP));
if (it == singletons.end()) {
singletons[name] = mw;
singletons[std::make_tuple(name, APP)] = mw;
return true;
}
return false;
}

bool unregisterSingleton(std::string name, Widget* mw) {
auto it = singletons.find(name);
auto it = singletons.find(std::make_tuple(name, APP));
if (it != singletons.end() && it->second == mw) {
singletons.erase(it);
return true;
Expand All @@ -92,7 +92,7 @@ bool unregisterSingleton(std::string name, Widget* mw) {
}

Widget* getSingleton(std::string name) {
auto it = singletons.find(name);
auto it = singletons.find(std::make_tuple(name, APP));
return it != singletons.end() ? it->second : NULL;
}

Expand Down

0 comments on commit abec859

Please sign in to comment.