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.

151 lines
5.0KB

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