diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm index ebdec5f9d6..9464344cca 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -374,6 +374,7 @@ public: ^ ((int) componentDesc.componentSubType) ^ ((int) componentDesc.componentManufacturer); desc.lastFileModTime = Time(); + desc.lastInfoUpdateTime = Time::getCurrentTime(); desc.pluginFormatName = "AudioUnit"; desc.category = AudioUnitFormatHelpers::getCategory (componentDesc.componentType); desc.manufacturerName = manufacturer; diff --git a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp index d315b07fc7..aed4184a50 100644 --- a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp @@ -220,6 +220,7 @@ public: desc.fileOrIdentifier = module->file.getFullPathName(); desc.uid = getUID(); desc.lastFileModTime = module->file.getLastModificationTime(); + desc.lastInfoUpdateTime = Time::getCurrentTime(); desc.pluginFormatName = "LADSPA"; desc.category = getCategory(); desc.manufacturerName = plugin != nullptr ? String (plugin->Maker) : String(); diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index 5f7ca8d2e4..fe52e3628f 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -110,6 +110,7 @@ static void createPluginDescription (PluginDescription& description, { description.fileOrIdentifier = pluginFile.getFullPathName(); description.lastFileModTime = pluginFile.getLastModificationTime(); + description.lastInfoUpdateTime = Time::getCurrentTime(); description.manufacturerName = company; description.name = name; description.descriptiveName = name; diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index c5b2e5078a..ee797b8321 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -804,6 +804,7 @@ public: desc.fileOrIdentifier = module->file.getFullPathName(); desc.uid = getUID(); desc.lastFileModTime = module->file.getLastModificationTime(); + desc.lastInfoUpdateTime = Time::getCurrentTime(); desc.pluginFormatName = "VST"; desc.category = getCategory(); diff --git a/modules/juce_audio_processors/processors/juce_PluginDescription.cpp b/modules/juce_audio_processors/processors/juce_PluginDescription.cpp index 2e647ecd6e..c8d8df81d3 100644 --- a/modules/juce_audio_processors/processors/juce_PluginDescription.cpp +++ b/modules/juce_audio_processors/processors/juce_PluginDescription.cpp @@ -44,6 +44,7 @@ PluginDescription::PluginDescription (const PluginDescription& other) version (other.version), fileOrIdentifier (other.fileOrIdentifier), lastFileModTime (other.lastFileModTime), + lastInfoUpdateTime (other.lastInfoUpdateTime), uid (other.uid), isInstrument (other.isInstrument), numInputChannels (other.numInputChannels), @@ -64,6 +65,7 @@ PluginDescription& PluginDescription::operator= (const PluginDescription& other) uid = other.uid; isInstrument = other.isInstrument; lastFileModTime = other.lastFileModTime; + lastInfoUpdateTime = other.lastInfoUpdateTime; numInputChannels = other.numInputChannels; numOutputChannels = other.numOutputChannels; hasSharedContainer = other.hasSharedContainer; @@ -108,6 +110,7 @@ XmlElement* PluginDescription::createXml() const e->setAttribute ("uid", String::toHexString (uid)); e->setAttribute ("isInstrument", isInstrument); e->setAttribute ("fileTime", String::toHexString (lastFileModTime.toMilliseconds())); + e->setAttribute ("infoUpdateTime", String::toHexString (lastInfoUpdateTime.toMilliseconds())); e->setAttribute ("numInputs", numInputChannels); e->setAttribute ("numOutputs", numOutputChannels); e->setAttribute ("isShell", hasSharedContainer); @@ -129,6 +132,7 @@ bool PluginDescription::loadFromXml (const XmlElement& xml) uid = xml.getStringAttribute ("uid").getHexValue32(); isInstrument = xml.getBoolAttribute ("isInstrument", false); lastFileModTime = Time (xml.getStringAttribute ("fileTime").getHexValue64()); + lastInfoUpdateTime = Time (xml.getStringAttribute ("infoUpdateTime").getHexValue64()); numInputChannels = xml.getIntAttribute ("numInputs"); numOutputChannels = xml.getIntAttribute ("numOutputs"); hasSharedContainer = xml.getBoolAttribute ("isShell", false); diff --git a/modules/juce_audio_processors/processors/juce_PluginDescription.h b/modules/juce_audio_processors/processors/juce_PluginDescription.h index 83effceacd..4b888ec10f 100644 --- a/modules/juce_audio_processors/processors/juce_PluginDescription.h +++ b/modules/juce_audio_processors/processors/juce_PluginDescription.h @@ -81,6 +81,11 @@ public: */ Time lastFileModTime; + /** The last time that this information was updated. This would typically have + been during a scan when this plugin was first tested or found to have changed. + */ + Time lastInfoUpdateTime; + /** A unique ID for the plug-in. Note that this might not be unique between formats, e.g. a VST and some diff --git a/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp b/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp index ad37837cea..ce569230f6 100644 --- a/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp +++ b/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp @@ -263,6 +263,7 @@ struct PluginSorter case KnownPluginList::sortByManufacturer: diff = first->manufacturerName.compareNatural (second->manufacturerName); break; case KnownPluginList::sortByFormat: diff = first->pluginFormatName.compare (second->pluginFormatName); break; case KnownPluginList::sortByFileSystemLocation: diff = lastPathPart (first->fileOrIdentifier).compare (lastPathPart (second->fileOrIdentifier)); break; + case KnownPluginList::sortByInfoUpdateTime: diff = compare (first->lastInfoUpdateTime, second->lastInfoUpdateTime); break; default: break; } @@ -278,6 +279,14 @@ private: return path.replaceCharacter ('\\', '/').upToLastOccurrenceOf ("/", false, false); } + static int compare (Time a, Time b) noexcept + { + if (a < b) return -1; + if (b < a) return 1; + + return 0; + } + const KnownPluginList::SortMethod method; const int direction; diff --git a/modules/juce_audio_processors/scanning/juce_KnownPluginList.h b/modules/juce_audio_processors/scanning/juce_KnownPluginList.h index d04dd894fb..7bd38f06c7 100644 --- a/modules/juce_audio_processors/scanning/juce_KnownPluginList.h +++ b/modules/juce_audio_processors/scanning/juce_KnownPluginList.h @@ -136,7 +136,8 @@ public: sortByCategory, sortByManufacturer, sortByFormat, - sortByFileSystemLocation + sortByFileSystemLocation, + sortByInfoUpdateTime }; //==============================================================================