The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

178 lines
6.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. //==============================================================================
  21. /**
  22. A small class to represent some facts about a particular type of plug-in.
  23. This class is for storing and managing the details about a plug-in without
  24. actually having to load an instance of it.
  25. A KnownPluginList contains a list of PluginDescription objects.
  26. @see KnownPluginList
  27. @tags{Audio}
  28. */
  29. class JUCE_API PluginDescription
  30. {
  31. public:
  32. //==============================================================================
  33. PluginDescription() = default;
  34. PluginDescription (const PluginDescription&) = default;
  35. PluginDescription (PluginDescription&&) = default;
  36. PluginDescription& operator= (const PluginDescription&) = default;
  37. PluginDescription& operator= (PluginDescription&&) = default;
  38. //==============================================================================
  39. /** The name of the plug-in. */
  40. String name;
  41. /** A more descriptive name for the plug-in.
  42. This may be the same as the 'name' field, but some plug-ins may provide an
  43. alternative name.
  44. */
  45. String descriptiveName;
  46. /** The plug-in format, e.g. "VST", "AudioUnit", etc. */
  47. String pluginFormatName;
  48. /** A category, such as "Dynamics", "Reverbs", etc. */
  49. String category;
  50. /** The manufacturer. */
  51. String manufacturerName;
  52. /** The version. This string doesn't have any particular format. */
  53. String version;
  54. /** Either the file containing the plug-in module, or some other unique way
  55. of identifying it.
  56. E.g. for an AU, this would be an ID string that the component manager
  57. could use to retrieve the plug-in. For a VST, it's the file path.
  58. */
  59. String fileOrIdentifier;
  60. /** The last time the plug-in file was changed.
  61. This is handy when scanning for new or changed plug-ins.
  62. */
  63. Time lastFileModTime;
  64. /** The last time that this information was updated. This would typically have
  65. been during a scan when this plugin was first tested or found to have changed.
  66. */
  67. Time lastInfoUpdateTime;
  68. /** Deprecated: New projects should use uniqueId instead.
  69. A unique ID for the plug-in.
  70. Note that this might not be unique between formats, e.g. a VST and some
  71. other format might actually have the same id.
  72. @see createIdentifierString
  73. */
  74. int deprecatedUid = 0;
  75. /** A unique ID for the plug-in.
  76. Note that this might not be unique between formats, e.g. a VST and some
  77. other format might actually have the same id.
  78. The uniqueId field replaces the deprecatedUid field, and fixes an issue
  79. where VST3 plugins with matching FUIDs would generate different uid
  80. values depending on the platform. The deprecatedUid field is kept for
  81. backwards compatibility, allowing existing hosts to migrate from the
  82. old uid to the new uniqueId.
  83. @see createIdentifierString
  84. */
  85. int uniqueId = 0;
  86. /** True if the plug-in identifies itself as a synthesiser. */
  87. bool isInstrument = false;
  88. /** The number of inputs. */
  89. int numInputChannels = 0;
  90. /** The number of outputs. */
  91. int numOutputChannels = 0;
  92. /** True if the plug-in is part of a multi-type container, e.g. a VST Shell. */
  93. bool hasSharedContainer = false;
  94. /** Returns true if the two descriptions refer to the same plug-in.
  95. This isn't quite as simple as them just having the same file (because of
  96. shell plug-ins).
  97. */
  98. bool isDuplicateOf (const PluginDescription& other) const noexcept;
  99. /** Return true if this description is equivalent to another one which created the
  100. given identifier string.
  101. Note that this isn't quite as simple as them just calling createIdentifierString()
  102. and comparing the strings, because the identifiers can differ (thanks to shell plug-ins).
  103. */
  104. bool matchesIdentifierString (const String& identifierString) const;
  105. //==============================================================================
  106. /** Returns a string that can be saved and used to uniquely identify the
  107. plugin again.
  108. This contains less info than the XML encoding, and is independent of the
  109. plug-in's file location, so can be used to store a plug-in ID for use
  110. across different machines.
  111. */
  112. String createIdentifierString() const;
  113. //==============================================================================
  114. /** Creates an XML object containing these details.
  115. @see loadFromXml
  116. */
  117. std::unique_ptr<XmlElement> createXml() const;
  118. /** Reloads the info in this structure from an XML record that was previously
  119. saved with createXML().
  120. Returns true if the XML was a valid plug-in description.
  121. */
  122. bool loadFromXml (const XmlElement& xml);
  123. private:
  124. //==============================================================================
  125. JUCE_LEAK_DETECTOR (PluginDescription)
  126. };
  127. } // namespace juce