From: <man...@us...> - 2014-03-03 17:47:07
|
Revision: 3815 http://sourceforge.net/p/modplug/code/3815 Author: manxorist Date: 2014-03-03 17:47:01 +0000 (Mon, 03 Mar 2014) Log Message: ----------- [Fix] Fix typo in panning command handling. [Ref] Silence signed/unsigned comparison warnings. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-03-03 16:46:26 UTC (rev 3814) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-03-03 17:47:01 UTC (rev 3815) @@ -494,7 +494,7 @@ if (!(GetType() & GLOBALVOL_7BIT_FORMATS)) param <<= 1; memory.state.m_nGlobalVolume -= param * (memory.state.m_nMusicSpeed - 1); } - memory.state.m_nGlobalVolume = CLAMP(memory.state.m_nGlobalVolume, 0, 256); + memory.state.m_nGlobalVolume = Clamp(memory.state.m_nGlobalVolume, 0u, 256u); break; case CMD_CHANNELVOLUME: if (param <= 64) pChn->nGlobalVol = param; @@ -507,7 +507,7 @@ } else if (((param & 0xF0) == 0xF0) && (param & 0x0F)) { - if (pChn->nGlobalVol > (UINT)(param & 0x0F)) param = pChn->nGlobalVol - (param & 0x0F); + if (pChn->nGlobalVol > (param & 0x0F)) param = pChn->nGlobalVol - (param & 0x0F); else param = 0; } else if (param & 0x0F) @@ -608,7 +608,7 @@ if(p->command == CMD_PANNING8) { Panning(pChn, p->param); - } else if((p->command == CMD_MODCMDEX) || (p->command == CMD_S3MCMDEX) && (p->param & 0xF0) == 0x80) + } else if(((p->command == CMD_MODCMDEX) || (p->command == CMD_S3MCMDEX)) && (p->param & 0xF0) == 0x80) { Panning(pChn, ((p->param & 0x0F) * 256 + 8) / 15); } else if(p->command == VOLCMD_PANNING) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-03-04 16:20:28
|
Revision: 3825 http://sourceforge.net/p/modplug/code/3825 Author: saga-games Date: 2014-03-04 16:20:21 +0000 (Tue, 04 Mar 2014) Log Message: ----------- [Fix] More adjustments to sample seeking (optimize out some channels, fix pitch envelopes, ...) Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-03-04 16:04:17 UTC (rev 3824) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-03-04 16:20:21 UTC (rev 3825) @@ -115,6 +115,7 @@ // Are we trying to reach a certain pattern position? const bool hasSearchTarget = target.mode != GetLengthTarget::NoTarget; + const bool adjustSamplePos = (adjustMode & eAdjustSamplePositions) == eAdjustSamplePositions; ROWINDEX nRow = 0, nNextRow = 0; ROWINDEX nNextPatStartRow = 0; // FT2 E60 bug @@ -124,6 +125,33 @@ // Temporary visited rows vector (so that GetLength() won't interfere with the player code if the module is playing at the same time) RowVisitor visitedRows(*this); + // Optimize away channels for which it's pointless to adjust sample positions + std::vector<bool> adjustSampleChn(GetNumChannels(), true); + if(adjustSamplePos && target.mode == GetLengthTarget::SeekPosition) + { + PATTERNINDEX seekPat = PATTERNINDEX_INVALID; + if(target.pos.order < Order.GetLength()) seekPat = Order[target.pos.order]; + if(!Patterns.IsValidPat(seekPat) || !Patterns[seekPat].IsValidRow(target.pos.row)) seekPat = PATTERNINDEX_INVALID; + + for(CHANNELINDEX i = 0; i < GetNumChannels(); i++) + { + if(ChnSettings[i].dwFlags[CHN_MUTE]) + { + adjustSampleChn[i] = false; + continue; + } + if(seekPat != PATTERNINDEX_INVALID) + { + ModCommand &m = *Patterns[seekPat].GetpModCommand(target.pos.row, i); + if(m.note == NOTE_NOTECUT || m.note == NOTE_KEYOFF || (m.note == NOTE_FADE && GetNumInstruments()) + || (m.IsNote() && m.command != CMD_TONEPORTAMENTO && m.command != CMD_TONEPORTAVOL && m.volcmd != VOLCMD_TONEPORTAMENTO)) + { + adjustSampleChn[i] = false; + } + } + } + } + for (;;) { uint32 rowDelay = 0, tickDelay = 0; @@ -547,28 +575,28 @@ memory.elapsedTime += static_cast<double>(rowDuration) / static_cast<double>(m_MixerSettings.gdwMixingFreq); memory.state.m_lTotalSampleCount += rowDuration; - if((adjustMode & eAdjustSamplePositions) == eAdjustSamplePositions) + if(adjustSamplePos) { - const ModCommand::COMMAND forbiddenCommands[] = { CMD_PORTAMENTOUP, CMD_PORTAMENTODOWN, CMD_VOLUMESLIDE, CMD_VIBRATOVOL, CMD_TONEPORTAVOL, CMD_XFINEPORTAUPDOWN }; + // Super experimental and dirty sample seeking + const ModCommand::COMMAND forbiddenCommands[] = { CMD_PORTAMENTOUP, CMD_PORTAMENTODOWN, CMD_VOLUMESLIDE, CMD_VIBRATOVOL, CMD_TONEPORTAVOL, CMD_XFINEPORTAUPDOWN, CMD_NOTESLIDEUP, CMD_NOTESLIDEUPRETRIG, CMD_NOTESLIDEDOWN, CMD_NOTESLIDEDOWNRETRIG }; const ModCommand::VOLCMD forbiddenVolCommands[] = { VOLCMD_PORTAUP, VOLCMD_PORTADOWN, VOLCMD_TONEPORTAMENTO, VOLCMD_VOLSLIDEUP, VOLCMD_VOLSLIDEDOWN, VOLCMD_FINEVOLUP, VOLCMD_FINEVOLDOWN }; - // Super experimental and dirty sample seeking pChn = memory.state.Chn; p = Patterns[nPattern].GetRow(nRow); for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, pChn++, nChn++) { - if(ChnSettings[nChn].dwFlags[CHN_MUTE]) + if(!adjustSampleChn[nChn]) continue; uint32 startTick = 0; uint32 paramHi = p->param >> 4, paramLo = p->param & 0x0F; - bool porta = p->command == CMD_TONEPORTAMENTO; // Volume column tone portamento can be crazy, and CMD_TONEPORTAVOL requires volume slides which we don't emulate right now. + bool porta = p->command == CMD_TONEPORTAMENTO /*|| p->command CMD_TONEPORTAVOL || p->volcmd == VOLCMD_TONEPORTAMENTO*/; // Volume column tone portamento can be crazy, and CMD_TONEPORTAVOL requires volume slides which we don't emulate right now. bool stopNote = false; if(p->IsNote()) { pChn->nNewNote = pChn->nLastNote; - InstrumentChange(pChn, pChn->nNewIns, porta); + if(pChn->nNewIns != 0) InstrumentChange(pChn, pChn->nNewIns, porta); NoteChange(pChn, p->note, porta); pChn->nInc = GetChannelIncrement(pChn, pChn->nPeriod, 0); @@ -661,19 +689,23 @@ // Increment playback position of sample and envelopes for(uint32 i = 0; i < (numTicks - startTick); i++) { + bool updateInc = (pChn->PitchEnv.flags & (ENV_ENABLED | ENV_FILTER)) == ENV_ENABLED; if(porta && i != startTick) { if(p->command == CMD_TONEPORTAMENTO) TonePortamento(pChn, p->param); //else if(p->command == CMD_TONEPORTAVOL) TonePortamento(pChn, 0); - pChn->nInc = GetChannelIncrement(pChn, pChn->nPeriod, 0); + updateInc = true; } + IncrementEnvelopePositions(pChn); + int vol = 0; + ProcessInstrumentFade(pChn, vol); + + if(updateInc) pChn->nInc = GetChannelIncrement(pChn, pChn->nPeriod, 0); + pChn->nPosLo += pChn->nInc * tickDuration; pChn->nPos += (pChn->nPosLo >> 16); pChn->nPosLo &= 0xFFFF; - IncrementEnvelopePositions(pChn); - int vol = 0; - ProcessInstrumentFade(pChn, vol); } if(pChn->pModSample->uFlags[CHN_SUSTAINLOOP | CHN_LOOP]) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-03-08 00:19:48
|
Revision: 3847 http://sourceforge.net/p/modplug/code/3847 Author: saga-games Date: 2014-03-08 00:19:39 +0000 (Sat, 08 Mar 2014) Log Message: ----------- [Fix] Envelopy carry was broken on sample-less channels Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-03-07 21:26:33 UTC (rev 3846) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-03-08 00:19:39 UTC (rev 3847) @@ -893,9 +893,9 @@ } } - // IT Compatibility: Envelope pickup after SCx cut + // IT Compatibility: Envelope pickup after SCx cut (but don't do this when working with plugins, or else envelope carry stops working) // Test case: cut-carry.it - if(pChn->nInc == 0 && (GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) + if(pChn->nInc == 0 && (GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (!pIns || !pIns->HasValidMIDIChannel())) { instrumentChanged = true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-04-22 17:13:31
|
Revision: 4017 http://sourceforge.net/p/modplug/code/4017 Author: saga-games Date: 2014-04-22 17:13:25 +0000 (Tue, 22 Apr 2014) Log Message: ----------- [Imp] Add protracker-style offset when note but no instrument number is specified in PT1.x mode (fixes h0ffman's Revision 2014 tracked music entry) Revision Links: -------------- http://sourceforge.net/p/modplug/code/2014 Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-04-22 15:56:51 UTC (rev 4016) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-04-22 17:13:25 UTC (rev 4017) @@ -1325,6 +1325,10 @@ pChn->nLoopStart = 0; pChn->nPos = 0; pChn->nPosLo = 0; + if(m_SongFlags[SONG_PT1XMODE] && !pChn->rowCommand.instr) + { + pChn->nPos = (pChn->nOldHiOffset << 16) + (pChn->nOldOffset << 8); + } pChn->dwFlags = (pChn->dwFlags & CHN_CHANNELFLAGS) | (static_cast<ChannelFlags>(pSmp->uFlags) & CHN_SAMPLEFLAGS); if(pChn->dwFlags[CHN_SUSTAINLOOP]) { @@ -4403,7 +4407,7 @@ if (pChn->nPos >= pChn->nLength) { // Offset beyond sample size - if (!(GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) + if (!(GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MOD))) { // IT Compatibility: Offset if(IsCompatibleMode(TRK_IMPULSETRACKER)) @@ -5092,7 +5096,13 @@ nChn = channel.nMasterChn - 1; } - nPlugin = ChnSettings[nChn].nMixPlugin; + if(nChn < MAX_BASECHANNELS) + { + nPlugin = ChnSettings[nChn].nMixPlugin; + } else + { + nPlugin = 0; + } } return nPlugin; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-06-30 23:56:27
|
Revision: 4181 http://sourceforge.net/p/modplug/code/4181 Author: saga-games Date: 2014-06-30 23:56:14 +0000 (Mon, 30 Jun 2014) Log Message: ----------- [Fix] IT compatibility: Portamento target is completely cleared with new notes (Test case: PortaReset.it). Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-06-29 19:59:23 UTC (rev 4180) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-06-30 23:56:14 UTC (rev 4181) @@ -1314,7 +1314,9 @@ { // FT2 compatibility: Don't reset portamento target with new notes. // Test case: Porta-Pickup.xm - if(bPorta || !IsCompatibleMode(TRK_FASTTRACKER2)) + // IT compatibility: Portamento target is completely cleared with new notes. + // Test case: PortaReset.it + if(bPorta || !(IsCompatibleMode(TRK_FASTTRACKER2) || IsCompatibleMode(TRK_IMPULSETRACKER))) { pChn->nPortamentoDest = period; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-08-31 19:59:56
|
Revision: 4224 http://sourceforge.net/p/modplug/code/4224 Author: saga-games Date: 2014-08-31 19:59:40 +0000 (Sun, 31 Aug 2014) Log Message: ----------- [Fix] ProTracker compatibilty: Implement a few more edge cases of ProTracker-style 9xx offset handling that I was previously not aware of. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-08-31 19:13:30 UTC (rev 4223) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-08-31 19:59:40 UTC (rev 4224) @@ -4417,12 +4417,24 @@ } // -! NEW_FEATURE#0010 + if(pChn->rowCommand.instr) pChn->proTrackerOffset = 0; + pChn->proTrackerOffset += param; + if(pChn->rowCommand.IsNote()) { - pChn->nPos = param; + if(m_SongFlags[SONG_PT1XMODE]) + { + // ProTracker compatbility: PT1/2-style funky 9xx offset command + // Test case: ptoffset.mod + pChn->nPos = pChn->proTrackerOffset; + pChn->proTrackerOffset += param; + } else + { + pChn->nPos = param; + } pChn->nPosLo = 0; - if (pChn->nPos >= pChn->nLength) + if (pChn->nPos >= pChn->nLength || (pChn->dwFlags[CHN_LOOP] && pChn->nPos >= pChn->nLoopEnd)) { // Offset beyond sample size if (!(GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MOD))) @@ -4457,11 +4469,6 @@ pChn->nPos = param; pChn->nPosLo = 0; } - if(pChn->rowCommand.IsNote()) pChn->proTrackerOffset = param; - else if(pChn->rowCommand.instr) pChn->proTrackerOffset = 0; - pChn->proTrackerOffset += param; - - return; } //end rewbs.volOffset: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-08-31 23:27:10
|
Revision: 4225 http://sourceforge.net/p/modplug/code/4225 Author: saga-games Date: 2014-08-31 23:26:59 +0000 (Sun, 31 Aug 2014) Log Message: ----------- [Fix] ProTracker compatibility: Refine patch from r4212 to correctly handle the vocal samples in professionaltracker.mod Revision Links: -------------- http://sourceforge.net/p/modplug/code/4212 Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-08-31 19:59:40 UTC (rev 4224) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-08-31 23:26:59 UTC (rev 4225) @@ -2022,7 +2022,7 @@ // Test case: InstrDelay.mod if(instr && !m_PlayState.m_nTickCount && !triggerNote && m_SongFlags[SONG_PT1XMODE]) { - InstrumentChange(pChn, instr, bPorta, true); + InstrumentChange(pChn, instr, true, true, false); } // Handles note/instrument/volume changes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-09-30 00:10:24
|
Revision: 4331 http://sourceforge.net/p/modplug/code/4331 Author: saga-games Date: 2014-09-30 00:10:18 +0000 (Tue, 30 Sep 2014) Log Message: ----------- [Fix] Frequency slide down broke in previous revision. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-09-29 23:59:15 UTC (rev 4330) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-09-30 00:10:18 UTC (rev 4331) @@ -3152,8 +3152,8 @@ } else { pChn->nPeriod -= (int)(param * 4); + if (pChn->nPeriod < 1) pChn->nPeriod = 1; } - if (pChn->nPeriod < 1) pChn->nPeriod = 1; } } } @@ -3182,13 +3182,13 @@ pChn->nPeriod = Util::muldivr(pChn->nPeriod, LinearSlideDownTable[param & 0x0F], 65536); if(oldPeriod == pChn->nPeriod) { - pChn->nPeriod++; + pChn->nPeriod--; } } else { pChn->nPeriod += (int)(param * 4); + if (pChn->nPeriod > 0xFFFF) pChn->nPeriod = 0xFFFF; } - if (pChn->nPeriod > 0xFFFF) pChn->nPeriod = 0xFFFF; } } } @@ -3217,13 +3217,13 @@ pChn->nPeriod = Util::muldivr(pChn->nPeriod, FineLinearSlideUpTable[param & 0x0F], 65536); if(oldPeriod == pChn->nPeriod) { - pChn->nPeriod--; + pChn->nPeriod++; } } else { pChn->nPeriod -= (int)(param); + if (pChn->nPeriod < 1) pChn->nPeriod = 1; } - if (pChn->nPeriod < 1) pChn->nPeriod = 1; } } } @@ -3252,13 +3252,13 @@ pChn->nPeriod = Util::muldivr(pChn->nPeriod, FineLinearSlideDownTable[param & 0x0F], 65536); if(oldPeriod == pChn->nPeriod) { - pChn->nPeriod++; + pChn->nPeriod--; } } else { pChn->nPeriod += (int)(param); + if (pChn->nPeriod > 0xFFFF) pChn->nPeriod = 0xFFFF; } - if (pChn->nPeriod > 0xFFFF) pChn->nPeriod = 0xFFFF; } } } @@ -4645,7 +4645,7 @@ int32 nOldPeriod = pChn->nPeriod; if (nFreqSlide < 0) { - UINT n = (- nFreqSlide) >> 2; + UINT n = (-nFreqSlide) / 4; if (n) { if (n > 255) n = 255; @@ -4654,7 +4654,7 @@ } } else { - UINT n = (nFreqSlide) >> 2; + UINT n = (nFreqSlide) / 4; if (n) { if (n > 255) n = 255; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-01-08 22:24:10
|
Revision: 4705 http://sourceforge.net/p/modplug/code/4705 Author: saga-games Date: 2015-01-08 22:24:04 +0000 (Thu, 08 Jan 2015) Log Message: ----------- [Mod] Small optimization for GetLength with synced sample pos (it's still slow, and I didn't measure the performance increase, but replacing a loop by a static lookup can never hurt) Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-01-08 18:07:17 UTC (rev 4704) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-01-08 22:24:04 UTC (rev 4705) @@ -156,6 +156,23 @@ } } + // Initalize fast LUTs for commands that are too weird / complicated / whatever to emulate in sample position adjust mode. + std::bitset<MAX_EFFECTS> forbiddenCommands; + std::bitset<MAX_VOLCMDS> forbiddenVolCommands; + if(adjustSamplePos) + { + forbiddenCommands.set(CMD_ARPEGGIO); forbiddenCommands.set(CMD_PORTAMENTOUP); + forbiddenCommands.set(CMD_PORTAMENTODOWN); forbiddenCommands.set(CMD_VIBRATOVOL); + forbiddenCommands.set(CMD_TONEPORTAVOL); forbiddenCommands.set(CMD_VOLUMESLIDE); + forbiddenCommands.set(CMD_XFINEPORTAUPDOWN); forbiddenCommands.set(CMD_NOTESLIDEUP); + forbiddenCommands.set(CMD_NOTESLIDEUPRETRIG); forbiddenCommands.set(CMD_NOTESLIDEDOWN); + forbiddenCommands.set(CMD_NOTESLIDEDOWNRETRIG); + forbiddenVolCommands.set(VOLCMD_PORTAUP); forbiddenVolCommands.set(VOLCMD_PORTADOWN); + forbiddenVolCommands.set(VOLCMD_TONEPORTAMENTO); forbiddenVolCommands.set(VOLCMD_VOLSLIDEUP); + forbiddenVolCommands.set(VOLCMD_VOLSLIDEDOWN); forbiddenVolCommands.set(VOLCMD_FINEVOLUP); + forbiddenVolCommands.set(VOLCMD_FINEVOLDOWN); + } + for (;;) { // Time target reached. @@ -603,9 +620,6 @@ if(adjustSamplePos) { // Super experimental and dirty sample seeking - const ModCommand::COMMAND forbiddenCommands[] = { CMD_ARPEGGIO, CMD_PORTAMENTOUP, CMD_PORTAMENTODOWN, CMD_VOLUMESLIDE, CMD_VIBRATOVOL, CMD_TONEPORTAVOL, CMD_XFINEPORTAUPDOWN, CMD_NOTESLIDEUP, CMD_NOTESLIDEUPRETRIG, CMD_NOTESLIDEDOWN, CMD_NOTESLIDEDOWNRETRIG }; - const ModCommand::VOLCMD forbiddenVolCommands[] = { VOLCMD_PORTAUP, VOLCMD_PORTADOWN, VOLCMD_TONEPORTAMENTO, VOLCMD_VOLSLIDEUP, VOLCMD_VOLSLIDEDOWN, VOLCMD_FINEVOLUP, VOLCMD_FINEVOLDOWN }; - pChn = memory.state.Chn; p = Patterns[nPattern].GetRow(nRow); for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, pChn++, nChn++) @@ -690,15 +704,12 @@ if(pChn->nInc != 0 && pChn->pModSample && !stopNote) { // Check if we don't want to emulate some effect and thus stop processing. - if(p->command != CMD_NONE) + if(p->command < MAX_EFFECTS) { - for(size_t i = 0; i < CountOf(forbiddenCommands); i++) + if(forbiddenCommands[p->command]) { - if(p->command == forbiddenCommands[i]) - { - stopNote = true; - break; - } + stopNote = true; + break; } // Special case: Slides using extended commands if(p->command == CMD_MODCMDEX) @@ -714,17 +725,11 @@ } } } - - if(!stopNote && p->volcmd != VOLCMD_NONE) + + if(p->volcmd < MAX_VOLCMDS && forbiddenVolCommands[p->volcmd]) { - for(size_t i = 0; i < CountOf(forbiddenVolCommands); i++) - { - if(p->volcmd == forbiddenVolCommands[i]) - { - stopNote = true; - break; - } - } + stopNote = true; + break; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-01-18 01:28:20
|
Revision: 4722 http://sourceforge.net/p/modplug/code/4722 Author: saga-games Date: 2015-01-18 01:28:06 +0000 (Sun, 18 Jan 2015) Log Message: ----------- [Fix] Maintain sample sync on seek was slightly broken since r4705. Revision Links: -------------- http://sourceforge.net/p/modplug/code/4705 Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-01-18 00:34:10 UTC (rev 4721) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-01-18 01:28:06 UTC (rev 4722) @@ -704,7 +704,6 @@ if(forbiddenCommands[p->command]) { stopNote = true; - break; } // Special case: Slides using extended commands if(p->command == CMD_MODCMDEX) @@ -716,7 +715,6 @@ case 0xA0: case 0xB0: stopNote = true; - break; } } } @@ -724,7 +722,6 @@ if(p->volcmd < MAX_VOLCMDS && forbiddenVolCommands[p->volcmd]) { stopNote = true; - break; } } @@ -1556,20 +1553,13 @@ //--------------------------------------------------------------------------------------------------------------- { int32_t newPan = int32_min; - if(instr != nullptr) - { - // Default instrument panning - if(instr->dwFlags[INS_SETPANNING]) - { - newPan = instr->nPan; - } - } - + // Default instrument panning + if(instr != nullptr && instr->dwFlags[INS_SETPANNING]) + newPan = instr->nPan; // Default sample panning if(smp != nullptr && smp->uFlags[CHN_PANNING]) - { newPan = smp->nPan; - } + if(newPan != int32_min) { pChn->nPan = newPan; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-03-11 15:39:33
|
Revision: 4866 http://sourceforge.net/p/modplug/code/4866 Author: saga-games Date: 2015-03-11 15:39:19 +0000 (Wed, 11 Mar 2015) Log Message: ----------- [Fix] SetTempo() mustn't be used by GetLength, because it modifies global state and doesn't handle slides correctly. Note that an old bug regarding slides remains for now: If there is a set speed command right of the tempo slide command, it is not considered. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-11 15:35:56 UTC (rev 4865) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-11 15:39:19 UTC (rev 4866) @@ -383,7 +383,28 @@ { if (param) pChn->nOldTempo = param; else param = pChn->nOldTempo; } - SetTempo(param); + + if (param >= 0x20) memory.state.m_nMusicTempo = param; + else + { + // Tempo Slide + uint32_t tempoDiff = (param & 0x0F) * (memory.state.m_nMusicSpeed - 1); + if ((param & 0xF0) == 0x10) + { + memory.state.m_nMusicTempo += tempoDiff; + } else + { + if(tempoDiff < memory.state.m_nMusicTempo) + memory.state.m_nMusicTempo -= tempoDiff; + else + memory.state.m_nMusicTempo = 0; + } + } + if(IsCompatibleMode(TRK_ALLTRACKERS)) // clamp tempo correctly in compatible mode + memory.state.m_nMusicTempo = Clamp(memory.state.m_nMusicTempo, 32u, 255u); + else + memory.state.m_nMusicTempo = Clamp(memory.state.m_nMusicTempo, GetModSpecifications().tempoMin, GetModSpecifications().tempoMax); + break; case CMD_S3MCMDEX: if((param & 0xF0) == 0x60) @@ -4885,26 +4906,22 @@ { // Set tempo from UI - ignore slide commands and such. m_PlayState.m_nMusicTempo = Clamp(param, specs.tempoMin, specs.tempoMax); - } - else + } else if (param >= 0x20 && m_SongFlags[SONG_FIRSTTICK]) { - if (param >= 0x20 && m_SongFlags[SONG_FIRSTTICK]) //rewbs.tempoSlideFix: only set if not (T0x or T1x) and tick is 0 - { - m_PlayState.m_nMusicTempo = param; - if (param > GetModSpecifications().tempoMax) param = GetModSpecifications().tempoMax; - } else if (param < 0x20 && !m_SongFlags[SONG_FIRSTTICK]) //rewbs.tempoSlideFix: only slide if (T0x or T1x) and tick is not 0 - { - // Tempo Slide - if ((param & 0xF0) == 0x10) - m_PlayState.m_nMusicTempo += (param & 0x0F); //rewbs.tempoSlideFix: no *2 - else - m_PlayState.m_nMusicTempo -= (param & 0x0F); //rewbs.tempoSlideFix: no *2 + m_PlayState.m_nMusicTempo = param; + if (param > GetModSpecifications().tempoMax) param = GetModSpecifications().tempoMax; + } else if (param < 0x20 && !m_SongFlags[SONG_FIRSTTICK]) + { + // Tempo Slide + if ((param & 0xF0) == 0x10) + m_PlayState.m_nMusicTempo += (param & 0x0F); + else + m_PlayState.m_nMusicTempo -= (param & 0x0F); - if(IsCompatibleMode(TRK_ALLTRACKERS)) // clamp tempo correctly in compatible mode - m_PlayState.m_nMusicTempo = Clamp(m_PlayState.m_nMusicTempo, 32u, 255u); - else - m_PlayState.m_nMusicTempo = Clamp(m_PlayState.m_nMusicTempo, specs.tempoMin, specs.tempoMax); - } + if(IsCompatibleMode(TRK_ALLTRACKERS)) // clamp tempo correctly in compatible mode + m_PlayState.m_nMusicTempo = Clamp(m_PlayState.m_nMusicTempo, 32u, 255u); + else + m_PlayState.m_nMusicTempo = Clamp(m_PlayState.m_nMusicTempo, specs.tempoMin, specs.tempoMax); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2015-03-11 15:47:11
|
Revision: 4868 http://sourceforge.net/p/modplug/code/4868 Author: manxorist Date: 2015-03-11 15:46:58 +0000 (Wed, 11 Mar 2015) Log Message: ----------- [Ref] Remove dead code. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-11 15:45:20 UTC (rev 4867) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-11 15:46:58 UTC (rev 4868) @@ -1868,7 +1868,6 @@ // -> CODE#0010 // -> DESC="add extended parameter mechanism to pattern effects" - ModCommand *m = nullptr; // -! NEW_FEATURE#0010 for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-03-11 15:56:57
|
Revision: 4871 http://sourceforge.net/p/modplug/code/4871 Author: saga-games Date: 2015-03-11 15:56:44 +0000 (Wed, 11 Mar 2015) Log Message: ----------- [Fix] xparam values were searched in entirely wrong pattern locations. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-11 15:55:10 UTC (rev 4870) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-11 15:56:44 UTC (rev 4871) @@ -378,26 +378,28 @@ if(param != 0) memory.state.m_nMusicSpeed = param; break; } - param = CalculateXParam(memory.state.m_nPattern, memory.state.m_nRow, nChn); - if ((adjustMode & eAdjust) && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT))) { - if (param) pChn->nOldTempo = param; else param = pChn->nOldTempo; - } - - if (param >= 0x20) memory.state.m_nMusicTempo = param; - else - { - // Tempo Slide - uint32_t tempoDiff = (param & 0x0F) * (memory.state.m_nMusicSpeed - 1); - if ((param & 0xF0) == 0x10) + uint32_t tempo = CalculateXParam(memory.state.m_nPattern, memory.state.m_nRow, nChn); + if ((adjustMode & eAdjust) && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT))) { - memory.state.m_nMusicTempo += tempoDiff; - } else + if (tempo) pChn->nOldTempo = tempo; else tempo = pChn->nOldTempo; + } + + if (tempo >= 0x20) memory.state.m_nMusicTempo = tempo; + else { - if(tempoDiff < memory.state.m_nMusicTempo) - memory.state.m_nMusicTempo -= tempoDiff; - else - memory.state.m_nMusicTempo = 0; + // Tempo Slide + uint32_t tempoDiff = (tempo & 0x0F) * (memory.state.m_nMusicSpeed - 1); + if ((tempo & 0xF0) == 0x10) + { + memory.state.m_nMusicTempo += tempoDiff; + } else + { + if(tempoDiff < memory.state.m_nMusicTempo) + memory.state.m_nMusicTempo -= tempoDiff; + else + memory.state.m_nMusicTempo = 0; + } } } if(IsCompatibleMode(TRK_ALLTRACKERS)) // clamp tempo correctly in compatible mode @@ -1866,9 +1868,6 @@ return true; } -// -> CODE#0010 -// -> DESC="add extended parameter mechanism to pattern effects" -// -! NEW_FEATURE#0010 for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++) { UINT instr = pChn->rowCommand.instr; @@ -3012,7 +3011,7 @@ { if(isExtended != nullptr) *isExtended = false; ROWINDEX maxCommands = 4; - const ModCommand *m = Patterns[pat].GetpModCommand(chn, row); + const ModCommand *m = Patterns[pat].GetpModCommand(row, chn); uint32_t val = m->param; switch(m->command) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-03-18 17:19:57
|
Revision: 4895 http://sourceforge.net/p/modplug/code/4895 Author: saga-games Date: 2015-03-18 17:19:50 +0000 (Wed, 18 Mar 2015) Log Message: ----------- [Fix] Test cases PatternDelaysRetrig.it/PatternDelaysRetrig.s3m broke in OpenMPT 1.23 (r3520 most likely), so tick-0 effects were no longer executed on the first tick of repeated rows. Revision Links: -------------- http://sourceforge.net/p/modplug/code/3520 Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-18 09:53:32 UTC (rev 4894) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-18 17:19:50 UTC (rev 4895) @@ -1862,6 +1862,7 @@ for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++) { + const uint32 tickCount = m_PlayState.m_nTickCount % (m_PlayState.m_nMusicSpeed + m_PlayState.m_nFrameDelay); UINT instr = pChn->rowCommand.instr; UINT volcmd = pChn->rowCommand.volcmd; UINT vol = pChn->rowCommand.vol; @@ -1870,7 +1871,7 @@ bool bPorta = pChn->rowCommand.IsPortamento(); UINT nStartTick = 0; - pChn->isFirstTick = (m_PlayState.m_nTickCount == 0); + pChn->isFirstTick = m_SongFlags[SONG_FIRSTTICK]; pChn->dwFlags.reset(CHN_FASTVOLRAMP); @@ -2037,7 +2038,7 @@ } bool triggerNote = (m_PlayState.m_nTickCount == nStartTick); // Can be delayed by a note delay effect - if((GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)) && nStartTick > 0 && (m_PlayState.m_nTickCount % (m_PlayState.m_nMusicSpeed + m_PlayState.m_nFrameDelay)) == nStartTick) + if((GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)) && nStartTick > 0 && tickCount == nStartTick) { // IT compatibility: Delayed notes (using SDx) that are on the same row as a Row Delay effect are retriggered. Scream Tracker 3 does the same. // Test case: PatternDelay-NoteDelay.it @@ -2054,7 +2055,7 @@ // Test case: SlideDelay.it if(IsCompatibleMode(TRK_IMPULSETRACKER)) { - pChn->isFirstTick = triggerNote; + pChn->isFirstTick = tickCount == nStartTick; } // FT2 compatibility: Note + portamento + note delay = no portamento @@ -4886,9 +4887,7 @@ m_PlayState.m_nMusicSpeed = uint16_max; } #endif // MODPLUG_TRACKER - - // Allow high speed values here for VBlank MODs. (Maybe it would be better to have a "VBlank MOD" flag somewhere? Is it worth the effort?) - if ((param) && (param <= GetModSpecifications().speedMax || (GetType() & MOD_TYPE_MOD))) m_PlayState.m_nMusicSpeed = param; + if(param > 0) m_PlayState.m_nMusicSpeed = param; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-03-19 04:44:45
|
Revision: 4898 http://sourceforge.net/p/modplug/code/4898 Author: saga-games Date: 2015-03-19 04:44:32 +0000 (Thu, 19 Mar 2015) Log Message: ----------- [Fix] Fix initialization order for GetLengthMemory (triggered warning) Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-19 04:36:50 UTC (rev 4897) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-19 04:44:32 UTC (rev 4898) @@ -41,8 +41,10 @@ // Memory class for GetLength() code class GetLengthMemory { +protected: + const CSoundFile &sndFile; + public: - CSoundFile::PlayState state; struct ChnSettings { @@ -64,15 +66,10 @@ double elapsedTime; static const uint32 IGNORE_CHANNEL = uint32_max; -protected: - const CSoundFile &sndFile; - -public: - GetLengthMemory(const CSoundFile &sf) : sndFile(sf) + , state(sf.m_PlayState) , chnSettings(sf.GetNumChannels()) - , state(sf.m_PlayState) { Reset(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-03-28 22:23:33
|
Revision: 4909 http://sourceforge.net/p/modplug/code/4909 Author: saga-games Date: 2015-03-28 22:23:27 +0000 (Sat, 28 Mar 2015) Log Message: ----------- [Fix] GetLength code: Sample offset does now *finally* work again. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-28 19:50:09 UTC (rev 4908) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-28 22:23:27 UTC (rev 4909) @@ -390,13 +390,14 @@ } ModChannel *pChn = memory.state.Chn; - const ModCommand *p = Patterns[memory.state.m_nPattern].GetRow(memory.state.m_nRow); // For various effects, we need to know first how many ticks there are in this row. + const ModCommand *p = Patterns[memory.state.m_nPattern].GetRow(memory.state.m_nRow); for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, p++) { if(IsCompatibleMode(TRK_SCREAMTRACKER) && ChnSettings[nChn].dwFlags[CHN_MUTE]) // not even effects are processed on muted S3M channels continue; + pChn[nChn].rowCommand = *p; switch(p->command) { case CMD_SPEED: @@ -449,23 +450,22 @@ const uint32 numTicks = (memory.state.m_nMusicSpeed + tickDelay) * rowDelay; const uint32 nonRowTicks = numTicks - rowDelay; - p = Patterns[memory.state.m_nPattern].GetRow(memory.state.m_nRow); - for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, pChn++, nChn++) if(!p->IsEmpty()) + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++) if(!pChn->rowCommand.IsEmpty()) { if(IsCompatibleMode(TRK_SCREAMTRACKER) && ChnSettings[nChn].dwFlags[CHN_MUTE]) // not even effects are processed on muted S3M channels continue; - ModCommand::COMMAND command = p->command; - ModCommand::PARAM param = p->param; - ModCommand::NOTE note = p->note; + ModCommand::COMMAND command = pChn->rowCommand.command; + ModCommand::PARAM param = pChn->rowCommand.param; + ModCommand::NOTE note = pChn->rowCommand.note; - if (p->instr) + if (pChn->rowCommand.instr) { - pChn->nNewIns = p->instr; + pChn->nNewIns = pChn->rowCommand.instr; pChn->nLastNote = NOTE_NONE; memory.chnSettings[nChn].vol = 0xFF; } - if (p->IsNote()) pChn->nLastNote = note; - if (p->volcmd == VOLCMD_VOLUME) { memory.chnSettings[nChn].vol = p->vol; } + if (pChn->rowCommand.IsNote()) pChn->nLastNote = note; + if (pChn->rowCommand.volcmd == VOLCMD_VOLUME) { memory.chnSettings[nChn].vol = pChn->rowCommand.vol; } switch(command) { // Position Jump @@ -478,7 +478,7 @@ if(!patternBreakOnThisRow || (GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM))) memory.state.m_nNextRow = 0; - if ((adjustMode & eAdjust)) + if (adjustMode & eAdjust) { pChn->nPatternLoopCount = 0; pChn->nPatternLoop = 0; @@ -602,7 +602,7 @@ } // The following calculations are not interesting if we just want to get the song length. - if ((adjustMode & eAdjust) == 0) continue; + if (!(adjustMode & eAdjust)) continue; switch(command) { // Portamento Up/Down @@ -700,19 +700,19 @@ } break; case CMD_PANNING8: - Panning(pChn, p->param, _8bit); + Panning(pChn, param, _8bit); break; case CMD_MODCMDEX: case CMD_S3MCMDEX: - if((p->param & 0xF0) == 0x80) + if((param & 0xF0) == 0x80) { - Panning(pChn, (p->param & 0x0F), _4bit); + Panning(pChn, (param & 0x0F), _4bit); } break; } - if(p->volcmd == VOLCMD_PANNING) + if(pChn->rowCommand.volcmd == VOLCMD_PANNING) { - Panning(pChn, p->vol, _6bit); + Panning(pChn, pChn->rowCommand.vol, _6bit); } } @@ -745,44 +745,44 @@ { // Super experimental and dirty sample seeking pChn = memory.state.Chn; - p = Patterns[memory.state.m_nPattern].GetRow(memory.state.m_nRow); - for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, pChn++, nChn++) + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); pChn++, nChn++) { if(memory.chnSettings[nChn].ticksToRender == GetLengthMemory::IGNORE_CHANNEL) continue; uint32 startTick = 0; - uint32 paramHi = p->param >> 4, paramLo = p->param & 0x0F; - bool porta = p->command == CMD_TONEPORTAMENTO /*|| p->command CMD_TONEPORTAVOL*/ || p->volcmd == VOLCMD_TONEPORTAMENTO; // CMD_TONEPORTAVOL requires volume slides which we don't emulate right now. + const ModCommand &m = pChn->rowCommand; + uint32 paramHi = m.param >> 4, paramLo = m.param & 0x0F; + bool porta = m.command == CMD_TONEPORTAMENTO /*|| m.command CMD_TONEPORTAVOL*/ || m.volcmd == VOLCMD_TONEPORTAMENTO; // CMD_TONEPORTAVOL requires volume slides which we don't emulate right now. bool stopNote = patternLoopStartedOnThisRow; // It's too much trouble to keep those pattern loops in sync... - if(p->instr) pChn->proTrackerOffset = 0; - if(p->IsNote()) + if(m.instr) pChn->proTrackerOffset = 0; + if(m.IsNote()) { int32 setPan = pChn->nPan; pChn->nNewNote = pChn->nLastNote; if(pChn->nNewIns != 0) InstrumentChange(pChn, pChn->nNewIns, porta); - NoteChange(pChn, p->note, porta); + NoteChange(pChn, m.note, porta); memory.chnSettings[nChn].incChanged = true; - if((p->command == CMD_MODCMDEX || p->command == CMD_S3MCMDEX) && (p->param & 0xF0) == 0xD0 && paramLo < numTicks) + if((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xD0 && paramLo < numTicks) { startTick = paramLo; - } else if(p->command == CMD_DELAYCUT && paramHi < numTicks) + } else if(m.command == CMD_DELAYCUT && paramHi < numTicks) { startTick = paramHi; } if(!porta) memory.chnSettings[nChn].ticksToRender = 0; // Panning commands have to be re-applied after a note change with potential pan change. - if(p->command == CMD_PANNING8 - || ((p->command == CMD_MODCMDEX || p->command == CMD_S3MCMDEX) && paramHi == 0x8) - || p->volcmd == VOLCMD_PANNING) + if(m.command == CMD_PANNING8 + || ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && paramHi == 0x8) + || m.volcmd == VOLCMD_PANNING) { pChn->nPan = setPan; } - if(p->command == CMD_OFFSET) + if(m.command == CMD_OFFSET) { bool isExtended = false; SmpLength offset = CalculateXParam(memory.state.m_nPattern, memory.state.m_nRow, nChn, &isExtended); @@ -793,47 +793,47 @@ offset += static_cast<SmpLength>(pChn->nOldHiOffset) << 16; } SampleOffset(*pChn, offset); - } else if(p->volcmd == VOLCMD_OFFSET) + } else if(m.volcmd == VOLCMD_OFFSET) { - if(p->vol <= CountOf(pChn->pModSample->cues) && pChn->pModSample != nullptr) + if(m.vol <= CountOf(pChn->pModSample->cues) && pChn->pModSample != nullptr) { SmpLength offset; - if(p->vol == 0) + if(m.vol == 0) offset = pChn->oldOffset; else - offset = pChn->oldOffset = pChn->pModSample->cues[p->vol - 1]; + offset = pChn->oldOffset = pChn->pModSample->cues[m.vol - 1]; SampleOffset(*pChn, offset); } } } - if(p->note == NOTE_KEYOFF || p->note == NOTE_NOTECUT || (p->note == NOTE_FADE && GetNumInstruments()) - || ((p->command == CMD_MODCMDEX || p->command == CMD_S3MCMDEX) && (p->param & 0xF0) == 0xC0 && paramLo < numTicks) - || (p->command == CMD_DELAYCUT && paramLo != 0 && startTick + paramLo < numTicks)) + if(m.note == NOTE_KEYOFF || m.note == NOTE_NOTECUT || (m.note == NOTE_FADE && GetNumInstruments()) + || ((m.command == CMD_MODCMDEX || m.command == CMD_S3MCMDEX) && (m.param & 0xF0) == 0xC0 && paramLo < numTicks) + || (m.command == CMD_DELAYCUT && paramLo != 0 && startTick + paramLo < numTicks)) { stopNote = true; } - if(p->command == CMD_VOLUME) + if(m.command == CMD_VOLUME) { - pChn->nVolume = p->param * 4; - } else if(p->volcmd == VOLCMD_VOLUME) + pChn->nVolume = m.param * 4; + } else if(m.volcmd == VOLCMD_VOLUME) { - pChn->nVolume = p->vol * 4; + pChn->nVolume = m.vol * 4; } if(pChn->pModSample && !stopNote) { // Check if we don't want to emulate some effect and thus stop processing. - if(p->command < MAX_EFFECTS) + if(m.command < MAX_EFFECTS) { - if(forbiddenCommands[p->command]) + if(forbiddenCommands[m.command]) { stopNote = true; - } else if(p->command == CMD_MODCMDEX) + } else if(m.command == CMD_MODCMDEX) { // Special case: Slides using extended commands - switch(p->param & 0xF0) + switch(m.param & 0xF0) { case 0x10: case 0x20: @@ -844,7 +844,7 @@ } } - if(p->volcmd < MAX_VOLCMDS && forbiddenVolCommands[p->volcmd]) + if(m.volcmd < MAX_VOLCMDS && forbiddenVolCommands[m.volcmd]) { stopNote = true; } @@ -861,19 +861,19 @@ memory.RenderChannel(nChn, oldTickDuration); // Re-sync what we've got so far } - if(p->command == CMD_S3MCMDEX) + if(m.command == CMD_S3MCMDEX) { - if(p->param == 0x9E) + if(m.param == 0x9E) { // Play forward memory.RenderChannel(nChn, oldTickDuration); // Re-sync what we've got so far pChn->dwFlags.reset(CHN_PINGPONGFLAG); - } else if(p->param == 0x9F) + } else if(m.param == 0x9F) { // Reverse memory.RenderChannel(nChn, oldTickDuration); // Re-sync what we've got so far pChn->dwFlags.set(CHN_PINGPONGFLAG); - if(!pChn->nPos && pChn->nLength && (p->IsNote() || !pChn->dwFlags[CHN_LOOP])) + if(!pChn->nPos && pChn->nLength && (m.IsNote() || !pChn->dwFlags[CHN_LOOP])) { pChn->nPos = pChn->nLength - 1; pChn->nPosLo = 0xFFFF; @@ -898,19 +898,20 @@ if(patternLoopEndedOnThisRow) { - p = Patterns[memory.state.m_nPattern].GetRow(memory.state.m_nRow); std::map<double, int> startTimes; // This is really just a simple estimation for nested pattern loops. It should handle cases correctly where all parallel loops start and end on the same row. // If one of them starts or ends "in between", it will most likely calculate a wrong duration. // For S3M files, it's also way off. - for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, nChn++) + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++) { - if((p->command == CMD_S3MCMDEX && p->param >= 0xB1 && p->param <= 0xBF) - || (p->command == CMD_MODCMDEX && p->param >= 0x61 && p->param <= 0x6F)) + ModCommand::COMMAND command = pChn->rowCommand.command; + ModCommand::PARAM param = pChn->rowCommand.param; + if((command == CMD_S3MCMDEX && param >= 0xB1 && param <= 0xBF) + || (command == CMD_MODCMDEX && param >= 0x61 && param <= 0x6F)) { const double start = memory.chnSettings[nChn].patLoop; if(!startTimes[start]) startTimes[start] = 1; - startTimes[start] = Util::lcm<int>(startTimes[start], 1 + (p->param & 0x0F)); + startTimes[start] = Util::lcm<int>(startTimes[start], 1 + (param & 0x0F)); } } for(std::map<double, int>::iterator i = startTimes.begin(); i != startTimes.end(); i++) @@ -920,10 +921,9 @@ if(GetType() == MOD_TYPE_IT) { // IT pattern loop start row update - at the end of a pattern loop, set pattern loop start to next row (for upcoming pattern loops with missing SB0) - p = Patterns[memory.state.m_nPattern].GetRow(memory.state.m_nRow); - for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, nChn++) + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++) { - if((p->command == CMD_S3MCMDEX && p->param >= 0xB1 && p->param <= 0xBF)) + if((pChn->rowCommand.command == CMD_S3MCMDEX && pChn->rowCommand.param >= 0xB1 && pChn->rowCommand.param <= 0xBF)) { memory.chnSettings[nChn].patLoop = memory.elapsedTime; } @@ -935,8 +935,7 @@ // Now advance the sample positions for sample seeking on channels that are still playing if(adjustSamplePos) { - ModCommand *p = Patterns[memory.state.m_nPattern].GetRow(memory.state.m_nRow); - for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, p++) + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++) { if(memory.chnSettings[nChn].ticksToRender != GetLengthMemory::IGNORE_CHANNEL) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-03-29 14:45:52
|
Revision: 4911 http://sourceforge.net/p/modplug/code/4911 Author: saga-games Date: 2015-03-29 14:45:47 +0000 (Sun, 29 Mar 2015) Log Message: ----------- [Fix] 669 files weren't played correctly in libopenmpt. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-29 01:18:09 UTC (rev 4910) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-29 14:45:47 UTC (rev 4911) @@ -5234,7 +5234,7 @@ //-------------------------------------------------------------------- { if (!period) return 0; - if (GetType() & (MOD_TYPE_MED|MOD_TYPE_MOD|MOD_TYPE_DIGI|MOD_TYPE_MTM|MOD_TYPE_669|MOD_TYPE_AMF0)) + if (GetType() & (MOD_TYPE_MED|MOD_TYPE_MOD|MOD_TYPE_DIGI|MOD_TYPE_MTM|MOD_TYPE_AMF0)) { return ((3546895L * 4) << FREQ_FRACBITS) / period; } else if (GetType() == MOD_TYPE_XM) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-04-18 21:50:37
|
Revision: 4946 http://sourceforge.net/p/modplug/code/4946 Author: saga-games Date: 2015-04-18 21:50:31 +0000 (Sat, 18 Apr 2015) Log Message: ----------- [Fix] Sample seeking: Portamento was not accurately in some cases. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-18 20:35:20 UTC (rev 4945) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-18 21:50:31 UTC (rev 4946) @@ -764,6 +764,11 @@ if(m.instr) pChn->proTrackerOffset = 0; if(m.IsNote()) { + if(porta && memory.chnSettings[nChn].incChanged) + { + // If there's a portamento, the current channel increment needs to be known in NoteChange() + pChn->nInc = GetChannelIncrement(pChn, pChn->nPeriod, 0); + } int32 setPan = pChn->nPan; pChn->nNewNote = pChn->nLastNote; if(pChn->nNewIns != 0) InstrumentChange(pChn, pChn->nNewIns, porta); @@ -888,7 +893,7 @@ if(porta) { - // Portamento needs immediate syncing + // Portamento needs immediate syncing, as the pitch changes on each tick uint32 portaTick = memory.chnSettings[nChn].ticksToRender + startTick + 1; memory.chnSettings[nChn].ticksToRender += numTicks; memory.RenderChannel(nChn, tickDuration, portaTick); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-04-19 01:27:32
|
Revision: 4947 http://sourceforge.net/p/modplug/code/4947 Author: saga-games Date: 2015-04-19 01:27:19 +0000 (Sun, 19 Apr 2015) Log Message: ----------- [Fix] On rows with a row delay effect, offset commands were executed on every row repetition. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-18 21:50:31 UTC (rev 4946) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-19 01:27:19 UTC (rev 4947) @@ -766,7 +766,7 @@ { if(porta && memory.chnSettings[nChn].incChanged) { - // If there's a portamento, the current channel increment needs to be known in NoteChange() + // If there's a portamento, the current channel increment mustn't be 0 in NoteChange() pChn->nInc = GetChannelIncrement(pChn, pChn->nPeriod, 0); } int32 setPan = pChn->nPan; @@ -2645,7 +2645,7 @@ break; case VOLCMD_OFFSET: - if (pChn->isFirstTick && pChn->pModSample && vol <= CountOf(pChn->pModSample->cues)) + if (triggerNote && pChn->pModSample && vol <= CountOf(pChn->pModSample->cues)) { SmpLength offset; if(vol == 0) @@ -2735,7 +2735,7 @@ // Set Offset case CMD_OFFSET: - if (pChn->isFirstTick) + if (triggerNote) { // FT2 compatibility: Portamento + Offset = Ignore offset // Test case: porta-offset.xm This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-04-19 12:45:11
|
Revision: 4948 http://sourceforge.net/p/modplug/code/4948 Author: saga-games Date: 2015-04-19 12:44:59 +0000 (Sun, 19 Apr 2015) Log Message: ----------- [Fix] IT/S3M/MPTM: When seeking with sample sync, take note delay + row delay combination into account [Fix] IT Compatiblity: Note delays should be capped by the ticks/per + fine pattern delay tick count, not the total row tick count (updated test case: tickdelay.it) Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-19 01:27:19 UTC (rev 4947) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-19 12:44:59 UTC (rev 4948) @@ -782,6 +782,10 @@ { startTick = paramHi; } + if(rowDelay > 1 && startTick != 0 && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)) + { + startTick += (memory.state.m_nMusicSpeed + tickDelay) * (rowDelay - 1); + } if(!porta) memory.chnSettings[nChn].ticksToRender = 0; // Panning commands have to be re-applied after a note change with potential pan change. @@ -2092,7 +2096,7 @@ //ST3 ignores notes with SD0 completely else if(GetType() == MOD_TYPE_S3M) continue; - } else if(nStartTick >= GetNumTicksOnCurrentRow() && IsCompatibleMode(TRK_IMPULSETRACKER)) + } else if(nStartTick >= (m_PlayState.m_nMusicSpeed + m_PlayState.m_nFrameDelay) && IsCompatibleMode(TRK_IMPULSETRACKER)) { // IT compatibility 08. Handling of out-of-range delay command. // Additional test case: tickdelay.it This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-04-19 12:49:13
|
Revision: 4949 http://sourceforge.net/p/modplug/code/4949 Author: saga-games Date: 2015-04-19 12:49:07 +0000 (Sun, 19 Apr 2015) Log Message: ----------- [Fix] Fix compile. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-19 12:44:59 UTC (rev 4948) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-19 12:49:07 UTC (rev 4949) @@ -782,7 +782,7 @@ { startTick = paramHi; } - if(rowDelay > 1 && startTick != 0 && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)) + if(rowDelay > 1 && startTick != 0 && (GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT))) { startTick += (memory.state.m_nMusicSpeed + tickDelay) * (rowDelay - 1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-04-19 14:52:09
|
Revision: 4950 http://sourceforge.net/p/modplug/code/4950 Author: saga-games Date: 2015-04-19 14:51:57 +0000 (Sun, 19 Apr 2015) Log Message: ----------- [Fix] PT1/2 mode: Instrument swapping also works if there was an empty sample slot "playing". Test case: PTEmptySwap.mod Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-19 12:49:07 UTC (rev 4949) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-04-19 14:51:57 UTC (rev 4950) @@ -2273,7 +2273,9 @@ // Apparently, any note number in a pattern causes instruments to recall their original volume settings - no matter if there's a Note Off next to it or whatever. // Test cases: keyoff+instr.xm, delay.xm bool reloadSampleSettings = (IsCompatibleMode(TRK_FASTTRACKER2) && instr != 0); - bool keepInstr = (GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)); + // ProTracker Compatibility: If a sample was stopped before, lone instrument numbers can retrigger it + // Test case: PTSwapEmpty.mod + bool keepInstr = (GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) || (m_SongFlags[SONG_PT1XMODE] && pChn->nInc == 0); // Now it's time for some FT2 crap... if (GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)) @@ -2438,14 +2440,15 @@ //const bool newInstrument = oldInstrument != pChn->pModInstrument && pChn->pModInstrument->Keyboard[pChn->nNewNote - NOTE_MIN] != 0; pChn->nPos = pChn->nPosLo = 0; } - } else + } else if ((GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT) && oldSample != pChn->pModSample && ModCommand::IsNote(note))) { // Special IT case: portamento+note causes sample change -> ignore portamento - if ((GetType() & (MOD_TYPE_S3M | MOD_TYPE_IT | MOD_TYPE_MPT)) - && oldSample != pChn->pModSample && ModCommand::IsNote(note)) - { - bPorta = false; - } + bPorta = false; + } else if(m_SongFlags[SONG_PT1XMODE] && pChn->nInc == 0) + { + // If channel was paused and is resurrected by a lone instrument number, reset the sample position. + // Test case: PTSwapEmpty.mod + pChn->nPos = pChn->nPosLo = 0; } } // New Note ? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-05-10 22:35:45
|
Revision: 5075 http://sourceforge.net/p/modplug/code/5075 Author: saga-games Date: 2015-05-10 22:35:40 +0000 (Sun, 10 May 2015) Log Message: ----------- [Fix] Time estimation: Pattern loops were only calculated correctly when placed on the last channel. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-05-10 22:28:47 UTC (rev 5074) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-05-10 22:35:40 UTC (rev 5075) @@ -916,7 +916,8 @@ // This is really just a simple estimation for nested pattern loops. It should handle cases correctly where all parallel loops start and end on the same row. // If one of them starts or ends "in between", it will most likely calculate a wrong duration. // For S3M files, it's also way off. - for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++) + pChn = memory.state.Chn; + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++) { ModCommand::COMMAND command = pChn->rowCommand.command; ModCommand::PARAM param = pChn->rowCommand.param; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-06-09 19:13:10
|
Revision: 5285 http://sourceforge.net/p/modplug/code/5285 Author: saga-games Date: 2015-06-09 19:13:05 +0000 (Tue, 09 Jun 2015) Log Message: ----------- [Fix] Various portamento-related things broke in r5148. Revision Links: -------------- http://sourceforge.net/p/modplug/code/5148 Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-06-09 17:44:35 UTC (rev 5284) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-06-09 19:13:05 UTC (rev 5285) @@ -1164,7 +1164,7 @@ } // Reset envelopes - if(bResetEnv) + if(bResetEnv && !bPorta) { // Blurb by Storlek (from the SchismTracker code): // Conditions experimentally determined to cause envelope reset in Impulse Tracker: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-06-09 22:05:18
|
Revision: 5287 http://sourceforge.net/p/modplug/code/5287 Author: saga-games Date: 2015-06-09 22:05:12 +0000 (Tue, 09 Jun 2015) Log Message: ----------- [Fix] r5285 fix was in the completely wrong place. [Mod] Custom Tuning: Behaviour change: If there's a portamento and the sample doesn't actually change, re-apply the sample settings such as default volume and panning like with normal samples. Revision Links: -------------- http://sourceforge.net/p/modplug/code/5285 Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-06-09 20:36:42 UTC (rev 5286) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-06-09 22:05:12 UTC (rev 5287) @@ -1065,18 +1065,18 @@ pSmp = nullptr; } - const bool newTuning = (GetType() == MOD_TYPE_MPT && pIns && pIns->pTuning); - // Playback behavior change for MPT: With portamento don't change sample if it is in - // the same instrument as previous sample. - if(bPorta && newTuning && pIns == pChn->pModInstrument) - return; - bool returnAfterVolumeAdjust = false; // instrumentChanged is used for IT carry-on env option bool instrumentChanged = (pIns != pChn->pModInstrument); const bool sampleChanged = (pChn->pModSample != nullptr) && (pSmp != pChn->pModSample); + const bool newTuning = (GetType() == MOD_TYPE_MPT && pIns && pIns->pTuning); + // Playback behavior change for MPT: With portamento don't change sample if it is in + // the same instrument as previous sample. + if(bPorta && newTuning && pIns == pChn->pModInstrument && sampleChanged) + return; + if(sampleChanged && bPorta) { // IT compatibility: No sample change (also within multi-sample instruments) during portamento when using Compatible Gxx. @@ -1164,7 +1164,7 @@ } // Reset envelopes - if(bResetEnv && !bPorta) + if(bResetEnv) { // Blurb by Storlek (from the SchismTracker code): // Conditions experimentally determined to cause envelope reset in Impulse Tracker: @@ -1471,7 +1471,7 @@ // Test case: PanReset.it if(IsCompatibleMode(TRK_IMPULSETRACKER)) ApplyInstrumentPanning(pChn, pIns, pSmp); - if(bResetEnv) + if(bResetEnv && !bPorta) { pChn->nVolSwing = pChn->nPanSwing = 0; pChn->nResSwing = pChn->nCutSwing = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |