From: <sag...@us...> - 2014-04-14 14:15:49
|
Revision: 4012 http://sourceforge.net/p/modplug/code/4012 Author: saga-games Date: 2014-04-14 14:15:39 +0000 (Mon, 14 Apr 2014) Log Message: ----------- [Fix] SF2 import: Fixed potentially off-key sample import [Fix] SF2 import: Sample frequency conversion was broken in 64-bit builds (https://bugs.openmpt.org/view.php?id=508). [Fix] Plugin bridge: Fixed KarmaFX EQ and other plugins that don't set any specific time flags, but still call audioMasterGetTime. [Fix] Pattern tab: Dragging an order selection also works if the first selection point isn't visible. [Fix] Added some tool bar help texts and fixed misplaced label in keyboard config. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/pluginBridge/Bridge.cpp trunk/OpenMPT/soundlib/Dlsbank.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2014-04-13 15:19:18 UTC (rev 4011) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2014-04-14 14:15:39 UTC (rev 4012) @@ -805,9 +805,9 @@ m_nScrollPos2nd = ORDERINDEX_INVALID; SetCurSel(nOrder, true, IsSelectionKeyPressed()); } - m_bDragging = !IsOrderInMargins(m_nScrollPos, oldXScroll); + m_bDragging = !IsOrderInMargins(m_nScrollPos, oldXScroll) || !IsOrderInMargins(m_nScrollPos2nd, oldXScroll); - if(m_bDragging == true) + if(m_bDragging) { m_nDragOrder = GetCurSel(true).firstOrd; m_nDropPos = m_nDragOrder; Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-04-13 15:19:18 UTC (rev 4011) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-04-14 14:15:39 UTC (rev 4012) @@ -211,9 +211,9 @@ LTEXT "If enabled, a randomized user ID is created and transmitted with every update check. This ID can not be linked to you or your computer in any way.",IDC_STATIC,12,102,264,24 GROUPBOX "Advanced Settings",IDC_STATIC,6,138,276,60 LTEXT "&Update server URL:",IDC_STATIC,12,150,186,8 - EDITTEXT IDC_EDIT1,12,162,246,12,ES_AUTOHSCROLL - PUSHBUTTON "&Reset",IDC_BUTTON2,204,146,54,12 - LTEXT "Do not change this unless you are absolutely sure of what you are doing.",IDC_STATIC,12,180,246,12 + EDITTEXT IDC_EDIT1,12,162,264,12,ES_AUTOHSCROLL + PUSHBUTTON "&Reset",IDC_BUTTON2,222,146,54,12 + LTEXT "Do not change this unless you are absolutely sure of what you are doing.",IDC_STATIC,12,180,264,12 PUSHBUTTON "&Check for Updates",IDC_BUTTON1,6,204,84,18 LTEXT "",IDC_LASTUPDATE,6,228,276,24 END @@ -634,7 +634,7 @@ LISTBOX IDC_COMMAND_LIST,5,32,139,226,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP GROUPBOX "Key setup for this command ",IDC_STATIC,150,6,132,84 COMBOBOX IDC_CHOICECOMBO,156,18,78,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Key:",IDC_STATIC,150,38,16,8 + LTEXT "Key:",IDC_STATIC,156,38,16,8 EDITTEXT IDC_CUSTHOTKEY,174,36,60,13,ES_AUTOHSCROLL CONTROL "On Key Down",IDC_CHECKKEYDOWN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,54,66,8 CONTROL "On Key Hold",IDC_CHECKKEYHOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,66,66,8 @@ -2419,6 +2419,8 @@ ID_SAMPLE_TRIM "Delete everything except the current selection\nTrim Sample" ID_FILE_SAVEMIDI "Export the current song to a standard MIDI file" ID_INSTRUMENT_SAMPLEMAP "Edit the sample map" + ID_SAMPLE_ZOOMUP "Zoom In" + ID_SAMPLE_ZOOMDOWN "Zoom Out" ID_PATTERNDETAIL_LO "Low pattern detail level\nLow pattern detail level" ID_PATTERNDETAIL_MED "Medium pattern detail level\nMedium pattern detail level" ID_PATTERNDETAIL_HI "High pattern detail level\nHigh pattern detail level" @@ -2470,6 +2472,7 @@ BEGIN ID_PANIC "Kill all VSTi and sample voices\nStop all hanging VSTi and sample voices" ID_VIEW_EDITHISTORY "View the edit history of this module" + ID_SAMPLE_GRID "Configure Sample Grid" ID_FILE_SAVEASTEMPLATE "Save the active document as template module\nSave as Template" END Modified: trunk/OpenMPT/pluginBridge/Bridge.cpp =================================================================== --- trunk/OpenMPT/pluginBridge/Bridge.cpp 2014-04-13 15:19:18 UTC (rev 4011) +++ trunk/OpenMPT/pluginBridge/Bridge.cpp 2014-04-14 14:15:39 UTC (rev 4012) @@ -13,8 +13,8 @@ // Fix Purity Demo GUI freeze more nicely // Optimize out audioMasterProcessEvents the same way as effProcessEvents? // Find a nice solution for audioMasterIdle that doesn't break TAL-Elek7ro-II -// KaramFX EQ breaks sound // Maybe don't keep opening and closing aux mem files - but they are rarely needed, so would this actually be worth it? +// Kirnu GUI deadlocks // Low priority: // Speed up things like consecutive calls to CVstPlugin::GetFormattedProgramName by a custom opcode (is this necessary?) @@ -33,9 +33,13 @@ #include <algorithm> //#include <cassert> +#ifdef _DEBUG #include <intrin.h> #undef assert #define assert(x) while(!(x)) { ::MessageBoxA(NULL, #x, "Debug Assertion Failed", MB_ICONERROR); __debugbreak(); break; } +#else +#define assert(x) +#endif #include "Bridge.h" #include "../common/thread.h" @@ -50,7 +54,9 @@ WNDCLASSEX PluginBridge::windowClass; #define WINDOWCLASSNAME _T("OpenMPTPluginBridge") +enum { kVstTimeInfoInit = 1 << 31 }; + int _tmain(int argc, TCHAR *argv[]) { if(argc != 2) @@ -348,8 +354,9 @@ msg->result = 0; msg->str[CountOf(msg->str) - 1] = 0; - // TODO DEBUG - //SetConsoleTitleW(msg->str); +#ifdef _CONSOLE + SetConsoleTitleW(msg->str); +#endif nativeEffect = nullptr; library = LoadLibraryW(msg->str); @@ -398,6 +405,9 @@ msg->result = 1; UpdateEffectStruct(); + // Set a custom time info flag that will differ from any other flags on the first audioMasterGetTime call. + // This fixes plugins like KarmaFX EQ that don't send any flags (only query sample frequency). + sharedMem->timeInfo.flags = kVstTimeInfoInit; // Init process buffer DispatchToHost(audioMasterVendorSpecific, kVendorOpenMPT, kUpdateProcessingBuffer, nullptr, 0.0f); @@ -695,6 +705,8 @@ // Audio rendering thread void PluginBridge::RenderThread() { + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); + const HANDLE objects[] = { sigProcess.send, sigThreadExit }; DWORD result = 0; do @@ -811,7 +823,7 @@ offset += msg->sampleFrames; } inPointers = reinterpret_cast<buf_t **>(&samplePointers[0]); - outPointers = reinterpret_cast<buf_t **>(&samplePointers[msg->numInputs]); + outPointers = inPointers + msg->numInputs; } return msg->sampleFrames; @@ -842,7 +854,7 @@ { // During processing, read the cached time info if possible. // Only check validity flags. OpenMPT ignores the other flags anyway, as they are host-to-plugin flags. - value &= (kVstNanosValid | kVstPpqPosValid | kVstTempoValid | kVstBarsValid | kVstCyclePosValid | kVstTimeSigValid | kVstSmpteValid | kVstClockValid); + value &= (kVstNanosValid | kVstPpqPosValid | kVstTempoValid | kVstBarsValid | kVstCyclePosValid | kVstTimeSigValid | kVstSmpteValid | kVstClockValid | kVstTimeInfoInit); if((sharedMem->timeInfo.flags & value) == value) { return ToVstPtr<VstTimeInfo>(&sharedMem->timeInfo); Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2014-04-13 15:19:18 UTC (rev 4011) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2014-04-14 14:15:39 UTC (rev 4012) @@ -1487,17 +1487,17 @@ } -// returns 12*128*(log2(freq/8363)+midiftune/100) +// returns 12*128*log2(freq/8363)+midiftune*(128/100) static int DlsFreqToTranspose(uint32 freq, int nMidiFTune) //-------------------------------------------------------- { + if (!freq) return 0; #ifdef ENABLE_X86 const float _f1_8363 = 1.0f / 8363.0f; const float _factor = 128 * 12; const float _fct_100 = 128.0f / 100.0f; int result; - if (!freq) return 0; _asm { fild nMidiFTune fld _fct_100 @@ -1512,7 +1512,7 @@ } return result; #else - return Util::Round<int>((12 * 128) * log(freq * (1.0f / 8363.0f) + nMidiFTune * (1.0f / 100.0f))); + return Util::Round<int>((12 * 128) * log(freq * (1.0f / 8363.0f)) / log(2.0f) + nMidiFTune * (128.0f / 100.0f)); #endif // ENABLE_X86 } @@ -1631,8 +1631,8 @@ int nBaseTune = DlsFreqToTranspose( sample.nC5Speed, sFineTune+(60 + transpose - usUnityNote)*100); - sample.nFineTune = (int8)(nBaseTune & 0x7F); - sample.RelativeTone = (int8)(nBaseTune >> 7); + sample.nFineTune = static_cast<int8>(nBaseTune & 0x7F); + sample.RelativeTone = mpt::saturate_cast<int8>(nBaseTune >> 7); sample.TransposeToFrequency(); if (lVolume > 256) lVolume = 256; if (lVolume < 16) lVolume = 16; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |