tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_PluginComponent.h
Go to the documentation of this file.
1 /*
2 ,--. ,--. ,--. ,--.
3 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8 Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9*/
10
11namespace tracktion { inline namespace engine
12{
13
19{
20 PluginComponent (Plugin& p) : plugin (p)
21 {
22 getActiveComps().add (this);
23 }
24
25 virtual ~PluginComponent()
26 {
27 getActiveComps().removeFirstMatchingValue (this);
28 }
29
30 virtual void updateColour() = 0;
31
32 Plugin& plugin;
33
34 static PluginComponent* getComponentFor (const Plugin& p) noexcept
35 {
36 for (auto fc : getActiveComps())
37 if (&fc->plugin == &p)
38 return fc;
39
40 return {};
41 }
42
43 static juce::Array<PluginComponent*> getComponentsFor (const Plugin& p) noexcept
44 {
46
47 for (auto fc : getActiveComps())
48 if (&fc->plugin == &p)
49 comps.add (fc);
50
51 return comps;
52 }
53
54private:
55 static juce::Array<PluginComponent*>& getActiveComps()
56 {
58 return comps;
59 }
60
62};
63
64}} // namespace tracktion { inline namespace engine
void add(const ElementType &newElement)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Components that represent a Plugin should inherit from this to ensure they are correctly notified whe...