From: <rel...@us...> - 2008-04-05 20:56:24
|
Revision: 209 http://modplug.svn.sourceforge.net/modplug/?rev=209&view=rev Author: relabsoluness Date: 2008-04-05 13:56:19 -0700 (Sat, 05 Apr 2008) Log Message: ----------- . Fix to faulty plug file existence check (http://lpchip.com/modplug/viewtopic.php?t=2255) . Sound card-options buffer length value validation. . In .51, muted channels were ignored completely in MIDI export. Now pattern effects are processed in muted channels. . IT style-playback fix Modified Paths: -------------- trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/misc_util.cpp trunk/OpenMPT/mptrack/misc_util.h trunk/OpenMPT/mptrack/mod2midi.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2008-03-29 16:08:03 UTC (rev 208) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2008-04-05 20:56:19 UTC (rev 209) @@ -329,8 +329,16 @@ CHAR s[32]; m_CbnBufferLength.GetWindowText(s, sizeof(s)); m_nBufferLength = atoi(s); - //if ((m_nBufferLength < 10) || (m_nBufferLength > 200)) m_nBufferLength = 100; - if ((m_nBufferLength < SNDDEV_MINBUFFERLEN) || (m_nBufferLength > SNDDEV_MAXBUFFERLEN)) m_nBufferLength = 100; + //Check given value. + if(m_nBufferLength < SNDDEV_MINBUFFERLEN) + m_nBufferLength = SNDDEV_MINBUFFERLEN; + else + { + if(m_nBufferLength > SNDDEV_MAXBUFFERLEN) + m_nBufferLength = SNDDEV_MAXBUFFERLEN; + } + wsprintf(s, "%d ms", m_nBufferLength); + m_CbnBufferLength.SetWindowText(s); } // Soft Panning if (m_dwSoundSetup & SOUNDSETUP_SOFTPANNING) Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2008-03-29 16:08:03 UTC (rev 208) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2008-04-05 20:56:19 UTC (rev 209) @@ -1,6 +1,7 @@ #include "stdafx.h" #include <uuids.h> #include <dmoreg.h> +#include <shlwapi.h> #include <medparam.h> #include "mptrack.h" #include "mainfrm.h" @@ -162,7 +163,7 @@ PVSTPLUGINLIB CVstPluginManager::AddPlugin(LPCSTR pszDllPath, BOOL bCache, const bool checkFileExistence, CString* const errStr) //----------------------------------------------------------------------------------------------------------- { - if(checkFileExistence && !DoesFileExist(pszDllPath)) + if(checkFileExistence && (PathFileExists(pszDllPath) == FALSE)) { if(errStr) { Modified: trunk/OpenMPT/mptrack/misc_util.cpp =================================================================== --- trunk/OpenMPT/mptrack/misc_util.cpp 2008-03-29 16:08:03 UTC (rev 208) +++ trunk/OpenMPT/mptrack/misc_util.cpp 2008-04-05 20:56:19 UTC (rev 209) @@ -1,17 +1,3 @@ #include "stdafx.h" #include "misc_util.h" -bool DoesFileExist(const char* const filepath) -//-------------------------------------------- -{ - char path_buffer[_MAX_PATH]; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; - char ext[_MAX_EXT]; - - LPTSTR* p = 0; - _splitpath(filepath, drive, dir, fname, ext); - _makepath(path_buffer, drive, dir, NULL, NULL); - return (SearchPath(path_buffer, fname, ext, 0, 0, p) != 0); -} Modified: trunk/OpenMPT/mptrack/misc_util.h =================================================================== --- trunk/OpenMPT/mptrack/misc_util.h 2008-03-29 16:08:03 UTC (rev 208) +++ trunk/OpenMPT/mptrack/misc_util.h 2008-04-05 20:56:19 UTC (rev 209) @@ -35,8 +35,5 @@ */ } -//Return true if file with given path is found. -bool DoesFileExist(const char* const filepath); - #endif Modified: trunk/OpenMPT/mptrack/mod2midi.cpp =================================================================== --- trunk/OpenMPT/mptrack/mod2midi.cpp 2008-03-29 16:08:03 UTC (rev 208) +++ trunk/OpenMPT/mptrack/mod2midi.cpp 2008-04-05 20:56:19 UTC (rev 209) @@ -432,72 +432,73 @@ } for (UINT nChn=0; nChn<chnCount; nChn++) { - //Skip muted channels. - if(m_pSndFile->ChnSettings[nChn].dwFlags & CHN_MUTE) continue; - PDYNMIDITRACK pTrk = &Tracks[nChn]; MODCOMMAND *m = m_pSndFile->Patterns[nPat].GetpModCommand(nRow, nChn); UINT delta_time = nClock - pTrk->nLastEventClock; UINT len = 0; - // Instrument change - if ((m->instr) && (m->instr != pTrk->nInstrument) && (m->instr < MAX_SAMPLES)) + //Process note data only in non-muted channels. + if((m_pSndFile->ChnSettings[nChn].dwFlags & CHN_MUTE) == 0) { - UINT nIns = m->instr; - UINT nMidiCh = m_InstrMap[nIns].nChannel; - UINT nProgram = m_InstrMap[nIns].nProgram; - if ((nMidiCh) && (nMidiCh <= 16)) nMidiCh--; - else nMidiCh = nChn&7; - pTrk->nMidiChannel = nMidiCh; - pTrk->nMidiProgram = nProgram; - pTrk->nInstrument = nIns; - if ((nMidiCh != 9) && (nProgram != nMidiChCurPrg[nMidiCh])) + // Instrument change + if ((m->instr) && (m->instr != pTrk->nInstrument) && (m->instr < MAX_SAMPLES)) { - tmp[len] = 0xC0|nMidiCh; - tmp[len+1] = nProgram; - tmp[len+2] = 0; - len += 3; - } - } - // Note change - if (m->note) - { - UINT note = m->note - 1; - for (UINT i=0; i<128; i++) - { - if (pTrk->NoteOn[i]) + UINT nIns = m->instr; + UINT nMidiCh = m_InstrMap[nIns].nChannel; + UINT nProgram = m_InstrMap[nIns].nProgram; + if ((nMidiCh) && (nMidiCh <= 16)) nMidiCh--; + else nMidiCh = nChn&7; + pTrk->nMidiChannel = nMidiCh; + pTrk->nMidiProgram = nProgram; + pTrk->nInstrument = nIns; + if ((nMidiCh != 9) && (nProgram != nMidiChCurPrg[nMidiCh])) { - tmp[len] = 0x90|(pTrk->NoteOn[i]-1); - tmp[len+1] = i; + tmp[len] = 0xC0|nMidiCh; + tmp[len+1] = nProgram; tmp[len+2] = 0; - tmp[len+3] = 0; - len += 4; - pTrk->NoteOn[i] = 0; + len += 3; } } - if (m->note <= 120) + // Note change + if (m->note) { - pTrk->NoteOn[note] = pTrk->nMidiChannel+1; - tmp[len] = 0x90|pTrk->nMidiChannel; - tmp[len+1] = (pTrk->nMidiChannel==9) ? pTrk->nMidiProgram : note; - UINT vol = 0x7f; - UINT nsmp = pTrk->nInstrument; - if (m_pSndFile->m_nInstruments) + UINT note = m->note - 1; + for (UINT i=0; i<128; i++) { - if ((nsmp < MAX_INSTRUMENTS) && (m_pSndFile->Headers[nsmp])) + if (pTrk->NoteOn[i]) { - INSTRUMENTHEADER *penv = m_pSndFile->Headers[nsmp]; - nsmp = penv->Keyboard[note]; - } else nsmp = 0; + tmp[len] = 0x90|(pTrk->NoteOn[i]-1); + tmp[len+1] = i; + tmp[len+2] = 0; + tmp[len+3] = 0; + len += 4; + pTrk->NoteOn[i] = 0; + } } - if ((nsmp) && (nsmp < MAX_SAMPLES)) vol = m_pSndFile->Ins[nsmp].nVolume; - if (m->volcmd == VOLCMD_VOLUME) vol = m->vol*4; - if (m->command == CMD_VOLUME) vol = m->param*4; - vol = LinearToDLSMidiVolume(vol<<8); - if (vol > 0x7f) vol = 0x7f; - tmp[len+2] = (BYTE)vol; - tmp[len+3] = 0; - len += 4; + if (m->note <= 120) + { + pTrk->NoteOn[note] = pTrk->nMidiChannel+1; + tmp[len] = 0x90|pTrk->nMidiChannel; + tmp[len+1] = (pTrk->nMidiChannel==9) ? pTrk->nMidiProgram : note; + UINT vol = 0x7f; + UINT nsmp = pTrk->nInstrument; + if (m_pSndFile->m_nInstruments) + { + if ((nsmp < MAX_INSTRUMENTS) && (m_pSndFile->Headers[nsmp])) + { + INSTRUMENTHEADER *penv = m_pSndFile->Headers[nsmp]; + nsmp = penv->Keyboard[note]; + } else nsmp = 0; + } + if ((nsmp) && (nsmp < MAX_SAMPLES)) vol = m_pSndFile->Ins[nsmp].nVolume; + if (m->volcmd == VOLCMD_VOLUME) vol = m->vol*4; + if (m->command == CMD_VOLUME) vol = m->param*4; + vol = LinearToDLSMidiVolume(vol<<8); + if (vol > 0x7f) vol = 0x7f; + tmp[len+2] = (BYTE)vol; + tmp[len+3] = 0; + len += 4; + } } } // Effects Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2008-03-29 16:08:03 UTC (rev 208) +++ trunk/OpenMPT/mptrack/mptrack.rc 2008-04-05 20:56:19 UTC (rev 209) @@ -1946,7 +1946,7 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,17,2,51 + FILEVERSION 1,17,2,52 PRODUCTVERSION 0,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG @@ -1964,7 +1964,7 @@ BEGIN VALUE "CompanyName", "Olivier Lapicque / OpenMPT team" VALUE "FileDescription", "OpenMPT / ModPlug Tracker" - VALUE "FileVersion", "1, 17, 2, 51" + VALUE "FileVersion", "1, 17, 2, 52" VALUE "InternalName", "Modplug Tracker" VALUE "LegalCopyright", "Copyright \xA91997-2003 Olivier Lapicque; \xA92004-2007 GPL." VALUE "LegalTrademarks", "M.O.D.P.L.U.G" Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2008-03-29 16:08:03 UTC (rev 208) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2008-04-05 20:56:19 UTC (rev 209) @@ -615,12 +615,13 @@ pChn->dwFlags |= (CHN_NOTEFADE|CHN_FASTVOLRAMP); if ((!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) || (m_nInstruments)) pChn->nVolume = 0; pChn->nFadeOutVol = 0; + } - //IT compatibility tentative fix: Clear channel note memory on note cut. - if(TypeIsIT_MPT() && GetModFlag(MSF_IT_COMPATIBLE_PLAY)) - { - pChn->nNote = pChn->nNewNote = 0; - } + //IT compatibility tentative fix: Clear channel note memory. + if(TypeIsIT_MPT() && GetModFlag(MSF_IT_COMPATIBLE_PLAY)) + { + pChn->nNote = 0; + pChn->nNewNote = 0; } return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |