From: <sag...@us...> - 2012-12-15 15:25:43
|
Revision: 1461 http://sourceforge.net/p/modplug/code/1461 Author: saga-games Date: 2012-12-15 15:25:36 +0000 (Sat, 15 Dec 2012) Log Message: ----------- [Fix] Order list: Non-existing patterns above the highest existing pattern are not displayed as "???" anymore. [Imp] Pattern Editor: When using quantize together with pattern looping, quantized notes are not quantized to the follow-up pattern anymore but rather the first row of the current pattern. [Ref] Small changes. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/soundlib/Load_mid.cpp trunk/OpenMPT/soundlib/Load_psm.cpp trunk/OpenMPT/soundlib/Load_wav.cpp trunk/OpenMPT/soundlib/SampleIO.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-12-14 10:13:33 UTC (rev 1460) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2012-12-15 15:25:36 UTC (rev 1461) @@ -867,9 +867,9 @@ s[0] = '\0'; if(nIndex < maxEntries && (rect.left + m_cxFont - 4) <= rcClient.right) { - if (nPat == pSndFile->Order.GetInvalidPatIndex()) strcpy(s, "---"); - else if (nPat == pSndFile->Order.GetIgnoreIndex()) strcpy(s, "+++"); - else if (nPat < pSndFile->Patterns.Size()) wsprintf(s, "%u", nPat); + if(nPat == pSndFile->Order.GetInvalidPatIndex()) strcpy(s, "---"); + else if(nPat == pSndFile->Order.GetIgnoreIndex()) strcpy(s, "+++"); + else if(nPat < Util::Max(pSndFile->Patterns.Size(), pSndFile->GetModSpecifications().patternsMax)) wsprintf(s, "%u", nPat); else strcpy(s, "???"); } @@ -1257,7 +1257,7 @@ { CSoundFile *pSndFile = m_pModDoc->GetSoundFile(); - const OrdSelection selection = GetCurSel(false); + const OrdSelection selection = GetCurSel(false); const ORDERINDEX nInsertCount = selection.lastOrd - selection.firstOrd, nInsertEnd = selection.lastOrd; for(ORDERINDEX i = 0; i <= nInsertCount; i++) Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2012-12-14 10:13:33 UTC (rev 1460) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2012-12-15 15:25:36 UTC (rev 1461) @@ -5489,7 +5489,7 @@ if(!sndFile->Patterns[pat].IsValidRow(row)) { // Quantization exceeds current pattern, try stuffing note into next pattern instead. - PATTERNINDEX nextPat = GetNextPattern(); + PATTERNINDEX nextPat = sndFile->m_SongFlags[SONG_PATTERNLOOP] ? m_nPattern : GetNextPattern(); if(nextPat != PATTERNINDEX_INVALID) { pat = nextPat; Modified: trunk/OpenMPT/soundlib/Load_mid.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mid.cpp 2012-12-14 10:13:33 UTC (rev 1460) +++ trunk/OpenMPT/soundlib/Load_mid.cpp 2012-12-15 15:25:36 UTC (rev 1461) @@ -482,15 +482,15 @@ #ifdef MODPLUG_TRACKER int importSpeed = CMainFrame::GetSettings().midiImportSpeed; - int importPatternLen = CMainFrame::GetSettings().midiImportPatternLen; + ROWINDEX importPatternLen = CMainFrame::GetSettings().midiImportPatternLen; #else int importSpeed = 3; - int importPatternLen = 128; + ROWINDEX importPatternLen = 128; #endif // MODPLUG_TRACKER // Fix import parameters Limit(importSpeed, 2, 6); - Limit(importPatternLen, 64, 256); + Limit(importPatternLen, ROWINDEX(1), MAX_PATTERN_ROWS); // Detect RMI files if ((dwMemLength > 12) Modified: trunk/OpenMPT/soundlib/Load_psm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_psm.cpp 2012-12-14 10:13:33 UTC (rev 1460) +++ trunk/OpenMPT/soundlib/Load_psm.cpp 2012-12-15 15:25:36 UTC (rev 1461) @@ -1230,7 +1230,7 @@ { // volume present m.volcmd = VOLCMD_VOLUME; - m.vol = patternChunk.ReadUint8(); + m.vol = Util::Min(patternChunk.ReadUint8(), uint8(64)); } if(chnFlag & effectFlag) { Modified: trunk/OpenMPT/soundlib/Load_wav.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_wav.cpp 2012-12-14 10:13:33 UTC (rev 1460) +++ trunk/OpenMPT/soundlib/Load_wav.cpp 2012-12-15 15:25:36 UTC (rev 1461) @@ -115,6 +115,7 @@ sample.uFlags = CHN_PANNING; sample.nLength = sampleLength; sample.nC5Speed = wavFile.GetSampleRate(); + strcpy(m_szNames[channel + 1], ""); wavFile.ApplySampleSettings(sample, m_szNames[channel + 1]); if(wavFile.GetNumChannels() > 1) Modified: trunk/OpenMPT/soundlib/SampleIO.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleIO.cpp 2012-12-14 10:13:33 UTC (rev 1460) +++ trunk/OpenMPT/soundlib/SampleIO.cpp 2012-12-15 15:25:36 UTC (rev 1461) @@ -395,9 +395,9 @@ size_t SampleIO::WriteSample(FILE *f, const ModSample &sample, SmpLength maxSamples) const //---------------------------------------------------------------------------------------- { - UINT len = 0, bufcount; + size_t len = 0, bufcount = 0; char buffer[32768]; - signed char *pSample = (signed char *)sample.pSample; + int8 *pSample = (int8 *)sample.pSample; SmpLength numSamples = sample.nLength; if(maxSamples && numSamples > maxSamples) numSamples = maxSamples; @@ -406,22 +406,22 @@ if(GetBitDepth() == 16 && GetChannelFormat() == mono && GetEndianness() == littleEndian && (GetEncoding() == signedPCM || GetEncoding() == unsignedPCM || GetEncoding() == deltaPCM)) { - // 16-bit samples + // 16-bit mono samples int16 *p = (int16 *)pSample; int s_old = 0, s_ofs; len = numSamples * 2; - bufcount = 0; s_ofs = (GetEncoding() == unsignedPCM) ? 0x8000 : 0; - for (UINT j=0; j<numSamples; j++) + for(SmpLength j = 0; j < numSamples; j++) { int s_new = *p; p++; - if (sample.uFlags & CHN_STEREO) + if(sample.uFlags[CHN_STEREO]) { + // Downmix stereo s_new = (s_new + (*p) + 1) >> 1; p++; } - if (GetEncoding() == deltaPCM) + if(GetEncoding() == deltaPCM) { *((int16 *)(&buffer[bufcount])) = (int16)(s_new - s_old); s_old = s_new; @@ -430,7 +430,7 @@ *((int16 *)(&buffer[bufcount])) = (int16)(s_new + s_ofs); } bufcount += 2; - if (bufcount >= sizeof(buffer) - 1) + if(bufcount >= sizeof(buffer) - 1) { if(f) fwrite(buffer, 1, bufcount, f); bufcount = 0; @@ -516,9 +516,8 @@ else if(GetBitDepth() == 8 && GetChannelFormat() == stereoInterleaved && GetEncoding() == unsignedPCM) { - // Stereo unsigned interleaved + // Stereo unsigned interleaved len = numSamples * 2; - bufcount = 0; for (UINT j=0; j<len; j++) { *((uint8 *)(&buffer[bufcount])) = *((uint8 *)(&pSample[j])) + 0x80; @@ -536,7 +535,6 @@ else { len = numSamples; - bufcount = 0; int8 *p = (int8 *)pSample; int sinc = (sample.uFlags & CHN_16BIT) ? 2 : 1; int s_old = 0, s_ofs = (GetEncoding() == unsignedPCM) ? 0x80 : 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |