From: <sag...@us...> - 2013-12-10 21:49:07
|
Revision: 3435 http://sourceforge.net/p/modplug/code/3435 Author: saga-games Date: 2013-12-10 21:48:58 +0000 (Tue, 10 Dec 2013) Log Message: ----------- [Fix] VST: Strum Acoustic GS-1 and Strum Electric GS-1 no longer crash on startup (broken since rev.1110 / OpenMPT 1.20) [Mod] VST: Optimize VST window redrawing a little bit by not filling the window with the default background colour (removes flicker when resizing plugin windows) [Mod] OpenMPT: Version is now 1.22.07.07 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/VSTEditor.cpp trunk/OpenMPT/mptrack/VSTEditor.h trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-12-10 20:02:26 UTC (rev 3434) +++ trunk/OpenMPT/common/versionNumber.h 2013-12-10 21:48:58 UTC (rev 3435) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 07 -#define VER_MINORMINOR 06 +#define VER_MINORMINOR 07 //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/VSTEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/VSTEditor.cpp 2013-12-10 20:02:26 UTC (rev 3434) +++ trunk/OpenMPT/mptrack/VSTEditor.cpp 2013-12-10 21:48:58 UTC (rev 3435) @@ -16,6 +16,11 @@ #ifndef NO_VST +BEGIN_MESSAGE_MAP(COwnerVstEditor, CDialog) + ON_WM_ERASEBKGND() +END_MESSAGE_MAP() + + COwnerVstEditor::COwnerVstEditor(CVstPlugin &plugin) : CAbstractVstEditor(plugin) //------------------------------------------------------------------------------- { Modified: trunk/OpenMPT/mptrack/VSTEditor.h =================================================================== --- trunk/OpenMPT/mptrack/VSTEditor.h 2013-12-10 20:02:26 UTC (rev 3434) +++ trunk/OpenMPT/mptrack/VSTEditor.h 2013-12-10 21:48:58 UTC (rev 3435) @@ -27,6 +27,9 @@ virtual void OnOK(); virtual void OnCancel(); + DECLARE_MESSAGE_MAP() + afx_msg BOOL OnEraseBkgnd(CDC *) { return TRUE; } + // Plugins may request to change the GUI size. virtual bool IsResizable() const { return true; }; virtual bool SetSize(int contentWidth, int contentHeight); Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2013-12-10 20:02:26 UTC (rev 3434) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2013-12-10 21:48:58 UTC (rev 3435) @@ -23,7 +23,6 @@ #include "MIDIMappingDialog.h" #include "../common/StringFixer.h" #include "MemoryMappedFile.h" -#include "../soundlib/FileReader.h" #include "FileDialog.h" #include "../common/mptFstream.h" @@ -55,7 +54,10 @@ { // Called when plugin param is changed via gui case audioMasterAutomate: - if (pVstPlugin != nullptr && pVstPlugin->CanAutomateParameter(index)) + // Strum Acoustic GS-1 and Strum Electric GS-1 send audioMasterAutomate during effOpen (WTF #1), + // but when sending back effCanBeAutomated, they just crash (WTF #2). + // As a consequence, just generally forbid this action while the plugin is not fully initialized yet. + if(pVstPlugin != nullptr && pVstPlugin->isInitialized && pVstPlugin->CanAutomateParameter(index)) { // This parameter can be automated. Ugo Motion constantly sends automation callback events for parameters that cannot be automated... pVstPlugin->AutomateParameter((PlugParamIndex)index); @@ -642,7 +644,6 @@ m_pNext = nullptr; m_pMixStruct = &mixStruct; m_pEditor = nullptr; - m_nInputs = m_nOutputs = 0; m_nEditorX = m_nEditorY = -1; m_pProcessFP = nullptr; @@ -656,6 +657,7 @@ m_bSongPlaying = false; m_bPlugResumed = false; m_nSampleRate = uint32_max; + isInitialized = false; MemsetZero(m_MidiCh); for(int ch = 0; ch < 16; ch++) @@ -677,6 +679,8 @@ m_Factory.pPluginsList->m_pPrev = this; } m_Factory.pPluginsList = this; + + isInitialized = true; } @@ -692,6 +696,7 @@ //Store a pointer so we can get the CVstPlugin object from the basic VST effect object. m_Effect.resvd1 = ToVstPtr(this); m_nSlot = FindSlot(); + m_nSampleRate = m_SndFile.GetSampleRate(); Dispatch(effOpen, 0, 0, nullptr, 0.0f); // VST 2.0 plugins return 2 here, VST 2.4 plugins return 2400... Great! @@ -748,8 +753,7 @@ } - m_nSampleRate = m_SndFile.GetSampleRate(); - Dispatch(effSetSampleRate, 0, 0, nullptr, static_cast<float>(m_SndFile.GetSampleRate())); + Dispatch(effSetSampleRate, 0, 0, nullptr, static_cast<float>(m_nSampleRate)); Dispatch(effSetBlockSize, 0, MIXBUFFERSIZE, nullptr, 0.0f); if(m_Effect.numPrograms > 0) { @@ -773,7 +777,7 @@ m_pProcessFP = (m_Effect.flags & effFlagsCanReplacing) ? m_Effect.processReplacing : m_Effect.process; // issue samplerate again here, cos some plugs like it before the block size, other like it right at the end. - Dispatch(effSetSampleRate, 0, 0, nullptr, static_cast<float>(m_SndFile.GetSampleRate())); + Dispatch(effSetSampleRate, 0, 0, nullptr, static_cast<float>(m_nSampleRate)); // Korg Wavestation GUI won't work until plugin was resumed at least once. // On the other hand, some other plugins (notably Synthedit plugins like Superwave P8 2.3 or Rez 3.0) don't like this @@ -793,11 +797,8 @@ bool CVstPlugin::InitializeIOBuffers() //------------------------------------ { - m_nInputs = m_Effect.numInputs; - m_nOutputs = m_Effect.numOutputs; - // Input pointer array size must be >= 2 for now - the input buffer assignment might write to non allocated mem. otherwise - bool result = mixBuffer.Initialize(MAX(m_nInputs, 2), m_nOutputs); + bool result = mixBuffer.Initialize(MAX(m_Effect.numInputs, 2), m_Effect.numOutputs); m_MixState.pOutBufferL = mixBuffer.GetInputBuffer(0); m_MixState.pOutBufferR = mixBuffer.GetInputBuffer(1); @@ -1483,15 +1484,15 @@ ASSERT(outputBuffers != nullptr); // Mix outputs of multi-output VSTs: - if(m_nOutputs > 2) + if(m_Effect.numOutputs > 2) { // first, mix extra outputs on a stereo basis - uint32 numOutputs = m_nOutputs; + VstInt32 numOutputs = m_Effect.numOutputs; // so if nOuts is not even, let process the last output later if((numOutputs % 2u) == 1) numOutputs--; // mix extra stereo outputs - for(uint32 iOut = 2; iOut < numOutputs; iOut++) + for(VstInt32 iOut = 2; iOut < numOutputs; iOut++) { for(size_t i = 0; i < nSamples; i++) { @@ -1499,10 +1500,10 @@ } } - // if m_nOutputs is odd, mix half the signal of last output to each channel - if(numOutputs != m_nOutputs) + // if m_Effect.numOutputs is odd, mix half the signal of last output to each channel + if(numOutputs != m_Effect.numOutputs) { - // trick : if we are here, nOuts = m_nOutputs - 1 !!! + // trick : if we are here, nOuts = m_Effect.numOutputs - 1 !!! for(size_t i = 0; i < nSamples; i++) { float v = 0.5f * outputBuffers[numOutputs][i]; Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2013-12-10 20:02:26 UTC (rev 3434) +++ trunk/OpenMPT/mptrack/Vstplug.h 2013-12-10 21:48:58 UTC (rev 3435) @@ -137,7 +137,6 @@ size_t m_nRefCount; uint32 m_nSampleRate; SNDMIXPLUGINSTATE m_MixState; - uint32 m_nInputs, m_nOutputs; int32 m_nEditorX, m_nEditorY; float m_fGain; @@ -146,6 +145,7 @@ bool m_bPlugResumed; bool m_bIsVst2; bool m_bIsInstrument; + bool isInitialized; VSTInstrChannel m_MidiCh[16]; // MIDI channel state PluginMixBuffer<float, MIXBUFFERSIZE> mixBuffer; // Float buffers (input and output) for plugins This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |