1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-31 03:00:05 +00:00

Audio Plugins: Added member variable PluginDescription::lastInfoUpdateTime

This commit is contained in:
jules 2015-11-09 17:21:33 +00:00
parent 1d6e77a4d8
commit a2b663de67
8 changed files with 24 additions and 1 deletions

View file

@ -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;

View file

@ -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();

View file

@ -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;

View file

@ -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();

View file

@ -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);

View file

@ -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

View file

@ -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;

View file

@ -136,7 +136,8 @@ public:
sortByCategory,
sortByManufacturer,
sortByFormat,
sortByFileSystemLocation
sortByFileSystemLocation,
sortByInfoUpdateTime
};
//==============================================================================