From: <sag...@us...> - 2011-10-22 23:25:45
|
Revision: 1118 http://modplug.svn.sourceforge.net/modplug/?rev=1118&view=rev Author: saga-games Date: 2011-10-22 23:25:38 +0000 (Sat, 22 Oct 2011) Log Message: ----------- [Fix] Mod Conversion: Instrument fadeout is now limited properly when converting from XM to IT / MPTM. [Fix] General Tab: When enabling surround in the channel setup, panning was not reset properly for playing channels. [Imp] VST: Also checking for new VST entry point ("VSTPluginMain") when loading plugins now. [Mod] VST: Changed host response to audioMasterGetAutomationState opcode (seems more logical that way, although it doesn't seem to be documented at all what this is supposed to do)... Modified Paths: -------------- trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Vstplug.cpp Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2011-10-21 22:19:01 UTC (rev 1117) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2011-10-22 23:25:38 UTC (rev 1118) @@ -396,6 +396,14 @@ pIns->nGlobalVol = 64; pIns->nPan = 128; } + + // Convert XM to IT/MPTM - fix fadeout length + if(oldTypeIsXM && newTypeIsIT_MPT) + { + LimitMax(pIns->nFadeOut, 8192u); + } + + // Convert MPT to anything - remove instrument tunings, Pitch/Tempo Lock if(oldTypeIsMPT) { Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-21 22:19:01 UTC (rev 1117) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-22 23:25:38 UTC (rev 1118) @@ -1311,7 +1311,7 @@ bool CModDoc::MuteSample(SAMPLEINDEX nSample, bool bMute) //------------------------------------------------------- { - if ((nSample < 1) || (nSample > m_SndFile.m_nSamples)) return false; + if ((nSample < 1) || (nSample > m_SndFile.GetNumSamples())) return false; if (bMute) m_SndFile.GetSample(nSample).uFlags |= CHN_MUTE; else m_SndFile.GetSample(nSample).uFlags &= ~CHN_MUTE; return true; @@ -1320,7 +1320,7 @@ bool CModDoc::MuteInstrument(INSTRUMENTINDEX nInstr, bool bMute) //-------------------------------------------------------------- { - if ((nInstr < 1) || (nInstr > m_SndFile.m_nInstruments) || (!m_SndFile.Instruments[nInstr])) return false; + if ((nInstr < 1) || (nInstr > m_SndFile.GetNumInstruments()) || (!m_SndFile.Instruments[nInstr])) return false; if (bMute) m_SndFile.Instruments[nInstr]->dwFlags |= INS_MUTE; else m_SndFile.Instruments[nInstr]->dwFlags &= ~INS_MUTE; return true; @@ -1330,26 +1330,31 @@ bool CModDoc::SurroundChannel(CHANNELINDEX nChn, bool bSurround) //-------------------------------------------------------------- { - DWORD d = (bSurround) ? CHN_SURROUND : 0; + DWORD d = (bSurround ? CHN_SURROUND : 0); - if (nChn >= m_SndFile.m_nChannels) return false; - if (!(m_SndFile.m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))) d = 0; + if (nChn >= m_SndFile.GetNumChannels()) return false; + if (!(m_SndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) d = 0; if (d != (m_SndFile.ChnSettings[nChn].dwFlags & CHN_SURROUND)) { - if (m_SndFile.m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) SetModified(); + if (m_SndFile.GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) SetModified(); if (d) { m_SndFile.ChnSettings[nChn].dwFlags |= CHN_SURROUND; m_SndFile.ChnSettings[nChn].nPan = 128; - } - else + } else { m_SndFile.ChnSettings[nChn].dwFlags &= ~CHN_SURROUND; } } - if (d) m_SndFile.Chn[nChn].dwFlags |= CHN_SURROUND; - else m_SndFile.Chn[nChn].dwFlags &= ~CHN_SURROUND; + if (d) + { + m_SndFile.Chn[nChn].dwFlags |= CHN_SURROUND; + m_SndFile.Chn[nChn].nPan = 128; + } else + { + m_SndFile.Chn[nChn].dwFlags &= ~CHN_SURROUND; + } return true; } @@ -1358,7 +1363,7 @@ //------------------------------------------------------------------- { bool bOk = false; - if ((nChn >= m_SndFile.m_nChannels) || (nVolume > 64)) return false; + if ((nChn >= m_SndFile.GetNumChannels()) || (nVolume > 64)) return false; if (m_SndFile.ChnSettings[nChn].nVolume != nVolume) { m_SndFile.ChnSettings[nChn].nVolume = nVolume; @@ -1374,7 +1379,7 @@ //-------------------------------------------------------------- { bool bOk = false; - if ((nChn >= m_SndFile.m_nChannels) || (nPan > 256)) return false; + if ((nChn >= m_SndFile.GetNumChannels()) || (nPan > 256)) return false; if (m_SndFile.ChnSettings[nChn].nPan != nPan) { m_SndFile.ChnSettings[nChn].nPan = nPan; Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-10-21 22:19:01 UTC (rev 1117) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-10-22 23:25:38 UTC (rev 1118) @@ -300,6 +300,10 @@ { BOOL bOk = FALSE; PVSTPLUGENTRY pMainProc = (PVSTPLUGENTRY)GetProcAddress(hLib, "main"); + if(pMainProc == NULL) + { + pMainProc = (PVSTPLUGENTRY)GetProcAddress(hLib, "VSTPluginMain"); + } #ifdef ENABLE_BUZZ GET_INFO pBuzzGetInfo = (GET_INFO)GetProcAddress(hLib, "GetInfo"); #endif // ENABLE_BUZZ @@ -569,6 +573,10 @@ { AEffect *pEffect = NULL; PVSTPLUGENTRY pEntryPoint = (PVSTPLUGENTRY)GetProcAddress(hLibrary, "main"); + if(pEntryPoint == NULL) + { + pEntryPoint = (PVSTPLUGENTRY)GetProcAddress(hLibrary, "VSTPluginMain"); + } #ifdef ENABLE_BUZZ GET_INFO pBuzzGetInfo = (GET_INFO)GetProcAddress(hLibrary, "GetInfo"); CREATE_MACHINE pBuzzCreateMachine = (CREATE_MACHINE)GetProcAddress(hLibrary, "CreateMachine"); @@ -827,7 +835,11 @@ // parameters - DEPRECATED in VST 2.4 case audioMasterGetNumAutomatableParameters: - Log("VST plugin to host: Get Num Automatable Parameters\n"); + //Log("VST plugin to host: Get Num Automatable Parameters\n"); + if(pVstPlugin != nullptr) + { + return pVstPlugin->GetNumParameters(); + } break; // Apparently, this one is broken in VST SDK anyway. - DEPRECATED in VST 2.4 @@ -909,7 +921,7 @@ // Not entirely sure what this means. We can write automation TO the plug. // Is that "read" in this context? //Log("VST plugin to host: Get Automation State\n"); - return kVstAutomationRead; + return kVstAutomationReadWrite; case audioMasterOfflineStart: Log("VST plugin to host: Offlinestart\n"); @@ -942,7 +954,7 @@ break; case audioMasterGetVendorString: - strcpy((char *) ptr, s_szHostVendorString); + strncpy((char *) ptr, s_szHostVendorString, 64); //strcpy((char*)ptr,"Steinberg"); //return 0; return true; @@ -952,7 +964,7 @@ //return 7000; case audioMasterGetProductString: - strcpy((char *) ptr, s_szHostProductString); + strncpy((char *) ptr, s_szHostProductString, 64); //strcpy((char*)ptr,"Cubase VST"); //return 0; return true; @@ -1602,7 +1614,7 @@ return 0; } -//rewbs.VSTcompliance: changed from BOOL to long + PlugParamIndex CVstPlugin::GetNumParameters() //------------------------------------------- { @@ -1613,7 +1625,7 @@ return 0; } -//rewbs.VSTpresets + VstInt32 CVstPlugin::GetUID() //--------------------------- { @@ -1622,6 +1634,7 @@ return m_pEffect->uniqueID; } + VstInt32 CVstPlugin::GetVersion() //------------------------------- { @@ -1631,38 +1644,36 @@ return m_pEffect->version; } + bool CVstPlugin::GetParams(float *param, VstInt32 min, VstInt32 max) //------------------------------------------------------------------ { if (!(m_pEffect)) return false; - if (max>m_pEffect->numParams) - max = m_pEffect->numParams; + LimitMax(max, m_pEffect->numParams); for (VstInt32 p = min; p < max; p++) - param[p-min]=GetParameter(p); + param[p - min]=GetParameter(p); return true; } + bool CVstPlugin::RandomizeParams(VstInt32 minParam, VstInt32 maxParam) //-------------------------------------------------------------------- { if (!(m_pEffect)) return false; - if (minParam==0 && maxParam==0) + if (minParam == 0 && maxParam == 0) { - minParam=0; - maxParam=m_pEffect->numParams; + minParam = 0; + maxParam = m_pEffect->numParams; } - else if (maxParam>m_pEffect->numParams) - { - maxParam=m_pEffect->numParams; - } + LimitMax(maxParam, m_pEffect->numParams); for (VstInt32 p = minParam; p < maxParam; p++) SetParameter(p, (rand() / float(RAND_MAX))); @@ -1670,6 +1681,7 @@ return true; } + bool CVstPlugin::SaveProgram(CString fileName) //-------------------------------------------- { @@ -1714,6 +1726,7 @@ } + bool CVstPlugin::LoadProgram(CString fileName) //-------------------------------------------- { @@ -1742,6 +1755,7 @@ } //end rewbs.VSTpresets + VstIntPtr CVstPlugin::Dispatch(VstInt32 opCode, VstInt32 index, VstIntPtr value, void *ptr, float opt) //---------------------------------------------------------------------------------------------------- { @@ -3031,18 +3045,21 @@ return slot; } + void CVstPlugin::SetSlot(PLUGINDEX slot) //-------------------------------------- { m_nSlot = slot; } + PLUGINDEX CVstPlugin::GetSlot() //----------------------------- { return m_nSlot; } + void CVstPlugin::UpdateMixStructPtr(PSNDMIXPLUGIN p) //-------------------------------------------------- { @@ -3058,13 +3075,14 @@ return false; } + bool CVstPlugin::CanRecieveMidiEvents() //------------------------------------- { - CString s = "receiveVstMidiEvent"; - return (CVstPlugin::Dispatch(effCanDo, 0, 0, (char*)(LPCTSTR)s, 0) != 0); + return (CVstPlugin::Dispatch(effCanDo, 0, nullptr, "receiveVstMidiEvent", 0.0f) != 0); } + void CVstPlugin::GetOutputPlugList(CArray<CVstPlugin*, CVstPlugin*> &list) //------------------------------------------------------------------------ { @@ -4073,15 +4091,16 @@ } +#endif // NO_VST + const char* SNDMIXPLUGIN::GetLibraryName() -//------------------------------------ +//---------------------------------------- { StringFixer::SetNullTerminator(Info.szLibraryName); - if(Info.szLibraryName[0]) return Info.szLibraryName; + if(Info.szLibraryName[0]) return Info.szLibraryName; else return 0; } -#endif // NO_VST CString SNDMIXPLUGIN::GetParamName(const UINT index) const //-------------------------------------------------------- @@ -4091,7 +4110,9 @@ return reinterpret_cast<CVstPlugin *>(pMixPlugin)->GetParamName(index); } else + { return CString(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |