From: <sag...@us...> - 2013-12-01 21:06:36
|
Revision: 3344 http://sourceforge.net/p/modplug/code/3344 Author: saga-games Date: 2013-12-01 21:06:29 +0000 (Sun, 01 Dec 2013) Log Message: ----------- [Mod] Tree view: Limit updates triggered by instrument library monitoring to two per second. [Fix] Plugin manager: For a while, absolute paths have always been written to the cache file. [Imp] VST: Implement audioMasterGetChunkFile opcode. Modified Paths: -------------- trunk/OpenMPT/common/version.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/plugins/PluginManager.cpp Modified: trunk/OpenMPT/common/version.cpp =================================================================== --- trunk/OpenMPT/common/version.cpp 2013-12-01 16:03:01 UTC (rev 3343) +++ trunk/OpenMPT/common/version.cpp 2013-12-01 21:06:29 UTC (rev 3344) @@ -297,6 +297,8 @@ #ifndef NO_ARCHIVE_SUPPORT "Simon Howard for lhasa\n" "http://fragglet.github.io/lhasa/\n" + "Alexander L. Roshal for UnRAR\n" + "http://rarlab.com/\n" #endif #ifndef NO_PORTAUDIO "PortAudio contributors\n" Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2013-12-01 16:03:01 UTC (rev 3343) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2013-12-01 21:06:29 UTC (rev 3344) @@ -1790,15 +1790,13 @@ DWORD result; do { + Sleep(500); const HANDLE waitHandles[] = { m_hWatchDirKillThread, m_hWatchDir }; result = WaitForMultipleObjects(m_hWatchDir != nullptr ? 2 : 1, waitHandles, FALSE, 1000); if(result == WAIT_OBJECT_0 + 1 && m_hWatchDir == waitHandles[1]) { FindNextChangeNotification(m_hWatchDir); PostMessage(WM_COMMAND, ID_MODTREE_REFRESHINSTRLIB); - } else if(result == WAIT_FAILED) - { - Sleep(100); } } while(result != WAIT_OBJECT_0); } Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2013-12-01 16:03:01 UTC (rev 3343) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2013-12-01 21:06:29 UTC (rev 3344) @@ -1,5 +1,5 @@ /* - * vstplug.cpp + * Vstplug.cpp * ----------- * Purpose: Plugin handling / processing * Notes : (currently none) @@ -12,7 +12,9 @@ #include "Mainfrm.h" #include "Vstplug.h" #include "VstPresets.h" +#ifdef MODPLUG_TRACKER #include "Moddoc.h" +#endif // MODPLUG_TRACKER #include "../soundlib/Sndfile.h" #include "AbstractVstEditor.h" #include "VstEditor.h" @@ -428,6 +430,13 @@ // get the native path of currently loading bank or project // (called from writeChunk) void* in <ptr> (char[2048], or sizeof(FSSpec)) - DEPRECATED in VST 2.4 case audioMasterGetChunkFile: +#ifdef MODPLUG_TRACKER + if(pVstPlugin) + { + strcpy(ptr, pVstPlugin->GetModDoc()->GetPathNameMpt().ToLocale().c_str()); + return 1; + } +#endif Log("VST plugin to host: Get Chunk File\n"); break; @@ -1033,10 +1042,12 @@ if(errorStr == nullptr) { +#ifndef MODPLUG_TRACKER if(GetModDoc() != nullptr && GetSoundFile().GetModSpecifications().supportsPlugins) { GetModDoc()->SetModified(); } +#endif // MODPLUG_TRACKER return true; } else { Modified: trunk/OpenMPT/soundlib/plugins/PluginManager.cpp =================================================================== --- trunk/OpenMPT/soundlib/plugins/PluginManager.cpp 2013-12-01 16:03:01 UTC (rev 3343) +++ trunk/OpenMPT/soundlib/plugins/PluginManager.cpp 2013-12-01 21:06:29 UTC (rev 3344) @@ -21,6 +21,14 @@ #include "../Sndfile.h" #include "JBridge.h" +// For CRC32 calculation (to tell plugins with same UID apart in our cache file) +#if !defined(NO_ZLIB) +#include <zlib/zlib.h> +#elif !defined(NO_MINIZ) +#define MINIZ_HEADER_FILE_ONLY +#include <miniz/miniz.c> +#endif + char CVstPluginManager::s_szHostProductString[64] = "OpenMPT"; char CVstPluginManager::s_szHostVendorString[64] = "OpenMPT project"; VstIntPtr CVstPluginManager::s_nHostVendorVersion = MptVersion::num; @@ -32,13 +40,34 @@ AEffect *DmoToVst(VSTPluginLib &lib); -#include "../../include/zlib/zlib.h" // For CRC32 calculation (to tell plugins with same UID apart) -static std::string GetPluginCacheID(const VSTPluginLib &lib) -//---------------------------------------------------------- +static const char *const cacheSection = "PluginCache"; +static const wchar_t *const cacheSectionW = L"PluginCache"; + + +// PluginCache format: +// LibraryName = <ID1><ID2><CRC32> (hex-encoded) +// <ID1><ID2><CRC32> = FullDllPath +// <ID1><ID2><CRC32>.Flags = Plugin Flags (set VSTPluginLib::DecodeCacheFlags). + +static void WriteToCache(const VSTPluginLib &lib) +//----------------------------------------------- { + SettingsContainer &cacheFile = theApp.GetPluginCache(); + const std::string libName = lib.libraryName.ToUTF8(); - uint32 crc = crc32(0, reinterpret_cast<const Bytef *>(&libName[0]), libName.length()); - return mpt::String::Format("%08X%08X%08X", SwapBytesReturnLE(lib.pluginId1), SwapBytesReturnLE(lib.pluginId2), SwapBytesReturnLE(crc)); + const uint32 crc = crc32(0, reinterpret_cast<const Bytef *>(&libName[0]), libName.length()); + const std::string IDs = mpt::String::Format("%08X%08X%08X", SwapBytesReturnLE(lib.pluginId1), SwapBytesReturnLE(lib.pluginId2), SwapBytesReturnLE(crc)); + const std::string flagsKey = IDs + ".Flags"; + + mpt::PathString writePath = lib.dllPath; + if(theApp.IsPortableMode()) + { + writePath = theApp.AbsolutePathToRelative(writePath); + } + + cacheFile.Write<std::string>(cacheSectionW, lib.libraryName.ToWide(), IDs); + cacheFile.Write<mpt::PathString>(cacheSection, IDs, writePath); + cacheFile.Write<int32>(cacheSection, flagsKey, lib.EncodeCacheFlags()); } @@ -233,18 +262,11 @@ } -// PluginCache format: -// LibraryName = ID100000ID200000 -// ID100000ID200000 = FullDllPath -// ID100000ID200000.Flags = Plugin Flags (set VSTPluginLib::DecodeCacheFlags). - // Add a plugin to the list of known plugins. VSTPluginLib *CVstPluginManager::AddPlugin(const mpt::PathString &dllPath, bool fromCache, const bool checkFileExistence, std::wstring *const errStr) //--------------------------------------------------------------------------------------------------------------------------------------------------- { const mpt::PathString fileName = dllPath.GetFileName(); - const char *const cacheSection = "PluginCache"; - const wchar_t *const cacheSectionW = L"PluginCache"; if(checkFileExistence && (PathFileExistsW(dllPath.AsNative().c_str()) == FALSE)) { @@ -367,21 +389,7 @@ if(validPlug) { pluginList.push_back(plug); - - SettingsContainer &cacheFile = theApp.GetPluginCache(); - const std::string IDs = GetPluginCacheID(*plug); - const std::string flagsKey = IDs + ".Flags"; - - mpt::PathString writePath = dllPath; - if(theApp.IsPortableMode()) - { - writePath = theApp.AbsolutePathToRelative(writePath); - } - - cacheFile.Write<mpt::PathString>(cacheSection, IDs, writePath); - cacheFile.Write<mpt::PathString>(cacheSection, IDs, dllPath); - cacheFile.Write<std::string>(cacheSectionW, plug->libraryName.ToWide(), IDs); - cacheFile.Write<int32>(cacheSection, flagsKey, plug->EncodeCacheFlags()); + WriteToCache(*plug); } else { delete plug; @@ -428,8 +436,6 @@ //----------------------------------------------------------------------------------- { VSTPluginLib *pFound = nullptr; - const char *cacheSection = "PluginCache"; - const wchar_t *cacheSectionW = L"PluginCache"; // Find plugin in library int match = 0; @@ -489,7 +495,11 @@ if(IDs.length() >= 16) { fullPath = cacheFile.Read<mpt::PathString>(cacheSection, IDs, MPT_PATHSTRING("")); - if(!fullPath.empty()) pFound = AddPlugin(fullPath); + if(!fullPath.empty()) + { + theApp.RelativePathToAbsolute(fullPath); + pFound = AddPlugin(fullPath); + } } } } @@ -516,9 +526,7 @@ if(oldIsInstrument != pFound->isInstrument || oldCategory != pFound->category) { // Update cached information - SettingsContainer &cacheFile = theApp.GetPluginCache(); - std::string flagsKey = GetPluginCacheID(*pFound) + ".Flags"; - cacheFile.Write<int32>(cacheSection, flagsKey, pFound->EncodeCacheFlags()); + WriteToCache(*pFound); } CVstPlugin *pVstPlug = new (std::nothrow) CVstPlugin(hLibrary, *pFound, mixPlugin, *pEffect, sndFile); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |