gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 51d0db4fc56a1125e43ff1ab0360112355f4344d
parent f8b1ebcf3547f57a40c43f436b35b7aa76849f59
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Mon, 14 Mar 2022 22:57:13 +0100

add findComponents with specific type

Diffstat:
Msource/jucePlugin/genericUI/editor.h | 17+++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/source/jucePlugin/genericUI/editor.h b/source/jucePlugin/genericUI/editor.h @@ -4,6 +4,8 @@ #include <juce_audio_processors/juce_audio_processors.h> +#include "uiObject.h" + namespace Virus { class Controller; @@ -13,8 +15,6 @@ class VirusParameterBinding; namespace genericUI { - class UiObject; - class Editor : public juce::Component { public: @@ -29,6 +29,19 @@ namespace genericUI void registerComponent(const std::string& _name, juce::Component* _component); const std::vector<juce::Component*>& findComponents(const std::string& _name) const; + + template<typename T> + void findComponents(std::vector<T*>& _dst, const std::string& _name) const + { + const auto& res = findComponents(_name); + for (auto* s : res) + { + auto* t = dynamic_cast<T*>(s); + if(t) + _dst.push_back(t); + } + } + juce::Component* findComponent(const std::string& _name) const; private: