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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_PluginManager.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
15{
16public:
18 ~PluginManager() override;
19
20 void initialise();
21
22 #if TRACKTION_AIR_WINDOWS
23 void initialiseAirWindows();
24 #endif
25
26 //==============================================================================
27 static bool startChildProcessPluginScan (const juce::String& commandLine);
28
29 bool areGUIsLockedByDefault();
30 void setGUIsLockedByDefault (bool);
31
32 bool doubleClickToOpenWindows();
33 void setDoubleClickToOpenWindows (bool);
34
35 int getNumberOfThreadsForScanning();
36 void setNumberOfThreadsForScanning (int);
37
38 bool usesSeparateProcessForScanning();
39 void setUsesSeparateProcessForScanning (bool);
40
41 //==============================================================================
42 Plugin::Ptr createExistingPlugin (Edit&, const juce::ValueTree&);
43 Plugin::Ptr createNewPlugin (Edit&, const juce::ValueTree&);
44 Plugin::Ptr createNewPlugin (Edit&, const juce::String& type, const juce::PluginDescription&);
45
46 juce::Array<juce::PluginDescription> getARACompatiblePlugDescriptions();
47
48 juce::AudioPluginFormatManager pluginFormatManager;
49 juce::KnownPluginList knownPluginList;
50
51 //==============================================================================
53 {
54 BuiltInType (const juce::String& type);
55 virtual ~BuiltInType();
56
57 const juce::String type;
58
59 virtual Plugin::Ptr create (PluginCreationInfo) = 0;
60 };
61
62 void registerBuiltInType (std::unique_ptr<BuiltInType>);
63
64 //==============================================================================
65 template <typename Type>
67 {
68 BuiltInTypeBase() : BuiltInType (Type::xmlTypeName) {}
69 Plugin::Ptr create (PluginCreationInfo info) override { return new Type (info); }
70 };
71
72 template <typename Type>
73 void createBuiltInType() { registerBuiltInType (std::make_unique<BuiltInTypeBase<Type>>()); }
74
75 static constexpr const char* builtInPluginFormatName = "TracktionInternal";
76
77 static bool isBuiltInPlugin (const juce::PluginDescription& d)
78 {
79 return d.pluginFormatName == builtInPluginFormatName;
80 }
81
82 template<class PluginClass>
83 static juce::PluginDescription createBuiltInPluginDescription (bool synth = false)
84 {
86 desc.name = TRANS(PluginClass::getPluginName());
87 desc.pluginFormatName = builtInPluginFormatName;
88 desc.category = synth ? TRANS("Synth") : TRANS("Effect");
89 desc.manufacturerName = "Tracktion Software Corporation";
90 desc.fileOrIdentifier = PluginClass::xmlTypeName;
91 return desc;
92 }
93
94 //==============================================================================
100 double rate, int blockSize,
102
105
106 // this can be set to provide a function that gets called when a scan finishes
107 std::function<void()> scanCompletedCallback;
108
109private:
110 Engine& engine;
111
112 juce::CriticalSection existingListLock;
114 bool initialised = false;
115
116 Plugin::Ptr createPlugin (Edit&, const juce::ValueTree&, bool isNew);
117
118 void changeListenerCallback (juce::ChangeBroadcaster*) override;
119
121};
122
123//==============================================================================
125{
126public:
127 PluginCache (Edit&);
128 ~PluginCache() override;
129
130 //==============================================================================
131 Plugin::Ptr getPluginFor (EditItemID pluginID) const;
132 Plugin::Ptr getPluginFor (const juce::ValueTree&) const;
133 Plugin::Ptr getPluginFor (juce::AudioProcessor&) const;
134 Plugin::Ptr getOrCreatePluginFor (const juce::ValueTree&);
135 Plugin::Ptr createNewPlugin (const juce::ValueTree&);
136 Plugin::Ptr createNewPlugin (const juce::String& type, const juce::PluginDescription&);
137
138 Plugin::Array getPlugins() const;
139
140 //==============================================================================
143
144private:
145 Edit& edit;
146 Plugin::Array activePlugins;
148
149 Plugin::Ptr addPluginToCache (Plugin::Ptr);
150 void timerCallback() override;
151
153};
154
155}} // namespace tracktion { inline namespace engine
The Tracktion Edit class!
The Engine is the central class for all tracktion sessions.
std::function< void(const Plugin &)> newPluginAddedCallback
Callback which can be set to be notified of when a new plugin is added.
std::function< std::unique_ptr< juce::AudioPluginInstance >(const juce::PluginDescription &, double rate, int blockSize, juce::String &errorMessage)> createPluginInstance
Callback that is used to create plugin instances from a PluginDescription.
std::function< bool(Plugin &)> canUseFineGrainAutomation
Callback that is used to determine if a plugin should use fine-grain automation or not.
T is_pointer_v
#define TRANS(stringLiteral)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
T make_unique(T... args)
ID for objects of type EditElement - e.g.