From: <sag...@us...> - 2012-01-02 00:14:18
|
Revision: 1151 http://modplug.svn.sourceforge.net/modplug/?rev=1151&view=rev Author: saga-games Date: 2012-01-02 00:14:12 +0000 (Mon, 02 Jan 2012) Log Message: ----------- [Imp] VST: Added support for audioMasterIOChanged Modified Paths: -------------- trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2012-01-01 21:52:39 UTC (rev 1150) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2012-01-02 00:14:12 UTC (rev 1151) @@ -872,7 +872,11 @@ // numInputs and/or numOutputs has changed case audioMasterIOChanged: - Log("VST plugin to host: IOchanged\n"); + if (pVstPlugin != nullptr) + { + CriticalSection cs; + return pVstPlugin->InitializeIOBuffers() ? 1 : 0; + } break; // plug needs idle calls (outside its editor window) - DEPRECATED in VST 2.4 @@ -1464,15 +1468,8 @@ } Dispatch(effMainsChanged, 0, 1, NULL, 0.0f); - m_nInputs = m_pEffect->numInputs; - m_nOutputs = m_pEffect->numOutputs; + InitializeIOBuffers(); - // Input pointer array size must be >= 2 for now - the input buffer assignment might write to non allocated mem. otherwise - mixBuffer.Initialize(max(m_nInputs, 2), m_nOutputs); - m_MixState.pOutBufferL = mixBuffer.GetInputBuffer(0); - m_MixState.pOutBufferR = mixBuffer.GetInputBuffer(1); - - #ifdef VST_LOG Log("%s: vst ver %d.0, flags=%04X, %d programs, %d parameters\n", m_pFactory->szLibraryName, (m_bIsVst2) ? 2 : 1, m_pEffect->flags, @@ -1496,6 +1493,21 @@ } +bool CVstPlugin::InitializeIOBuffers() +//------------------------------------ +{ + m_nInputs = m_pEffect->numInputs; + m_nOutputs = m_pEffect->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); + m_MixState.pOutBufferL = mixBuffer.GetInputBuffer(0); + m_MixState.pOutBufferR = mixBuffer.GetInputBuffer(1); + + return result; +} + + CVstPlugin::~CVstPlugin() //----------------------- { Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2012-01-01 21:52:39 UTC (rev 1150) +++ trunk/OpenMPT/mptrack/Vstplug.h 2012-01-02 00:14:12 UTC (rev 1151) @@ -153,6 +153,8 @@ CAbstractVstEditor* GetEditor(); //rewbs.defaultPlugGUI bool GetSpeakerArrangement(); //rewbs.VSTCompliance + bool InitializeIOBuffers(); + bool Bypass(bool bypass = true); //rewbs.defaultPlugGUI bool IsBypassed() const { return m_pMixStruct->IsBypassed(); }; //rewbs.defaultPlugGUI This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |