From: <sag...@us...> - 2015-06-13 16:10:37
|
Revision: 5310 http://sourceforge.net/p/modplug/code/5310 Author: saga-games Date: 2015-06-13 16:10:31 +0000 (Sat, 13 Jun 2015) Log Message: ----------- [Fix] Export: Enabling instrument or channel mode and then enabling render to sample enabled the sample dropdown list. [Fix] Render To Sample: Fix possible crash when updating instrument mute states after rendering by instrument [Imp] Render To Sample: Create some usable sample names. [Ref] Silence unused variable warning in plugin bridge Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/pluginBridge/Bridge.cpp trunk/OpenMPT/pluginBridge/Bridge.h Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2015-06-13 15:45:54 UTC (rev 5309) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2015-06-13 16:10:31 UTC (rev 5310) @@ -589,7 +589,7 @@ bSel = (IsDlgButtonChecked(IDC_RADIO4) != BST_UNCHECKED) ? FALSE : TRUE; m_CbnFileType.EnableWindow(bSel); - m_CbnSampleSlot.EnableWindow(!bSel); + m_CbnSampleSlot.EnableWindow(!bSel && !IsDlgButtonChecked(IDC_CHECK4) && !IsDlgButtonChecked(IDC_CHECK6)); if(!bSel) { // Render to sample: Always use WAV @@ -670,11 +670,8 @@ { CheckDlgButton(IDC_CHECK6, BST_UNCHECKED); m_CbnSampleSlot.SetCurSel(0); - m_CbnSampleSlot.EnableWindow(FALSE); - } else - { - m_CbnSampleSlot.EnableWindow(IsDlgButtonChecked(IDC_RADIO4)); } + UpdateDialog(); } @@ -686,11 +683,8 @@ { CheckDlgButton(IDC_CHECK4, BST_UNCHECKED); m_CbnSampleSlot.SetCurSel(0); - m_CbnSampleSlot.EnableWindow(FALSE); - } else - { - m_CbnSampleSlot.EnableWindow(IsDlgButtonChecked(IDC_RADIO4)); } + UpdateDialog(); } Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2015-06-13 15:45:54 UTC (rev 5309) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2015-06-13 16:10:31 UTC (rev 5310) @@ -1840,9 +1840,12 @@ } if(!cancel) { + if(GetNumSamples() < smp) m_SndFile.m_nSamples = smp; GetSampleUndo().PrepareUndo(smp, sundo_replace, "Render To Sample"); if(m_SndFile.ReadSampleFromFile(smp, file, false)) { + strcpy(m_SndFile.m_szNames[smp], "Render To Sample"); + strncat(m_SndFile.m_szNames[smp], fileNameAdd, MAX_SAMPLENAME - strlen("Render To Sample") - 1); UpdateAllViews(nullptr, SampleHint().Info().Data().Names()); if(m_SndFile.GetNumInstruments()) { @@ -1884,18 +1887,12 @@ // Restore instruments' / samples' flags if(wsdlg.m_bInstrumentMode) { - if(m_SndFile.GetNumInstruments() == 0) + for(size_t i = 0; i < instrMuteState.size(); i++) { - for(SAMPLEINDEX i = 0; i < m_SndFile.GetNumSamples(); i++) - { - MuteSample(i + 1, instrMuteState[i]); - } - } else - { - for(INSTRUMENTINDEX i = 0; i < m_SndFile.GetNumInstruments(); i++) - { - MuteInstrument(i + 1, instrMuteState[i]); - } + if(m_SndFile.GetNumInstruments() == 0) + MuteSample(static_cast<SAMPLEINDEX>(i + 1), instrMuteState[i]); + else + MuteInstrument(static_cast<INSTRUMENTINDEX>(i + 1), instrMuteState[i]); } } Modified: trunk/OpenMPT/pluginBridge/Bridge.cpp =================================================================== --- trunk/OpenMPT/pluginBridge/Bridge.cpp 2015-06-13 15:45:54 UTC (rev 5309) +++ trunk/OpenMPT/pluginBridge/Bridge.cpp 2015-06-13 16:10:31 UTC (rev 5310) @@ -206,9 +206,10 @@ } if(window) { - MessageHandler(); + Dispatch(effEditIdle, 0, 0, nullptr, 0.0f); } - // 4klang VSTi creates its custom window in the message thread, and it will freeze if we don't dispatch messages here... + // Normally we would only need this block if there's an editor window, but the 4klang VSTi creates + // its custom window in the message thread, and it will freeze if we don't dispatch messages here... MSG msg; while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { @@ -687,12 +688,9 @@ case effGetChunk: // void** in [ptr] for chunk data address + if(getChunkMem.Create(static_cast<const wchar_t *>(origPtr), msg->result)) { - void *chunkPtr = *reinterpret_cast<void **>(&extraData[0]); - if(getChunkMem.Create(static_cast<const wchar_t *>(origPtr), msg->result)) - { - memcpy(getChunkMem.view, *reinterpret_cast<void **>(&extraData[0]), msg->result); - } + memcpy(getChunkMem.view, *reinterpret_cast<void **>(&extraData[0]), msg->result); } break; } @@ -1173,18 +1171,4 @@ } -// WinAPI message handler for plugin GUI -void PluginBridge::MessageHandler() -{ - Dispatch(effEditIdle, 0, 0, nullptr, 0.0f); - - MSG msg; - while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } -} - - OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/pluginBridge/Bridge.h =================================================================== --- trunk/OpenMPT/pluginBridge/Bridge.h 2015-06-13 15:45:54 UTC (rev 5309) +++ trunk/OpenMPT/pluginBridge/Bridge.h 2015-06-13 16:10:31 UTC (rev 5310) @@ -81,7 +81,6 @@ void RenderThread(); static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - void MessageHandler(); static VstIntPtr VSTCALLBACK MasterCallback(AEffect *effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void *ptr, float opt); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |