From: <sag...@us...> - 2015-06-05 23:53:33
|
Revision: 5257 http://sourceforge.net/p/modplug/code/5257 Author: saga-games Date: 2015-06-05 23:53:25 +0000 (Fri, 05 Jun 2015) Log Message: ----------- [Fix] Since allowing several shortcuts to share the same keys, it was possible that shortcuts that switch between modules (e.g. open/close/prev doc/next doc) would regnerate the keymap and in the process also invalidate the multimap iterators, leading to OpenMPT doing weird things. [Fix] Pitch envelope was not actually applied during sample sync. [Mod] OpenMPT: Version is now 1.25.00.11 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2015-06-05 20:22:32 UTC (rev 5256) +++ trunk/OpenMPT/common/versionNumber.h 2015-06-05 23:53:25 UTC (rev 5257) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 25 #define VER_MINOR 00 -#define VER_MINORMINOR 10 +#define VER_MINORMINOR 11 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2015-06-05 20:22:32 UTC (rev 5256) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2015-06-05 23:53:25 UTC (rev 5257) @@ -9,15 +9,10 @@ #include "stdafx.h" -#include "afxtempl.h" #include "CommandSet.h" -#include "inputhandler.h" -#include "Resource.h" -#include "mptrack.h" -#include "mainfrm.h" -#include <direct.h> -#include ".\inputhandler.h" -#include <Shlwapi.h> +#include "InputHandler.h" +#include "resource.h" +#include "Mainfrm.h" OPENMPT_NAMESPACE_BEGIN @@ -87,6 +82,31 @@ } +static CommandID SendCommands(CWnd *wnd, const KeyMapRange &cmd, WPARAM wParam) +//----------------------------------------------------------------------------- +{ + CommandID executeCommand = kcNull; + if(wnd != nullptr) + { + std::vector<CommandID> commands; + commands.reserve(std::distance(cmd.first, cmd.second)); + for(KeyMap::const_iterator i = cmd.first; i != cmd.second; i++) + { + commands.push_back(i->second); + } + for(std::vector<CommandID>::const_iterator i = commands.begin(); i != commands.end(); i++) + { + if(wnd->SendMessage(WM_MOD_KEYCOMMAND, *i, wParam)) + { + // Command was handled, no need to let the OS handle it + executeCommand = *i; + } + } + } + return executeCommand; +} + + CommandID CInputHandler::GeneralKeyEvent(InputTargetContext context, int code, WPARAM wParam, LPARAM lParam) //---------------------------------------------------------------------------------------------------------- { @@ -128,21 +148,7 @@ cmd = keyMap.equal_range(KeyCombination(context, HOTKEYF_MIDI, wParam, kKeyEventDown)); } - CommandID executeCommand = kcNull; - if(m_pMainFrm) - { - for(KeyMap::const_iterator i = cmd.first; i != cmd.second; i++) - { - executeCommand = i->second; - if(!m_pMainFrm->SendMessage(WM_MOD_KEYCOMMAND, executeCommand, wParam)) - { - // Command was not handled, so let Windows process it. - return kcNull; - } - } - } - - return executeCommand; + return SendCommands(m_pMainFrm, cmd, wParam); } @@ -152,25 +158,10 @@ if(InterceptSpecialKeys(nChar, nFlags, false)) return kcNull; KeyMapRange cmd = keyMap.equal_range(KeyCombination(context, modifierMask, nChar, keyEventType)); - CommandID executeCommand = kcNull; if(pSourceWnd == nullptr) pSourceWnd = m_pMainFrm; //by default, send command message to main frame. - - if(pSourceWnd != nullptr) - { - for(KeyMap::const_iterator i = cmd.first; i != cmd.second; i++) - { - executeCommand = i->second; - if(!pSourceWnd->SendMessage(WM_MOD_KEYCOMMAND, executeCommand, nChar)) - { - // Command was not handled, so let Windows process it. - return kcNull; - } - } - } - - return executeCommand; + return SendCommands(pSourceWnd, cmd, nChar); } Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-06-05 20:22:32 UTC (rev 5256) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-06-05 23:53:25 UTC (rev 5257) @@ -104,6 +104,8 @@ const SmpLength sampleEnd = chn.dwFlags[CHN_LOOP] ? chn.nLoopEnd : chn.nLength; const SmpLength loopLength = chn.nLoopEnd - chn.nLoopStart; + const bool itEnvMode = sndFile.IsCompatibleMode(TRK_IMPULSETRACKER); + const bool updatePitchEnv = (chn.PitchEnv.flags & (ENV_ENABLED | ENV_FILTER)) == ENV_ENABLED; bool stopNote = false; int32 inc = chn.nInc * tickDuration; @@ -133,13 +135,20 @@ updateInc = true; } - sndFile.IncrementEnvelopePositions(&chn); + int period = chn.nPeriod; + if(itEnvMode) sndFile.IncrementEnvelopePositions(&chn); + if(updatePitchEnv) + { + sndFile.ProcessPitchFilterEnvelope(&chn, period); + updateInc = true; + } + if(!itEnvMode) sndFile.IncrementEnvelopePositions(&chn); int vol = 0; sndFile.ProcessInstrumentFade(&chn, vol); if(updateInc || chnSettings[channel].incChanged) { - chn.nInc = sndFile.GetChannelIncrement(&chn, chn.nPeriod, 0); + chn.nInc = sndFile.GetChannelIncrement(&chn, period, 0); chnSettings[channel].incChanged = false; inc = chn.nInc * tickDuration; if(chn.dwFlags[CHN_PINGPONGFLAG]) inc = -inc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |