From: <rel...@us...> - 2008-12-11 19:53:08
|
Revision: 238 http://modplug.svn.sourceforge.net/modplug/?rev=238&view=rev Author: relabsoluness Date: 2008-12-11 19:53:02 +0000 (Thu, 11 Dec 2008) Log Message: ----------- / Changed default instrument plug volume command handling from Dry/Wet to none. Also added ini-setting with which one can set the default value used for new instruments. / Added notifications when trying to load unsupported number of patterns or sequence items in mptm. . Tuning collection didn't get marked modified when a tuning was moved to it. . Loading certain old tuning objects didn't work. / Sample tab: Increased possible size of time stretched sample because it may longer than what stretch ratio would suggest. / Sample tab: Time stretch parameter edit is now visible. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/OrderToPatternTable.cpp trunk/OpenMPT/mptrack/TuningDialog.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/tuning.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2008-12-11 01:33:04 UTC (rev 237) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2008-12-11 19:53:02 UTC (rev 238) @@ -1482,11 +1482,11 @@ GetDlgItem(IDC_COMBO6)->ShowWindow(SW_HIDE); GetDlgItem(IDC_TEXT_PITCH)->ShowWindow(SW_HIDE); GetDlgItem(IDC_COMBO4)->ShowWindow(SW_HIDE); - if(CMainFrame::gbShowHackControls == true) - { + //if(CMainFrame::gbShowHackControls == true) + //{ GetDlgItem(IDC_TEXT_STRETCHPARAMS)->ShowWindow(SW_SHOW); GetDlgItem(IDC_EDIT_STRETCHPARAMS)->ShowWindow(SW_SHOW); - } + //} SetDlgItemText(IDC_BUTTON1, "Time Stretch"); UpdateTimeStretchParameterString(); } @@ -1768,8 +1768,10 @@ const BYTE smpsize = pins->GetElementarySampleSize(); const UINT nChn = pins->GetNumChannels(); - // Allocate new sample - const DWORD nNewSampleLength = (DWORD)(0.5 + ratio * (double)pins->nLength); + // Allocate new sample. Returned sample may not be exactly the size what ratio would suggest + // so allocate a bit more(1.03*). + const DWORD nNewSampleLength = (DWORD)(1.03 * ratio * (double)pins->nLength); + //const DWORD nNewSampleLength = (DWORD)(0.5 + ratio * (double)pins->nLength); PVOID pSample = pins->pSample; PVOID pNewSample = CSoundFile::AllocateSample(nNewSampleLength * nChn * smpsize); if(pNewSample == NULL) @@ -1851,7 +1853,7 @@ while(pos < pins->nLength) { // Current chunk size limit test - if(pos + len >= pins->nLength) len = pins->nLength - pos; + if(len >= pins->nLength - pos) len = pins->nLength - pos; // Show progress bar using process button painting & text label CHAR progress[16]; Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2008-12-11 01:33:04 UTC (rev 237) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2008-12-11 19:53:02 UTC (rev 238) @@ -430,6 +430,8 @@ gnAutoChordWaitTime = GetPrivateProfileDWord("Pattern Editor", "AutoChordWaitTime", 60, iniFile); COrderList::s_nDefaultMargins = static_cast<BYTE>(GetPrivateProfileInt("Pattern Editor", "DefaultSequenceMargins", 2, iniFile)); gbShowHackControls = (0 != GetPrivateProfileDWord("Misc", "ShowHackControls", 0, iniFile)); + CSoundFile::s_DefaultPlugVolumeHandling = static_cast<uint8>(GetPrivateProfileInt("Misc", "DefaultPlugVolumeHandling", PLUGIN_VOLUMEHANDLING_IGNORE, iniFile)); + if(CSoundFile::s_DefaultPlugVolumeHandling > 2) CSoundFile::s_DefaultPlugVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE; GetPrivateProfileString("Paths", "Songs_Directory", m_szModDir, m_szModDir, INIBUFFERSIZE, iniFile); GetPrivateProfileString("Paths", "Samples_Directory", m_szSmpDir, m_szSmpDir, INIBUFFERSIZE, iniFile); Modified: trunk/OpenMPT/mptrack/OrderToPatternTable.cpp =================================================================== --- trunk/OpenMPT/mptrack/OrderToPatternTable.cpp 2008-12-11 01:33:04 UTC (rev 237) +++ trunk/OpenMPT/mptrack/OrderToPatternTable.cpp 2008-12-11 19:53:02 UTC (rev 238) @@ -2,6 +2,8 @@ #include "sndfile.h" #include "ordertopatterntable.h" +#define str_SequenceTruncationNote (GetStrI18N((_TEXT("Module has sequence of length %u; it will be truncated to maximum supported length, %u.")))) + DWORD COrderToPatternTable::Unserialize(const BYTE* const src, const DWORD memLength) //------------------------------------------------------------------------- { @@ -17,6 +19,10 @@ if(s > 65000) return true; if(memLength < memPos+s*4) return memPos; + const uint32 nOriginalSize = s; + if(s > MPTM_SPECS.ordersMax) + s = MPTM_SPECS.ordersMax; + resize(s); for(size_t i = 0; i<s; i++, memPos +=4 ) { @@ -24,6 +30,7 @@ memcpy(&temp, src+memPos, 4); (*this)[i] = static_cast<PATTERNINDEX>(temp); } + memPos += 4*(nOriginalSize - s); return memPos; } @@ -186,7 +193,13 @@ { uint16 size; istrm.read(reinterpret_cast<char*>(&size), 2); - if(size > MPTM_SPECS.ordersMax) size = MPTM_SPECS.ordersMax; + if(size > MPTM_SPECS.ordersMax) + { + // Hack: Show message here if trying to load longer sequence than what is supported. + CString str; str.Format(str_SequenceTruncationNote, size, MPTM_SPECS.ordersMax); + ::MessageBox(0, str, "", MB_ICONWARNING); + size = MPTM_SPECS.ordersMax; + } m_rOrders.resize(size); if(size == 0) {m_rOrders.assign(MAX_ORDERS, m_rOrders.GetInvalidPatIndex()); return;} Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.cpp 2008-12-11 01:33:04 UTC (rev 237) +++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2008-12-11 19:53:02 UTC (rev 238) @@ -1187,6 +1187,7 @@ HTREEITEM treeItemDestTC = m_TreeItemTuningItemMap.GetMapping_21(TUNINGTREEITEM(pTCdest)); DeleteTreeItem(pT); m_ModifiedTCs[pTCsrc] = true; + m_ModifiedTCs[pTCdest] = true; if(CTuningCollection::TransferTuning(pTCsrc, pTCdest, pT)) { MsgBox(IDS_OPERATION_FAIL, this, NULL, MB_OK); Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2008-12-11 01:33:04 UTC (rev 237) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2008-12-11 19:53:02 UTC (rev 238) @@ -33,6 +33,8 @@ #define str_MBtitle (GetStrI18N((_TEXT("Saving IT")))) #define str_tooMuchPatternData (GetStrI18N((_TEXT("Warning: File format limit was reached. Some pattern data may not get written to file.")))) #define str_pattern (GetStrI18N((_TEXT("pattern")))) +#define str_PatternSetTruncationNote (GetStrI18N((_TEXT("The module contains %u patterns but only %u patterns can be loaded in this OpenMPT version.")))) +#define str_SequenceTruncationNote (GetStrI18N((_TEXT("Module has sequence of length %u; it will be truncated to maximum supported length, %u.")))) static bool AreNonDefaultTuningsUsed(CSoundFile& sf) //-------------------------------------------------- @@ -1025,7 +1027,13 @@ } else { - if(nordsize > GetModSpecifications().ordersMax) nordsize = GetModSpecifications().ordersMax; + if(nordsize > GetModSpecifications().ordersMax) + { + CString str; + str.Format(str_SequenceTruncationNote, nordsize, GetModSpecifications().ordersMax); + CMainFrame::GetMainFrame()->MessageBox(str, 0, MB_ICONWARNING); + nordsize = GetModSpecifications().ordersMax; + } if(pifh->cwtv > 0x88A && pifh->cwtv <= 0x88D) dwMemPos += Order.Unserialize(lpStream+dwMemPos, dwMemLength-dwMemPos); @@ -1055,7 +1063,14 @@ dwMemPos += pifh->smpnum * 4; // Reading Patterns Offsets UINT patpossize = pifh->patnum; - if(patpossize > GetModSpecifications().patternsMax) patpossize = GetModSpecifications().patternsMax; + if(patpossize > GetModSpecifications().patternsMax) + { + // Hack: Note user here if file contains more patterns than what can be read. + CString str; + str.Format(str_PatternSetTruncationNote, patpossize, GetModSpecifications().patternsMax); + CMainFrame::GetMainFrame()->MessageBox(str, 0, MB_ICONWARNING); + patpossize = GetModSpecifications().patternsMax; + } patpos.resize(patpossize); patpossize *= 4; // <-> patpossize *= sizeof(DWORD); Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2008-12-11 01:33:04 UTC (rev 237) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2008-12-11 19:53:02 UTC (rev 238) @@ -387,6 +387,7 @@ CTuningCollection* CSoundFile::s_pTuningsSharedStandard(0); CTuningCollection* CSoundFile::s_pTuningsSharedLocal(0); +uint8 CSoundFile::s_DefaultPlugVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE; CSoundFile::CSoundFile() : @@ -2757,7 +2758,7 @@ m_defaultInstrument.wPitchToTempoLock = 0; m_defaultInstrument.pTuning = m_defaultInstrument.s_DefaultTuning; m_defaultInstrument.nPluginVelocityHandling = PLUGIN_VELOCITYHANDLING_CHANNEL; - m_defaultInstrument.nPluginVolumeHandling = PLUGIN_VOLUMEHANDLING_DRYWET; + m_defaultInstrument.nPluginVolumeHandling = CSoundFile::s_DefaultPlugVolumeHandling; } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2008-12-11 01:33:04 UTC (rev 237) +++ trunk/OpenMPT/soundlib/Sndfile.h 2008-12-11 19:53:02 UTC (rev 238) @@ -907,6 +907,7 @@ static UINT gnAGC, gnVolumeRampSamples, gnCPUUsage; static LPSNDMIXHOOKPROC gpSndMixHook; static PMIXPLUGINCREATEPROC gpMixPluginCreateProc; + static uint8 s_DefaultPlugVolumeHandling; Modified: trunk/OpenMPT/soundlib/tuning.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuning.cpp 2008-12-11 01:33:04 UTC (rev 237) +++ trunk/OpenMPT/soundlib/tuning.cpp 2008-12-11 19:53:02 UTC (rev 238) @@ -490,7 +490,7 @@ //m_GroupRatio inStrm.read(reinterpret_cast<char*>(&pT->m_GroupRatio), sizeof(pT->m_GroupRatio)); - if(pT->m_GroupRatio <= 0) + if(pT->m_GroupRatio < 0) { delete pT; return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |