JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_PluginDescription.cpp
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
30{
31 const auto tie = [] (const PluginDescription& d)
32 {
33 return std::tie (d.fileOrIdentifier, d.deprecatedUid, d.uniqueId);
34 };
35
36 return tie (*this) == tie (other);
37}
38
39static String getPluginDescSuffix (const PluginDescription& d, int uid)
40{
42 + "-" + String::toHexString (uid);
43}
44
46{
47 const auto matches = [&] (int uid)
48 {
49 return identifierString.endsWithIgnoreCase (getPluginDescSuffix (*this, uid));
50 };
51
52 return matches (uniqueId) || matches (deprecatedUid);
53}
54
56{
57 const auto idToUse = uniqueId != 0 ? uniqueId : deprecatedUid;
58 return pluginFormatName + "-" + name + getPluginDescSuffix (*this, idToUse);
59}
60
62{
63 auto e = std::make_unique<XmlElement> ("PLUGIN");
64
65 e->setAttribute ("name", name);
66
67 if (descriptiveName != name)
68 e->setAttribute ("descriptiveName", descriptiveName);
69
70 e->setAttribute ("format", pluginFormatName);
71 e->setAttribute ("category", category);
72 e->setAttribute ("manufacturer", manufacturerName);
73 e->setAttribute ("version", version);
74 e->setAttribute ("file", fileOrIdentifier);
75 e->setAttribute ("uniqueId", String::toHexString (uniqueId));
76 e->setAttribute ("isInstrument", isInstrument);
77 e->setAttribute ("fileTime", String::toHexString (lastFileModTime.toMilliseconds()));
78 e->setAttribute ("infoUpdateTime", String::toHexString (lastInfoUpdateTime.toMilliseconds()));
79 e->setAttribute ("numInputs", numInputChannels);
80 e->setAttribute ("numOutputs", numOutputChannels);
81 e->setAttribute ("isShell", hasSharedContainer);
82 e->setAttribute ("hasARAExtension", hasARAExtension);
83
84 e->setAttribute ("uid", String::toHexString (deprecatedUid));
85
86 return e;
87}
88
90{
91 if (xml.hasTagName ("PLUGIN"))
92 {
93 name = xml.getStringAttribute ("name");
94 descriptiveName = xml.getStringAttribute ("descriptiveName", name);
95 pluginFormatName = xml.getStringAttribute ("format");
96 category = xml.getStringAttribute ("category");
97 manufacturerName = xml.getStringAttribute ("manufacturer");
98 version = xml.getStringAttribute ("version");
100 isInstrument = xml.getBoolAttribute ("isInstrument", false);
102 lastInfoUpdateTime = Time (xml.getStringAttribute ("infoUpdateTime").getHexValue64());
103 numInputChannels = xml.getIntAttribute ("numInputs");
104 numOutputChannels = xml.getIntAttribute ("numOutputs");
105 hasSharedContainer = xml.getBoolAttribute ("isShell", false);
106 hasARAExtension = xml.getBoolAttribute ("hasARAExtension", false);
107
109 uniqueId = xml.getStringAttribute ("uniqueId", "0").getHexValue32();
110
111 return true;
112 }
113
114 return false;
115}
116
117} // namespace juce
A small class to represent some facts about a particular type of plug-in.
int numOutputChannels
The number of outputs.
String pluginFormatName
The plug-in format, e.g.
std::unique_ptr< XmlElement > createXml() const
Creates an XML object containing these details.
bool loadFromXml(const XmlElement &xml)
Reloads the info in this structure from an XML record that was previously saved with createXML().
bool isInstrument
True if the plug-in identifies itself as a synthesiser.
bool matchesIdentifierString(const String &identifierString) const
Return true if this description is equivalent to another one which created the given identifier strin...
String category
A category, such as "Dynamics", "Reverbs", etc.
bool hasSharedContainer
True if the plug-in is part of a multi-type container, e.g.
bool isDuplicateOf(const PluginDescription &other) const noexcept
Returns true if the two descriptions refer to the same plug-in.
int numInputChannels
The number of inputs.
String name
The name of the plug-in.
String manufacturerName
The manufacturer.
int deprecatedUid
Deprecated: New projects should use uniqueId instead.
bool hasARAExtension
True if the plug-in is ARA enabled and can supply a valid ARAFactoryWrapper.
int uniqueId
A unique ID for the plug-in.
Time lastFileModTime
The last time the plug-in file was changed.
String descriptiveName
A more descriptive name for the plug-in.
String fileOrIdentifier
Either the file containing the plug-in module, or some other unique way of identifying it.
String createIdentifierString() const
Returns a string that can be saved and used to uniquely identify the plugin again.
Time lastInfoUpdateTime
The last time that this information was updated.
The JUCE String class!
Definition juce_String.h:53
static String toHexString(IntegerType number)
Returns a string representing this numeric value in hexadecimal.
int hashCode() const noexcept
Generates a probably-unique 32-bit hashcode from this string.
int64 getHexValue64() const noexcept
Parses the string as a hexadecimal number.
int getHexValue32() const noexcept
Parses the string as a hexadecimal number.
Holds an absolute date and time.
Definition juce_Time.h:37
int64 toMilliseconds() const noexcept
Returns the time as a number of milliseconds.
Definition juce_Time.h:98
Used to build a tree of elements representing an XML document.
bool getBoolAttribute(StringRef attributeName, bool defaultReturnValue=false) const
Returns the value of a named attribute as a boolean.
bool hasTagName(StringRef possibleTagName) const noexcept
Tests whether this element has a particular tag name.
int getIntAttribute(StringRef attributeName, int defaultReturnValue=0) const
Returns the value of a named attribute as an integer.
const String & getStringAttribute(StringRef attributeName) const noexcept
Returns the value of a named attribute.
JUCE Namespace.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88
T tie(T... args)