From: <sag...@us...> - 2013-12-16 17:07:16
|
Revision: 3482 http://sourceforge.net/p/modplug/code/3482 Author: saga-games Date: 2013-12-16 17:07:08 +0000 (Mon, 16 Dec 2013) Log Message: ----------- [Mod] Instead of testing if the moddoc associated with a sndfile is null, add a separate loading flag to not load any plugins. [Mod] When normalizing loaded samples, prevent sample volume from being 0. [Ref] Further small changes. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2013-12-16 17:04:30 UTC (rev 3481) +++ trunk/OpenMPT/mptrack/Mptrack.h 2013-12-16 17:07:08 UTC (rev 3482) @@ -48,10 +48,24 @@ ////////////////////////////////////////////////////////////////////////// // Dragon Droppings +enum DragonDropType +{ + DRAGONDROP_NOTHING=0, // |------< Drop Type >-------------|--< dwDropItem >---|--< lDropParam >---| + DRAGONDROP_DLS, // | Instrument from a DLS bank | DLS Bank # | DLS Instrument | + DRAGONDROP_SAMPLE, // | Sample from a song | Sample # | NULL | + DRAGONDROP_INSTRUMENT, // | Instrument from a song | Instrument # | NULL | + DRAGONDROP_SOUNDFILE, // | File from instrument library | ? | File Name | + DRAGONDROP_MIDIINSTR, // | File from midi library | Midi Program/Perc | File Name | + DRAGONDROP_PATTERN, // | Pattern from a song | Pattern # | NULL | + DRAGONDROP_ORDER, // | Pattern index in a song | Order # | NULL | + DRAGONDROP_SONG, // | Song file (mod/s3m/xm/it) | 0 | File Name | + DRAGONDROP_SEQUENCE // | Sequence (a set of orders) | Sequence # | NULL | +}; + struct DRAGONDROP { CModDoc *pModDoc; - DWORD dwDropType; + DragonDropType dwDropType; DWORD dwDropItem; LPARAM lDropParam; @@ -67,20 +81,7 @@ } }; -enum { - DRAGONDROP_NOTHING=0, // |------< Drop Type >-------------|--< dwDropItem >---|--< lDropParam >---| - DRAGONDROP_DLS, // | Instrument from a DLS bank | DLS Bank # | DLS Instrument | - DRAGONDROP_SAMPLE, // | Sample from a song | Sample # | NULL | - DRAGONDROP_INSTRUMENT, // | Instrument from a song | Instrument # | NULL | - DRAGONDROP_SOUNDFILE, // | File from instrument library | ? | pszFileName | - DRAGONDROP_MIDIINSTR, // | File from midi library | Midi Program/Perc | pszFileName | - DRAGONDROP_PATTERN, // | Pattern from a song | Pattern # | NULL | - DRAGONDROP_ORDER, // | Pattern index in a song | Order # | NULL | - DRAGONDROP_SONG, // | Song file (mod/s3m/xm/it) | 0 | pszFileName | - DRAGONDROP_SEQUENCE // | Sequence (a set of orders) | Sequence # | NULL | -}; - ///////////////////////////////////////////////////////////////////////////// // Document Template @@ -232,7 +233,7 @@ static bool OpenDirectory(const mpt::PathString &directory) { return OpenURL(directory); }; int GetOpenDocumentCount() const; - std::vector<CModDoc *>GetOpenDocuments() const; + std::vector<CModDoc *> GetOpenDocuments() const; public: bool InGuiThread() const { return GetCurrentThreadId() == m_GuiThreadId; } Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2013-12-16 17:04:30 UTC (rev 3481) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2013-12-16 17:07:08 UTC (rev 3482) @@ -340,7 +340,7 @@ } if(m_SongFile != nullptr) { - if(!m_SongFile->Create(file, CSoundFile::loadNoPatternData, nullptr)) + if(!m_SongFile->Create(file, CSoundFile::loadNoPatternOrPluginData, nullptr)) { return false; } Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-12-16 17:04:30 UTC (rev 3481) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-12-16 17:07:08 UTC (rev 3482) @@ -766,18 +766,9 @@ { if (ChnSettings[ich].nVolume > 64) ChnSettings[ich].nVolume = 64; if (ChnSettings[ich].nPan > 256) ChnSettings[ich].nPan = 128; - Chn[ich].nPan = ChnSettings[ich].nPan; - Chn[ich].nGlobalVol = ChnSettings[ich].nVolume; - Chn[ich].dwFlags = ChnSettings[ich].dwFlags; - Chn[ich].nVolume = 256; - Chn[ich].nCutOff = 0x7F; - Chn[ich].nEFxSpeed = 0; - //IT compatibility 15. Retrigger - if(IsCompatibleMode(TRK_IMPULSETRACKER)) - { - Chn[ich].nRetrigParam = Chn[ich].nRetrigCount = 1; - } + Chn[ich].Reset(ModChannel::resetTotal, *this, ich); } + // Checking samples ModSample *pSmp = Samples; for(SAMPLEINDEX nSmp = 0; nSmp < MAX_SAMPLES; nSmp++, pSmp++) @@ -836,8 +827,7 @@ std::vector<PLUGINDEX> notFoundIDs; #ifndef NO_VST - // Load plugins only when m_pModDoc is valid. (can be invalid for example when examining module samples in treeview. - if (gpMixPluginCreateProc && GetpModDoc() != nullptr) + if (gpMixPluginCreateProc && (loadFlags & loadPluginData)) { for(PLUGINDEX iPlug = 0; iPlug < MAX_MIXPLUGINS; iPlug++) { @@ -847,15 +837,15 @@ if (m_MixPlugins[iPlug].pMixPlugin) { // plugin has been found - m_MixPlugins[iPlug].pMixPlugin->RestoreAllParameters(m_MixPlugins[iPlug].defaultProgram); //rewbs.plugDefaultProgram: added param - } - else + m_MixPlugins[iPlug].pMixPlugin->RestoreAllParameters(m_MixPlugins[iPlug].defaultProgram); + } else { // plugin not found - add to list bool found = false; for(std::vector<PLUGINDEX>::iterator i = notFoundIDs.begin(); i != notFoundIDs.end(); ++i) { - if(m_MixPlugins[*i].Info.dwPluginId2 == m_MixPlugins[iPlug].Info.dwPluginId2) + if(m_MixPlugins[*i].Info.dwPluginId2 == m_MixPlugins[iPlug].Info.dwPluginId2 + && m_MixPlugins[*i].Info.dwPluginId1 == m_MixPlugins[iPlug].Info.dwPluginId1) { found = true; break; @@ -873,7 +863,7 @@ } } - // Display a nice message so the user sees what plugins are missing + // Display a nice message so the user sees which plugins are missing // TODO: Use IDD_MODLOADING_WARNINGS dialog (NON-MODAL!) to display all warnings that are encountered when loading a module. if(!notFoundIDs.empty()) { Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-12-16 17:04:30 UTC (rev 3481) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-12-16 17:07:08 UTC (rev 3482) @@ -462,9 +462,10 @@ onlyVerifyHeader = 0x00, loadPatternData = 0x01, // If unset, advise loaders to not process any pattern data (if possible) loadSampleData = 0x02, // If unset, advise loaders to not process any sample data (if possible) + loadPluginData = 0x04, // If unset, plugins are not instanciated. // Shortcuts - loadCompleteModule = loadSampleData | loadPatternData, - loadNoPatternData = loadSampleData, + loadCompleteModule = loadSampleData | loadPatternData | loadPluginData, + loadNoPatternOrPluginData = loadSampleData, }; #ifdef MODPLUG_TRACKER This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |