From: <sag...@us...> - 2013-04-28 15:53:24
|
Revision: 1994 http://sourceforge.net/p/modplug/code/1994 Author: saga-games Date: 2013-04-28 15:53:16 +0000 (Sun, 28 Apr 2013) Log Message: ----------- [Mod] FT2 Compatiblity: No longer apply global volume on tick 2, since this was only part of the truth (http://bugs.openmpt.org/view.php?id=388). [Fix] FT2 Compatiblity: Only instrument numbers should reset sample panning, not lone notes (PanMemory.xm, http://bugs.openmpt.org/view.php?id=385). Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-04-28 14:37:19 UTC (rev 1993) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-04-28 15:53:16 UTC (rev 1994) @@ -735,9 +735,12 @@ } // Default sample panning - if(pSmp->uFlags[CHN_PANNING] || (GetType() & MOD_TYPE_XM)) + if(pSmp->uFlags[CHN_PANNING] && (bUpdVol || GetType() != MOD_TYPE_XM)) { + // FT2 compatibility: Only reset panning on instrument numbers, not notes (bUpdVol condition) + // Test case: PanMemory.xm pChn->nPan = pSmp->nPan; + // IT compatibility: Sample and instrument panning overrides channel surround status. // Test case: SmpInsPanSurround.it if(IsCompatibleMode(TRK_IMPULSETRACKER) && !m_SongFlags[SONG_SURROUNDPAN]) @@ -2321,13 +2324,14 @@ // break; // } - // FT2 compatibility: Global volume is applied *after* the first tick. - // This is not emulated quite correctly for speed 1 (because there is no second tick), but it should be close enough. + // FT2 compatibility: On channels that are "left" of the global volume command, the new global volume is not applied + // until the second tick of the row. Since we apply global volume on the mix buffer rather than note volumes, this + // cannot be fixed for now. // Test case: GlobalVolume.xm - if(IsCompatibleMode(TRK_FASTTRACKER2) && m_SongFlags[SONG_FIRSTTICK] && m_nMusicSpeed > 1) - { - break; - } +// if(IsCompatibleMode(TRK_FASTTRACKER2) && m_SongFlags[SONG_FIRSTTICK] && m_nMusicSpeed > 1) +// { +// break; +// } if (!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_IMF | MOD_TYPE_J2B | MOD_TYPE_MID | MOD_TYPE_AMS | MOD_TYPE_AMS2 | MOD_TYPE_DBM))) param *= 2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-04-28 16:57:04
|
Revision: 1996 http://sourceforge.net/p/modplug/code/1996 Author: saga-games Date: 2013-04-28 16:56:58 +0000 (Sun, 28 Apr 2013) Log Message: ----------- [Fix] FT2 compatibility: Instrument number resets tremor count. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-04-28 16:11:23 UTC (rev 1995) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-04-28 16:56:58 UTC (rev 1996) @@ -1163,16 +1163,11 @@ // IT compatibility 15. Retrigger is reset in RetrigNote (Tremor doesn't store anything here, so we just don't reset this as well) if(!IsCompatibleMode(TRK_IMPULSETRACKER)) { - // FT2 compatibility: Retrigger is reset in RetrigNote + // FT2 compatibility: Retrigger is reset in RetrigNote, tremor in ProcessEffects if(!IsCompatibleMode(TRK_FASTTRACKER2)) { pChn->nRetrigCount = 0; pChn->nTremorCount = 0; - } else - { - // FT2 Compatibility: Weird XM tremor. - // Test case: Tremor.xm - pChn->nTremorCount = 0x20; } } @@ -1845,7 +1840,6 @@ reloadSampleSettings = true; } } - } if((retrigEnv && !IsCompatibleMode(TRK_FASTTRACKER2)) || reloadSampleSettings) @@ -1869,19 +1863,19 @@ { // Also reload panning pChn->nPan = oldSample->nPan; - - // FT2 compatibility: Instrument number disables tremor effect - // Test case: TremorRecover.xm - if(IsCompatibleMode(TRK_FASTTRACKER2)) - { - pChn->nTremorCount &= ~0x80; - } } } } - if (retrigEnv) //Case: instrument with no note data. + // FT2 compatibility: Instrument number disables tremor effect + // Test case: TremorInstr.xm, TremoRecover.xm + if(IsCompatibleMode(TRK_FASTTRACKER2) && instr != 0) { + pChn->nTremorCount = 0x20; + } + + if(retrigEnv) //Case: instrument with no note data. + { //IT compatibility: Instrument with no note. if(IsCompatibleMode(TRK_IMPULSETRACKER) || m_SongFlags[SONG_PT1XMODE]) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-05-21 21:19:04
|
Revision: 2165 http://sourceforge.net/p/modplug/code/2165 Author: saga-games Date: 2013-05-21 21:18:58 +0000 (Tue, 21 May 2013) Log Message: ----------- [Fix] FT2 compatibility: Also limit period values to 16-bit in Amiga slide mode (not 100% precise yet as it seems, but uh, "close enough", I guess.) Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-05-21 21:18:34 UTC (rev 2164) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-05-21 21:18:58 UTC (rev 2165) @@ -4691,17 +4691,23 @@ return ((3546895L * 4) << FREQ_FRACBITS) / period; } else if (GetType() == MOD_TYPE_XM) { + if(IsCompatibleMode(TRK_FASTTRACKER2)) + { + // FT2 compatibility: Period is a 16-bit value in FT2, and it overflows happily. + // Test case: FreqWraparound.xm + period &= 0xFFFF; + } if(m_SongFlags[SONG_LINEARSLIDES]) { uint32 octave = period / 768; if(IsCompatibleMode(TRK_FASTTRACKER2)) { // Under normal circumstances, this calculation returns the same values as the non-compatible one. - // However, once the 12 octaves are exceeded (through portamento slides), FT2 wraps the frequency around... + // However, once the 12 octaves are exceeded (through portamento slides), the octave shift goes + // crazy in FT2, meaning that the frequency wraps around randomly... // Test case: FreqWraparound.xm // 12 octaves * (12 * 64) LUT entries = 9216, add 767 for rounding - // Period is a 16 bit value in FT2, hence the "& 0xFFFF". - uint32 div = ((9216u + 767u - (period & 0xFFFF)) / 768); + uint32 div = ((9216u + 767u - period) / 768); octave = ((12 - div) & 0x1F) % 29u; } return (XMLinearTable[period % 768] << FREQ_FRACBITS) >> octave; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-07-01 21:56:34
|
Revision: 2475 http://sourceforge.net/p/modplug/code/2475 Author: saga-games Date: 2013-07-01 21:56:27 +0000 (Mon, 01 Jul 2013) Log Message: ----------- [Fix] PTM Nxx wasn't working quite correctly with looped samples. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-07-01 21:49:02 UTC (rev 2474) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-07-01 21:56:27 UTC (rev 2475) @@ -2630,7 +2630,8 @@ { pChn->dwFlags.set(CHN_PINGPONGFLAG); pChn->dwFlags.reset(CHN_LOOP); - pChn->nPos = (pChn->pModSample->nLength - 1) - std::min<SmpLength>(SmpLength(pChn->rowCommand.param) << 8, pChn->pModSample->nLength); + pChn->nLength = pChn->pModSample->nLength; // If there was a loop, extend sample to whole length. + pChn->nPos = (pChn->nLength - 1) - std::min<SmpLength>(SmpLength(pChn->rowCommand.param) << 8, pChn->nLength - 1); pChn->nPosLo = 0; } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-01-04 15:57:15
|
Revision: 3555 http://sourceforge.net/p/modplug/code/3555 Author: saga-games Date: 2014-01-04 15:57:09 +0000 (Sat, 04 Jan 2014) Log Message: ----------- [Fix] DBM (libopenmpt only): Tone Portamento is applied on all ticks in DigiBoosterPro. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-01-04 07:39:11 UTC (rev 3554) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-01-04 15:57:09 UTC (rev 3555) @@ -818,9 +818,9 @@ resetAlways = (!pChn->nFadeOutVol || instrumentChanged || pChn->dwFlags[CHN_KEYOFF]); } else { - reset = (!bPorta || !(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) || m_SongFlags[SONG_ITCOMPATGXX] + reset = (!bPorta || !(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_DBM)) || m_SongFlags[SONG_ITCOMPATGXX] || !pChn->nLength || (pChn->dwFlags[CHN_NOTEFADE] && !pChn->nFadeOutVol)); - resetAlways = !(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) || instrumentChanged || pIns == nullptr || pChn->dwFlags[CHN_KEYOFF | CHN_NOTEFADE]; + resetAlways = !(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_DBM)) || instrumentChanged || pIns == nullptr || pChn->dwFlags[CHN_KEYOFF | CHN_NOTEFADE]; } if(reset) @@ -1163,11 +1163,11 @@ } if (!bPorta - || (!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) + || (!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_DBM))) || (pChn->dwFlags[CHN_NOTEFADE] && !pChn->nFadeOutVol) || (m_SongFlags[SONG_ITCOMPATGXX] && pChn->rowCommand.instr != 0)) { - if((GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) && pChn->dwFlags[CHN_NOTEFADE] && !pChn->nFadeOutVol) + if((GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_DBM)) && pChn->dwFlags[CHN_NOTEFADE] && !pChn->nFadeOutVol) { pChn->ResetEnvelopes(); // IT Compatibility: Autovibrato reset @@ -1227,39 +1227,36 @@ if(!pIns->PanEnv.dwFlags[ENV_CARRY]) pChn->PanEnv.Reset(); if(!pIns->PitchEnv.dwFlags[ENV_CARRY]) pChn->PitchEnv.Reset(); - if(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) + // Volume Swing + if(pIns->nVolSwing) { - // Volume Swing - if(pIns->nVolSwing) + const double delta = 2 * (((double) rand()) / RAND_MAX) - 1; + pChn->nVolSwing = static_cast<int32>(std::floor(delta * (IsCompatibleMode(TRK_IMPULSETRACKER) ? pChn->nInsVol : ((pChn->nVolume + 1) / 2)) * pIns->nVolSwing / 100.0)); + } + // Pan Swing + if(pIns->nPanSwing) + { + const double delta = 2 * (((double) rand()) / RAND_MAX) - 1; + pChn->nPanSwing = static_cast<int32>(std::floor(delta * (IsCompatibleMode(TRK_IMPULSETRACKER) ? 4 : 1) * pIns->nPanSwing)); + if(!IsCompatibleMode(TRK_IMPULSETRACKER)) { - const double delta = 2 * (((double) rand()) / RAND_MAX) - 1; - pChn->nVolSwing = static_cast<int32>(std::floor(delta * (IsCompatibleMode(TRK_IMPULSETRACKER) ? pChn->nInsVol : ((pChn->nVolume + 1) / 2)) * pIns->nVolSwing / 100.0)); + pChn->nRestorePanOnNewNote = pChn->nPan + 1; } - // Pan Swing - if(pIns->nPanSwing) - { - const double delta = 2 * (((double) rand()) / RAND_MAX) - 1; - pChn->nPanSwing = static_cast<int32>(std::floor(delta * (IsCompatibleMode(TRK_IMPULSETRACKER) ? 4 : 1) * pIns->nPanSwing)); - if(!IsCompatibleMode(TRK_IMPULSETRACKER)) - { - pChn->nRestorePanOnNewNote = pChn->nPan + 1; - } - } - // Cutoff Swing - if(pIns->nCutSwing) - { - int32 d = ((int32)pIns->nCutSwing * (int32)((rand() & 0xFF) - 0x7F)) / 128; - pChn->nCutSwing = (int16)((d * pChn->nCutOff + 1) / 128); - pChn->nRestoreCutoffOnNewNote = pChn->nCutOff + 1; - } - // Resonance Swing - if(pIns->nResSwing) - { - int32 d = ((int32)pIns->nResSwing * (int32)((rand() & 0xFF) - 0x7F)) / 128; - pChn->nResSwing = (int16)((d * pChn->nResonance + 1) / 128); - pChn->nRestoreResonanceOnNewNote = pChn->nResonance + 1; - } } + // Cutoff Swing + if(pIns->nCutSwing) + { + int32 d = ((int32)pIns->nCutSwing * (int32)((rand() & 0xFF) - 0x7F)) / 128; + pChn->nCutSwing = (int16)((d * pChn->nCutOff + 1) / 128); + pChn->nRestoreCutoffOnNewNote = pChn->nCutOff + 1; + } + // Resonance Swing + if(pIns->nResSwing) + { + int32 d = ((int32)pIns->nResSwing * (int32)((rand() & 0xFF) - 0x7F)) / 128; + pChn->nResSwing = (int16)((d * pChn->nResonance + 1) / 128); + pChn->nRestoreResonanceOnNewNote = pChn->nResonance + 1; + } } pChn->nAutoVibDepth = 0; pChn->nAutoVibPos = 0; @@ -3120,7 +3117,7 @@ } //End candidate MPT behavior. if(param) pChn->nPortamentoSlide = param * 4; - if(pChn->nPeriod && pChn->nPortamentoDest && !pChn->isFirstTick) + if(pChn->nPeriod && pChn->nPortamentoDest && (!pChn->isFirstTick || GetType() == MOD_TYPE_DBM)) { if (pChn->nPeriod < pChn->nPortamentoDest) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-01-25 14:41:24
|
Revision: 3585 http://sourceforge.net/p/modplug/code/3585 Author: saga-games Date: 2014-01-25 14:41:14 +0000 (Sat, 25 Jan 2014) Log Message: ----------- [Fix] XM Compatibility: FT2 actually set the panning envelope position if the volume envelope's sustain flag is set (test case: SetEnvPos.xm) Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-01-20 21:45:44 UTC (rev 3584) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-01-25 14:41:14 UTC (rev 3585) @@ -2563,19 +2563,12 @@ { pChn->VolEnv.nEnvPosition = param; - // FT2 compatibility: FT2 only sets the position of the Volume envelope - if(!IsCompatibleMode(TRK_FASTTRACKER2)) + // FT2 compatibility: FT2 only sets the position of the panning envelope if the volume envelope's sustain flag is set + // Test case: SetEnvPos.xm + if(!IsCompatibleMode(TRK_FASTTRACKER2) || pChn->VolEnv.flags[ENV_SUSTAIN]) { pChn->PanEnv.nEnvPosition = param; pChn->PitchEnv.nEnvPosition = param; - if (pChn->pModInstrument) - { - ModInstrument *pIns = pChn->pModInstrument; - if(pChn->PanEnv.flags[ENV_ENABLED] && pIns->PanEnv.nNodes && param > pIns->PanEnv.Ticks[pIns->PanEnv.nNodes - 1]) - { - pChn->PanEnv.flags.reset(ENV_ENABLED); - } - } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-06 14:33:30
|
Revision: 3667 http://sourceforge.net/p/modplug/code/3667 Author: saga-games Date: 2014-02-06 14:33:21 +0000 (Thu, 06 Feb 2014) Log Message: ----------- [Fix] FT2 compatibility: Fix portamento + note delay + no instrument number Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-02-05 22:55:53 UTC (rev 3666) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-02-06 14:33:21 UTC (rev 3667) @@ -2102,10 +2102,10 @@ bool doVolumeColumn = m_nTickCount >= nStartTick; // FT2 compatibility: If there's a note delay, volume column effects are NOT executed // on the first tick and, if there's an instrument number, on the delayed tick. - // Test case: VolColDelay.xm + // Test case: VolColDelay.xm, PortaDelay.xm if(IsCompatibleMode(TRK_FASTTRACKER2) && nStartTick != 0) { - doVolumeColumn = m_nTickCount != 0 && (m_nTickCount != nStartTick || pChn->rowCommand.instr == 0); + doVolumeColumn = m_nTickCount != 0 && (m_nTickCount != nStartTick || (pChn->rowCommand.instr == 0 && volcmd != VOLCMD_TONEPORTAMENTO)); } if(volcmd > VOLCMD_PANNING && doVolumeColumn) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-02-28 11:33:26
|
Revision: 3790 http://sourceforge.net/p/modplug/code/3790 Author: manxorist Date: 2014-02-28 11:33:17 +0000 (Fri, 28 Feb 2014) Log Message: ----------- [Ref] Silence operator precedence warning. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-02-28 11:28:53 UTC (rev 3789) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-02-28 11:33:17 UTC (rev 3790) @@ -594,10 +594,10 @@ } if(p->note == NOTE_KEYOFF || p->note == NOTE_NOTECUT || (p->note == NOTE_FADE && GetNumInstruments()) || pChn->dwFlags[CHN_PINGPONGFLAG] // Ping-pong loops are not supported for now. - || p->command != CMD_NONE && // Sample stop commands. + || (p->command != CMD_NONE && // Sample stop commands. (((p->command == CMD_MODCMDEX || p->command == CMD_S3MCMDEX) && (p->param & 0xF0) == 0xC0 && paramLo < numTicks) || (p->command == CMD_DELAYCUT && (p->command & 0x0F) != 0 && startTick + paramLo < numTicks) - || p->command == CMD_TONEPORTAMENTO || p->command == CMD_TONEPORTAVOL || p->command == CMD_PORTAMENTOUP || p->command == CMD_PORTAMENTODOWN) + || p->command == CMD_TONEPORTAMENTO || p->command == CMD_TONEPORTAVOL || p->command == CMD_PORTAMENTOUP || p->command == CMD_PORTAMENTODOWN)) || p->volcmd == VOLCMD_TONEPORTAMENTO || p->volcmd == VOLCMD_PORTAUP || p->volcmd == VOLCMD_PORTADOWN) { // Stop channel. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-02-28 13:38:45
|
Revision: 3794 http://sourceforge.net/p/modplug/code/3794 Author: saga-games Date: 2014-02-28 13:38:39 +0000 (Fri, 28 Feb 2014) Log Message: ----------- [Fix] Delay cut note delay was decoded wrong in sample sync code. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-02-28 13:22:16 UTC (rev 3793) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-02-28 13:38:39 UTC (rev 3794) @@ -579,10 +579,10 @@ if((p->command == CMD_MODCMDEX || p->command == CMD_S3MCMDEX) && (p->param & 0xF0) == 0xD0 && paramLo < numTicks) { - startTick = p->param & 0x0F; + startTick = paramLo; } else if(p->command == CMD_DELAYCUT && paramHi < numTicks) { - startTick = p->param >> 4; + startTick = paramHi; } else if(p->command == CMD_OFFSET && p->IsNote()) { // TODO: xParam not supported! (Note: xParam doesn't use hiOffset) @@ -596,7 +596,7 @@ || pChn->dwFlags[CHN_PINGPONGFLAG] // Ping-pong loops are not supported for now. || (p->command != CMD_NONE && // Sample stop commands. (((p->command == CMD_MODCMDEX || p->command == CMD_S3MCMDEX) && (p->param & 0xF0) == 0xC0 && paramLo < numTicks) - || (p->command == CMD_DELAYCUT && (p->command & 0x0F) != 0 && startTick + paramLo < numTicks) + || (p->command == CMD_DELAYCUT && paramHi != 0 && startTick + paramLo < numTicks) || p->command == CMD_TONEPORTAMENTO || p->command == CMD_TONEPORTAVOL || p->command == CMD_PORTAMENTOUP || p->command == CMD_PORTAMENTODOWN)) || p->volcmd == VOLCMD_TONEPORTAMENTO || p->volcmd == VOLCMD_PORTAUP || p->volcmd == VOLCMD_PORTADOWN) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-09-01 22:51:36
|
Revision: 4232 http://sourceforge.net/p/modplug/code/4232 Author: saga-games Date: 2014-09-01 22:51:21 +0000 (Mon, 01 Sep 2014) Log Message: ----------- [Fix] ProTracker compatiblity: Further refine 9xx behaviour so that the outro in faggot's universe by dee-lite is played correctly Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-09-01 17:05:41 UTC (rev 4231) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-09-01 22:51:21 UTC (rev 4232) @@ -596,6 +596,7 @@ 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 = patternLoopStartedOnThisRow; // It's too much trouble to keep those pattern loops in sync... + if(p->instr) pChn->proTrackerOffset = 0; if(p->IsNote()) { pChn->nNewNote = pChn->nLastNote; @@ -949,10 +950,9 @@ if(pSmp) { pChn->nVolume = pSmp->nVolume; - } else + } else if(pIns && pIns->nMixPlug) { - if(pIns && pIns->nMixPlug) - pChn->nVolume = pChn->GetVSTVolume(); + pChn->nVolume = pChn->GetVSTVolume(); } } @@ -1340,7 +1340,7 @@ { pChn->proTrackerOffset = 0; } - pChn->dwFlags = (pChn->dwFlags & CHN_CHANNELFLAGS) | (static_cast<ChannelFlags>(pSmp->uFlags) & CHN_SAMPLEFLAGS); + pChn->dwFlags = (pChn->dwFlags & CHN_CHANNELFLAGS) | (pSmp->uFlags & CHN_SAMPLEFLAGS); if(pChn->dwFlags[CHN_SUSTAINLOOP]) { pChn->nLoopStart = pSmp->nSustainStart; @@ -2018,11 +2018,17 @@ bPorta = false; } - // ProTracker compatibility: Instrument change always happens on the first tick, even when there is a note delay. - // Test case: InstrDelay.mod - if(instr && !m_PlayState.m_nTickCount && !triggerNote && m_SongFlags[SONG_PT1XMODE]) + if(m_SongFlags[SONG_PT1XMODE] && instr && !m_PlayState.m_nTickCount) { - InstrumentChange(pChn, instr, true, true, false); + // Instrument number resets the stacked ProTracker offset. + // Test case: ptoffset.mod + pChn->proTrackerOffset = 0; + // ProTracker compatibility: Instrument change always happens on the first tick, even when there is a note delay. + // Test case: InstrDelay.mod + if(!triggerNote) + { + InstrumentChange(pChn, instr, true, true, false); + } } // Handles note/instrument/volume changes @@ -4417,7 +4423,6 @@ } // -! NEW_FEATURE#0010 - if(pChn->rowCommand.instr) pChn->proTrackerOffset = 0; pChn->proTrackerOffset += param; if(pChn->rowCommand.IsNote()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-10-29 20:27:50
|
Revision: 4518 http://sourceforge.net/p/modplug/code/4518 Author: manxorist Date: 2014-10-29 20:27:35 +0000 (Wed, 29 Oct 2014) Log Message: ----------- [Fix] Silence clang 3.5 warning: "warning: absolute value function 'abs' given an argument of type 'const long' but has parameter of type 'int' which may cause truncation of value. note: use function 'std::abs' instead.". Use int32 instead of long here as it is a better fitting type anyway. Additionally, use std::abs instead of abs here, as suggested by clang. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-10-29 12:50:29 UTC (rev 4517) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-10-29 20:27:35 UTC (rev 4518) @@ -3312,7 +3312,7 @@ { //Behavior: Param tells number of finesteps(or 'fullsteps'(notes) with glissando) //to slide per row(not per tick). - const long old_PortamentoTickSlide = (m_PlayState.m_nTickCount != 0) ? pChn->m_PortamentoTickSlide : 0; + const int32 old_PortamentoTickSlide = (m_PlayState.m_nTickCount != 0) ? pChn->m_PortamentoTickSlide : 0; if(param) pChn->nPortamentoSlide = param; @@ -3333,9 +3333,9 @@ //With glissando interpreting param as notes instead of finesteps. } - const long slide = pChn->m_PortamentoTickSlide - old_PortamentoTickSlide; + const int32 slide = pChn->m_PortamentoTickSlide - old_PortamentoTickSlide; - if(abs(pChn->nPortamentoDest) <= abs(slide)) + if(std::abs(pChn->nPortamentoDest) <= std::abs(slide)) { if(pChn->nPortamentoDest != 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-11-08 00:26:23
|
Revision: 4559 http://sourceforge.net/p/modplug/code/4559 Author: saga-games Date: 2014-11-08 00:26:16 +0000 (Sat, 08 Nov 2014) Log Message: ----------- [Fix] Tone portamento flag was no longer reset. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-11-07 21:13:10 UTC (rev 4558) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-11-08 00:26:16 UTC (rev 4559) @@ -1351,6 +1351,7 @@ pChn->proTrackerOffset = 0; } pChn->dwFlags = (pChn->dwFlags & CHN_CHANNELFLAGS) | (pSmp->uFlags & (CHN_SAMPLEFLAGS | CHN_SURROUND)); + pChn->dwFlags.reset(CHN_PORTAMENTO); if(pChn->dwFlags[CHN_SUSTAINLOOP]) { pChn->nLoopStart = pSmp->nSustainStart; @@ -4711,7 +4712,7 @@ // instro sends to a midi chan if (pIns && pIns->HasValidMIDIChannel()) { - UINT nPlug = pIns->nMixPlug; + PLUGINDEX nPlug = pIns->nMixPlug; if ((nPlug) && (nPlug <= MAX_MIXPLUGINS)) { IMixPlugin *pPlug = (IMixPlugin*)m_MixPlugins[nPlug-1].pMixPlugin; @@ -4942,7 +4943,7 @@ UINT CSoundFile::GetNoteFromPeriod(UINT period, int nFineTune, UINT nC5Speed) const //--------------------------------------------------------------------------------- { - if (!period) return 0; + if(!period) return 0; if(IsCompatibleMode(TRK_FASTTRACKER2)) { // FT2's "RelocateTon" function actually rounds up and down, while GetNoteFromPeriod normally just truncates. @@ -5132,7 +5133,7 @@ PLUGINDEX CSoundFile::GetChannelPlugin(CHANNELINDEX nChn, PluginMutePriority respectMutes) const -//------------------------------------------------------------------------------------------------------ +//---------------------------------------------------------------------------------------------- { const ModChannel &channel = m_PlayState.Chn[nChn]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-01-30 21:54:07
|
Revision: 4736 http://sourceforge.net/p/modplug/code/4736 Author: saga-games Date: 2015-01-30 21:53:54 +0000 (Fri, 30 Jan 2015) Log Message: ----------- [Fix] Off-by-one error in very small fine portamentos. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-01-29 10:53:27 UTC (rev 4735) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-01-30 21:53:54 UTC (rev 4736) @@ -3187,10 +3187,7 @@ { int oldPeriod = pChn->nPeriod; pChn->nPeriod = Util::muldivr(pChn->nPeriod, LinearSlideUpTable[param & 0x0F], 65536); - if(oldPeriod == pChn->nPeriod) - { - pChn->nPeriod--; - } + if(oldPeriod == pChn->nPeriod) pChn->nPeriod++; } else { pChn->nPeriod -= (int)(param * 4); @@ -3222,10 +3219,7 @@ { int oldPeriod = pChn->nPeriod; pChn->nPeriod = Util::muldivr(pChn->nPeriod, LinearSlideDownTable[param & 0x0F], 65536); - if(oldPeriod == pChn->nPeriod) - { - pChn->nPeriod--; - } + if(oldPeriod == pChn->nPeriod) pChn->nPeriod--; } else { pChn->nPeriod += (int)(param * 4); @@ -3257,10 +3251,7 @@ { int oldPeriod = pChn->nPeriod; pChn->nPeriod = Util::muldivr(pChn->nPeriod, FineLinearSlideUpTable[param & 0x0F], 65536); - if(oldPeriod == pChn->nPeriod) - { - pChn->nPeriod++; - } + if(oldPeriod == pChn->nPeriod) pChn->nPeriod++; } else { pChn->nPeriod -= (int)(param); @@ -3292,10 +3283,7 @@ { int oldPeriod = pChn->nPeriod; pChn->nPeriod = Util::muldivr(pChn->nPeriod, FineLinearSlideDownTable[param & 0x0F], 65536); - if(oldPeriod == pChn->nPeriod) - { - pChn->nPeriod--; - } + if(oldPeriod == pChn->nPeriod) pChn->nPeriod--; } else { pChn->nPeriod += (int)(param); @@ -4700,11 +4688,11 @@ void CSoundFile::DoFreqSlide(ModChannel *pChn, LONG nFreqSlide) const //------------------------------------------------------------------- { - // IT Linear slides if (!pChn->nPeriod) return; if(m_SongFlags[SONG_LINEARSLIDES] && GetType() != MOD_TYPE_XM) { - int32 nOldPeriod = pChn->nPeriod; + // IT Linear slides + const int32_t nOldPeriod = pChn->nPeriod; if (nFreqSlide < 0) { UINT n = (-nFreqSlide) / 4; @@ -4712,7 +4700,7 @@ { if (n > 255) n = 255; pChn->nPeriod = Util::muldivr(pChn->nPeriod, LinearSlideUpTable[n], 65536); - if (pChn->nPeriod == nOldPeriod) pChn->nPeriod = nOldPeriod + 1; + if (pChn->nPeriod == nOldPeriod) pChn->nPeriod++; } } else { @@ -4721,7 +4709,7 @@ { if (n > 255) n = 255; pChn->nPeriod = Util::muldivr(pChn->nPeriod, LinearSlideDownTable[n], 65536); - if (pChn->nPeriod == nOldPeriod) pChn->nPeriod = nOldPeriod - 1; + if (pChn->nPeriod == nOldPeriod) pChn->nPeriod--; } } } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2015-03-19 15:38:39
|
Revision: 4900 http://sourceforge.net/p/modplug/code/4900 Author: saga-games Date: 2015-03-19 15:38:34 +0000 (Thu, 19 Mar 2015) Log Message: ----------- [Imp] More performance improvements to sample seeking. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-19 10:44:07 UTC (rev 4899) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-03-19 15:38:34 UTC (rev 4900) @@ -101,6 +101,8 @@ return; } + const SmpLength sampleEnd = chn.dwFlags[CHN_LOOP] ? chn.nLoopEnd : chn.nLength; + const SmpLength loopLength = chn.nLoopEnd - chn.nLoopStart; bool stopNote = false; for(uint32 i = 0; i < numTicks; i++) { @@ -141,36 +143,40 @@ chn.nPosLo += inc * tickDuration; chn.nPos += ((int32)chn.nPosLo >> 16); chn.nPosLo &= 0xFFFF; - } - if(chn.pModSample->uFlags[CHN_SUSTAINLOOP | CHN_LOOP]) - { - // Check if we exceeded the sample loop. - if(chn.dwFlags[CHN_PINGPONGLOOP] && chn.nPos >= chn.nLoopEnd) + + if(chn.nPos >= sampleEnd) { - // Ping-pong loops are not supported for now. - stopNote = true; - } else - { - const SmpLength loopLength = chn.nLoopEnd - chn.nLoopStart; - if(chn.nPos >= chn.nLoopEnd + loopLength) + if(chn.dwFlags[CHN_LOOP]) { - const SmpLength overshoot = chn.nPos - chn.nLoopEnd; - chn.nPos -= (overshoot / loopLength) * loopLength; - } - while(chn.nPos >= chn.nLoopEnd) + // We exceeded the sample loop, go back to loop start. + if(chn.dwFlags[CHN_PINGPONGLOOP]) + { + // Ping-pong loops are not supported for now. + stopNote = true; + break; + } else + { + if(chn.nPos >= chn.nLoopEnd + loopLength) + { + const SmpLength overshoot = chn.nPos - chn.nLoopEnd; + chn.nPos -= (overshoot / loopLength) * loopLength; + } + while(chn.nPos >= chn.nLoopEnd) + { + chn.nPos -= loopLength; + } + } + } else { - chn.nPos -= loopLength; + // Past sample end. + stopNote = true; + break; } } - } else if(chn.nPos >= chn.nLength) - { - // Past sample end. - stopNote = true; } if(stopNote) { - // Stop channel. chn.Stop(); } chnSettings[channel].ticksToRender = 0; @@ -206,26 +212,26 @@ memory.state.m_nNextOrder = memory.state.m_nCurrentOrder = target.startOrder; // Optimize away channels for which it's pointless to adjust sample positions - if(adjustSamplePos && target.mode == GetLengthTarget::SeekPosition) + if(adjustSamplePos) { - PATTERNINDEX seekPat = PATTERNINDEX_INVALID; - if(target.pos.order < orderList.GetLength()) seekPat = orderList[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]) + if(ChnSettings[i].dwFlags[CHN_MUTE]) memory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL; + } + if(target.mode == GetLengthTarget::SeekPosition && target.pos.order < orderList.GetLength()) + { + // If we know where to seek, we can directly rule out any channels on which a new note would be triggered right at the start. + const PATTERNINDEX seekPat = orderList[target.pos.order]; + if(Patterns.IsValidPat(seekPat) && Patterns[seekPat].IsValidRow(target.pos.row)) { - memory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL; - continue; - } - if(seekPat != PATTERNINDEX_INVALID) - { - const 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.IsPortamento())) + const ModCommand *m = Patterns[seekPat].GetRow(target.pos.row); + for(CHANNELINDEX i = 0; i < GetNumChannels(); i++, m++) { - memory.chnSettings[i].ticksToRender = GetLengthMemory::IGNORE_CHANNEL; + if(m->note == NOTE_NOTECUT || m->note == NOTE_KEYOFF || (m->note == NOTE_FADE && GetNumInstruments()) + || (m->IsNote() && !m->IsPortamento())) + { + memory.chnSettings[i].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-06-13 00:42:26
|
Revision: 5296 http://sourceforge.net/p/modplug/code/5296 Author: saga-games Date: 2015-06-13 00:42:19 +0000 (Sat, 13 Jun 2015) Log Message: ----------- [Fix] Playback timer was not updated properly when jumping around in a module containing pattern loops. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-06-12 23:53:08 UTC (rev 5295) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2015-06-13 00:42:19 UTC (rev 5296) @@ -50,6 +50,7 @@ struct ChnSettings { double patLoop; + CSoundFile::samplecount_t patLoopSmp; ROWINDEX patLoopStart; uint32 ticksToRender; // When using sample sync, we still need to render this many ticks bool incChanged; // When using sample sync, note frequency has changed @@ -58,6 +59,7 @@ void Reset() { patLoop = 0.0; + patLoopSmp = 0; patLoopStart = 0; vol = 0xFF; } @@ -396,7 +398,10 @@ if(!memory.state.m_nRow) { for(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++) + { memory.chnSettings[chn].patLoop = memory.elapsedTime; + memory.chnSettings[chn].patLoopSmp = memory.state.m_lTotalSampleCount; + } } ModChannel *pChn = memory.state.Chn; @@ -588,6 +593,7 @@ for(CHANNELINDEX c = firstChn; c <= lastChn; c++) { memory.chnSettings[c].patLoop = memory.elapsedTime; + memory.chnSettings[c].patLoopSmp = memory.state.m_lTotalSampleCount; memory.chnSettings[c].patLoopStart = memory.state.m_nRow; } patternLoopStartedOnThisRow = true; @@ -608,6 +614,7 @@ { patternLoopStartedOnThisRow = true; memory.chnSettings[nChn].patLoop = memory.elapsedTime; + memory.chnSettings[nChn].patLoopSmp = memory.state.m_lTotalSampleCount; memory.chnSettings[nChn].patLoopStart = memory.state.m_nRow; } } @@ -945,6 +952,14 @@ for(std::map<double, int>::iterator i = startTimes.begin(); i != startTimes.end(); i++) { memory.elapsedTime += (memory.elapsedTime - i->first) * (double)(i->second - 1); + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++, pChn++) + { + if(memory.chnSettings[nChn].patLoop == i->first) + { + memory.state.m_lTotalSampleCount += (memory.state.m_lTotalSampleCount - memory.chnSettings[nChn].patLoopSmp) * (i->second - 1); + break; + } + } } if(GetType() == MOD_TYPE_IT) { @@ -954,6 +969,7 @@ if((pChn->rowCommand.command == CMD_S3MCMDEX && pChn->rowCommand.param >= 0xB1 && pChn->rowCommand.param <= 0xBF)) { memory.chnSettings[nChn].patLoop = memory.elapsedTime; + memory.chnSettings[nChn].patLoopSmp = memory.state.m_lTotalSampleCount; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-08-22 19:39:32
|
Revision: 995 http://modplug.svn.sourceforge.net/modplug/?rev=995&view=rev Author: saga-games Date: 2011-08-22 19:39:26 +0000 (Mon, 22 Aug 2011) Log Message: ----------- [Fix] Controlling plugin parameters 128 through 131 was broken since probably forever. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-08-22 19:33:24 UTC (rev 994) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-08-22 19:39:26 UTC (rev 995) @@ -3275,121 +3275,113 @@ const uint8 macroCode = macro[2]; const uint8 param = macro[3]; - switch(macroCode) + if(macroCode == 0x00 && !isExtended) { - // F0.F0.00.xx: Set CutOff - case 0x00: - if(!isExtended) + // F0.F0.00.xx: Set CutOff + int oldcutoff = pChn->nCutOff; + if(param < 0x80) { - int oldcutoff = pChn->nCutOff; - if(param < 0x80) + if(!isSmooth) { - if(!isSmooth) - { - pChn->nCutOff = param; - } else - { - pChn->nCutOff = (BYTE)CalculateSmoothParamChange((float)pChn->nCutOff, (float)param); - } - pChn->nRestoreCutoffOnNewNote = 0; + pChn->nCutOff = param; + } else + { + pChn->nCutOff = (BYTE)CalculateSmoothParamChange((float)pChn->nCutOff, (float)param); } + pChn->nRestoreCutoffOnNewNote = 0; + } #ifndef NO_FILTER - oldcutoff -= pChn->nCutOff; - if(oldcutoff < 0) oldcutoff = -oldcutoff; - if((pChn->nVolume > 0) || (oldcutoff < 0x10) - || (!(pChn->dwFlags & CHN_FILTER)) || (!(pChn->nLeftVol|pChn->nRightVol))) - SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true); + oldcutoff -= pChn->nCutOff; + if(oldcutoff < 0) oldcutoff = -oldcutoff; + if((pChn->nVolume > 0) || (oldcutoff < 0x10) + || (!(pChn->dwFlags & CHN_FILTER)) || (!(pChn->nLeftVol|pChn->nRightVol))) + SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true); #endif // NO_FILTER - return 4; - } - break; - // F0.F0.01.xx: Set Resonance - case 0x01: - if(!isExtended) + return 4; + + } else if(macroCode == 0x01 && !isExtended) + { + // F0.F0.01.xx: Set Resonance + if(param < 0x80) { - if(param < 0x80) + pChn->nRestoreResonanceOnNewNote = 0; + if(!isSmooth) { - pChn->nRestoreResonanceOnNewNote = 0; - if(!isSmooth) - { - pChn->nResonance = param; - } else - { - pChn->nResonance = (BYTE)CalculateSmoothParamChange((float)pChn->nResonance, (float)param); - } + pChn->nResonance = param; + } else + { + pChn->nResonance = (BYTE)CalculateSmoothParamChange((float)pChn->nResonance, (float)param); } + } #ifndef NO_FILTER + SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true); +#endif // NO_FILTER + + return 4; + + } else if(macroCode == 0x02 && !isExtended) + { + // F0.F0.02.xx: Set filter mode (high nibble determines filter mode) + if(param < 0x20) + { + pChn->nFilterMode = (param >> 4); +#ifndef NO_FILTER SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true); #endif // NO_FILTER - return 4; } - break; - // F0.F0.02.xx: Set filter mode (high nibble determines filter mode) - case 0x02: - if(!isExtended) + return 4; + + } else if(macroCode == 0x03 && !isExtended) + { + // F0.F0.03.xx: Set plug dry/wet + const PLUGINDEX nPlug = (plugin != 0) ? plugin : GetBestPlugin(nChn, PRIORITISE_CHANNEL, EVEN_IF_MUTED); + if ((nPlug) && (nPlug <= MAX_MIXPLUGINS) && param < 0x80) { - if(param < 0x20) + const float newRatio = 1.0 - (static_cast<float>(param & 0x7F) / 127.0f); + if(!isSmooth) { - pChn->nFilterMode = (param >> 4); -#ifndef NO_FILTER - SetupChannelFilter(pChn, (pChn->dwFlags & CHN_FILTER) ? false : true); -#endif // NO_FILTER + m_MixPlugins[nPlug - 1].fDryRatio = newRatio; + } else + { + m_MixPlugins[nPlug - 1].fDryRatio = CalculateSmoothParamChange(m_MixPlugins[nPlug - 1].fDryRatio, newRatio); } - return 4; } - break; - // F0.F0.03.xx: Set plug dry/wet - case 0x03: - if(!isExtended) + return 4; + + } else if((macroCode & 0x80) || isExtended) + { + // F0.F0.{80|n}.xx / F0.F1.n.xx: Set VST effect parameter n to xx + const PLUGINDEX nPlug = (plugin != 0) ? plugin : GetBestPlugin(nChn, PRIORITISE_CHANNEL, EVEN_IF_MUTED); + const UINT plugParam = isExtended ? (0x80 + macroCode) : (macroCode & 0x7F); + if((nPlug) && (nPlug <= MAX_MIXPLUGINS)) { - const PLUGINDEX nPlug = (plugin != 0) ? plugin : GetBestPlugin(nChn, PRIORITISE_CHANNEL, EVEN_IF_MUTED); - if ((nPlug) && (nPlug <= MAX_MIXPLUGINS) && param < 0x80) + IMixPlugin *pPlugin = m_MixPlugins[nPlug - 1].pMixPlugin; + if((pPlugin) && (m_MixPlugins[nPlug - 1].pMixState) && (param < 0x80)) { - const float newRatio = 1.0 - (static_cast<float>(param) / 127.0f); if(!isSmooth) { - m_MixPlugins[nPlug - 1].fDryRatio = newRatio; + pPlugin->SetZxxParameter(plugParam, param & 0x7F); } else { - m_MixPlugins[nPlug - 1].fDryRatio = CalculateSmoothParamChange(m_MixPlugins[nPlug - 1].fDryRatio, newRatio); + pPlugin->SetZxxParameter(plugParam, (UINT)CalculateSmoothParamChange((float)pPlugin->GetZxxParameter(plugParam), (float)(param & 0x7F))); } } - return 4; } - break; - // F0.F0.{80|n}.xx / F0.F1.n.xx: Set VST effect parameter n to xx - default: - if((macroCode & 0x80) || isExtended) - { - const PLUGINDEX nPlug = (plugin != 0) ? plugin : GetBestPlugin(nChn, PRIORITISE_CHANNEL, EVEN_IF_MUTED); - const UINT plugParam = isExtended ? (0x80 + macroCode) : (macroCode & 0x7F); - if((nPlug) && (nPlug <= MAX_MIXPLUGINS)) - { - IMixPlugin *pPlugin = m_MixPlugins[nPlug - 1].pMixPlugin; - if((pPlugin) && (m_MixPlugins[nPlug - 1].pMixState) && (param < 0x80)) - { - if(!isSmooth) - { - pPlugin->SetZxxParameter(plugParam, param); - } else - { - pPlugin->SetZxxParameter(plugParam, (UINT)CalculateSmoothParamChange(pPlugin->GetZxxParameter(plugParam), (float)param)); - } - } - } - return 4; - } - break; + return 4; + } + + // If we reach this point, the internal macro was invalid. + } else { // Not an internal device. Pass on to appropriate plugin. - const UINT nMasterCh = (nChn < GetNumChannels()) ? nChn + 1 : pChn->nMasterChn; + const CHANNELINDEX nMasterCh = (nChn < GetNumChannels()) ? nChn + 1 : pChn->nMasterChn; if((nMasterCh) && (nMasterCh <= GetNumChannels())) { const PLUGINDEX nPlug = (pChn->dwFlags & CHN_NOFX) ? 0 : ((plugin != 0) ? plugin : GetBestPlugin(nChn, PRIORITISE_CHANNEL, EVEN_IF_MUTED)); @@ -3408,9 +3400,13 @@ } } } + return macroLen; + } + return 0; + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-20 00:10:21
|
Revision: 1047 http://modplug.svn.sourceforge.net/modplug/?rev=1047&view=rev Author: saga-games Date: 2011-09-20 00:10:15 +0000 (Tue, 20 Sep 2011) Log Message: ----------- [Fix] IT Compatiblity: Random variation should now be more correct. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-09-19 23:31:30 UTC (rev 1046) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-09-20 00:10:15 UTC (rev 1047) @@ -962,12 +962,12 @@ // IT compatibility: MPT has a weird vol swing algorithm.... if(IsCompatibleMode(TRK_IMPULSETRACKER)) { - double d = 128 * (((double) rand()) / RAND_MAX) - 64; - pChn->nVolSwing = d * pIns->nVolSwing / 100.0; + double d = 2 * (((double) rand()) / RAND_MAX) - 1; + pChn->nVolSwing = std::floor(d * pChn->nInsVol * pIns->nVolSwing / 100.0); } else { int d = ((LONG)pIns->nVolSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128; - pChn->nVolSwing = (signed short)((d * pChn->nVolume + 1)/128); + pChn->nVolSwing = (signed short)((d * pChn->nVolume + 1) / 128); } } // Pan Swing @@ -977,7 +977,7 @@ if(IsCompatibleMode(TRK_IMPULSETRACKER)) { double d = 2 * (((double) rand()) / RAND_MAX) - 1; - pChn->nPanSwing = d * pIns->nPanSwing * 4; + pChn->nPanSwing = std::floor(d * pIns->nPanSwing * 4); } else { int d = ((LONG)pIns->nPanSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-09-28 20:37:45
|
Revision: 1062 http://modplug.svn.sourceforge.net/modplug/?rev=1062&view=rev Author: saga-games Date: 2011-09-28 20:37:39 +0000 (Wed, 28 Sep 2011) Log Message: ----------- [Fix] IT Compatibility: NNAs should be recalled only when there's a note preset, lone instrument numbers shouldn't do that (fixes s7xinsnum.it) Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-09-27 23:34:38 UTC (rev 1061) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-09-28 20:37:39 UTC (rev 1062) @@ -536,18 +536,18 @@ } else { // Original behaviour - if(pIns->NoteMap[note-1] > NOTE_MAX) return; - UINT n = pIns->Keyboard[note-1]; + if(pIns->NoteMap[note - 1] > NOTE_MAX) return; + UINT n = pIns->Keyboard[note - 1]; pSmp = ((n) && (n < MAX_SAMPLES)) ? &Samples[n] : nullptr; } } else - if (m_nInstruments) + if (GetNumInstruments()) { if (note >= NOTE_MIN_SPECIAL) return; pSmp = NULL; } - const bool bNewTuning = (m_nType == MOD_TYPE_MPT && pIns && pIns->pTuning); + const bool bNewTuning = (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 && bNewTuning && pIns == pChn->pModInstrument) @@ -563,7 +563,7 @@ else { // Special XM hack - if ((bPorta) && (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) && (pIns) + if ((bPorta) && (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) && (pIns) && (pChn->pModSample) && (pSmp != pChn->pModSample)) { // FT2 doesn't change the sample in this case, @@ -602,7 +602,8 @@ // Instrument adjust pChn->nNewIns = 0; - if (pIns && (pIns->nMixPlug || pSmp)) //rewbs.VSTiNNA + // IT Compatiblity: NNA is reset on every note change, not every instrument change (fixes s7xinsnum.it). + if (pIns && !IsCompatibleMode(TRK_IMPULSETRACKER) && (pIns->nMixPlug || pSmp)) //rewbs.VSTiNNA pChn->nNNA = pIns->nNNA; if (pSmp) @@ -622,13 +623,13 @@ // Reset envelopes if (bResetEnv) { - if ((!bPorta) || (!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) || (m_dwSongFlags & SONG_ITCOMPATGXX) + if ((!bPorta) || (!(GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) || (m_dwSongFlags & SONG_ITCOMPATGXX) || (!pChn->nLength) || ((pChn->dwFlags & CHN_NOTEFADE) && (!pChn->nFadeOutVol)) //IT compatibility tentative fix: Reset envelopes when instrument changes. || (IsCompatibleMode(TRK_IMPULSETRACKER) && bInstrumentChanged)) { pChn->dwFlags |= CHN_FASTVOLRAMP; - if ((m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT)) && (!bInstrumentChanged) && (pIns) && (!(pChn->dwFlags & (CHN_KEYOFF|CHN_NOTEFADE)))) + if ((GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) && (!bInstrumentChanged) && (pIns) && (!(pChn->dwFlags & (CHN_KEYOFF|CHN_NOTEFADE)))) { if (!(pIns->VolEnv.dwFlags & ENV_CARRY)) ResetChannelEnvelope(pChn->VolEnv); if (!(pIns->PanEnv.dwFlags & ENV_CARRY)) ResetChannelEnvelope(pChn->PanEnv); @@ -665,7 +666,7 @@ // Tone-Portamento doesn't reset the pingpong direction flag if ((bPorta) && (pSmp == pChn->pModSample)) { - if(m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) return; + if(GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) return; pChn->dwFlags &= ~(CHN_KEYOFF|CHN_NOTEFADE); pChn->dwFlags = (pChn->dwFlags & (CHN_CHANNELFLAGS | CHN_PINGPONGFLAG)) | (pSmp->uFlags & CHN_SAMPLEFLAGS); } else @@ -759,7 +760,7 @@ MODSAMPLE *pSmp = pChn->pModSample; MODINSTRUMENT *pIns = pChn->pModInstrument; - const bool bNewTuning = (m_nType == MOD_TYPE_MPT && pIns && pIns->pTuning); + const bool bNewTuning = (GetType() == MOD_TYPE_MPT && pIns != nullptr && pIns->pTuning); // save the note that's actually used, as it's necessary to properly calculate PPS and stuff const int realnote = note; @@ -808,7 +809,7 @@ } } - if ((!bPorta) && (m_nType & (MOD_TYPE_XM|MOD_TYPE_MED|MOD_TYPE_MT2))) + if ((!bPorta) && (GetType() & (MOD_TYPE_XM|MOD_TYPE_MED|MOD_TYPE_MT2))) { if (pSmp) { @@ -826,7 +827,7 @@ return; } - if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MED)) + if (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MED)) { note += pChn->nTranspose; note = CLAMP(note, NOTE_MIN, 131); // why 131? 120+11, how does this make sense? @@ -844,7 +845,7 @@ } pChn->m_CalculateFreq = true; - if ((!bPorta) || (m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT))) + if ((!bPorta) || (GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT))) pChn->nNewIns = 0; UINT period = GetPeriodFromNote(note, pChn->nFineTune, pChn->nC5Speed); @@ -854,7 +855,7 @@ { if ((!bPorta) || (!pChn->nPeriod)) pChn->nPeriod = period; if(!bNewTuning) pChn->nPortamentoDest = period; - if ((!bPorta) || ((!pChn->nLength) && (!(m_nType & MOD_TYPE_S3M)))) + if ((!bPorta) || ((!pChn->nLength) && (!(GetType() & MOD_TYPE_S3M)))) { pChn->pModSample = pSmp; pChn->pSample = pSmp->pSample; @@ -946,7 +947,7 @@ pChn->nResSwing = pChn->nCutSwing = 0; if (pIns) { - // IT compatibility tentative fix: Reset NNA action on every new note, even without instrument number next to note (fixes spx-farspacedance.it, but is this actually 100% correct?) + // IT Compatiblity: NNA is reset on every note change, not every instrument change (fixes spx-farspacedance.it). if(IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nNNA = pIns->nNNA; if (!(pIns->VolEnv.dwFlags & ENV_CARRY)) pChn->VolEnv.nEnvPosition = 0; if (!(pIns->PanEnv.dwFlags & ENV_CARRY)) pChn->PanEnv.nEnvPosition = 0; @@ -973,14 +974,14 @@ if (pIns->nCutSwing) { int d = ((LONG)pIns->nCutSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128; - pChn->nCutSwing = (signed short)((d * pChn->nCutOff + 1)/128); + pChn->nCutSwing = (signed short)((d * pChn->nCutOff + 1) / 128); pChn->nRestoreCutoffOnNewNote = pChn->nCutOff + 1; } // Resonance Swing if (pIns->nResSwing) { int d = ((LONG)pIns->nResSwing * (LONG)((rand() & 0xFF) - 0x7F)) / 128; - pChn->nResSwing = (signed short)((d * pChn->nResonance + 1)/128); + pChn->nResSwing = (signed short)((d * pChn->nResonance + 1) / 128); pChn->nRestoreResonanceOnNewNote = pChn->nResonance + 1; } } @@ -1539,12 +1540,6 @@ CheckNNA(nChn, instr, note, FALSE); } - //rewbs.VSTnoteDelay - #ifdef MODPLUG_TRACKER -// if (m_nInstruments) ProcessMidiOut(nChn, pChn); - #endif // MODPLUG_TRACKER - //end rewbs.VSTnoteDelay - if(note) { if(pChn->nRestorePanOnNewNote > 0) @@ -1613,10 +1608,9 @@ pChn->nPanSwing = 0; } - //rewbs.VSTnoteDelay - #ifdef MODPLUG_TRACKER +#ifdef MODPLUG_TRACKER if (m_nInstruments) ProcessMidiOut(nChn, pChn); - #endif // MODPLUG_TRACKER +#endif // MODPLUG_TRACKER } if((GetType() == MOD_TYPE_S3M) && (ChnSettings[nChn].dwFlags & CHN_MUTE) != 0) // not even effects are processed on muted S3M channels @@ -1674,7 +1668,7 @@ break; case VOLCMD_FINEVOLUP: - if (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) + if (GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) { if (m_nTickCount == nStartTick) VolumeSlide(pChn, (vol << 4) | 0x0F); } else @@ -1682,7 +1676,7 @@ break; case VOLCMD_FINEVOLDOWN: - if (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) + if (GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) { if (m_nTickCount == nStartTick) VolumeSlide(pChn, 0xF0 | vol); } else @@ -1710,24 +1704,18 @@ break; case VOLCMD_PORTAUP: - //IT compatibility (one of the first testcases - link effect memory) - if(IsCompatibleMode(TRK_IMPULSETRACKER)) - PortamentoUp(pChn, vol << 2, true); - else - PortamentoUp(pChn, vol << 2, false); + // IT compatibility (one of the first testcases - link effect memory) + PortamentoUp(pChn, vol << 2, IsCompatibleMode(TRK_IMPULSETRACKER)); break; case VOLCMD_PORTADOWN: - //IT compatibility (one of the first testcases - link effect memory) - if(IsCompatibleMode(TRK_IMPULSETRACKER)) - PortamentoDown(pChn, vol << 2, true); - else - PortamentoDown(pChn, vol << 2, false); + // IT compatibility (one of the first testcases - link effect memory) + PortamentoDown(pChn, vol << 2, IsCompatibleMode(TRK_IMPULSETRACKER)); break; case VOLCMD_OFFSET: //rewbs.volOff if (m_nTickCount == nStartTick) - SampleOffset(nChn, vol<<3, bPorta); + SampleOffset(nChn, vol << 3, bPorta); break; } } @@ -2267,7 +2255,7 @@ // Regular Slide if (!(m_dwSongFlags & SONG_FIRSTTICK) || (m_nMusicSpeed == 1)) //rewbs.PortaA01fix { - DoFreqSlide(pChn, -(int)(param * 4)); + DoFreqSlide(pChn, -int(param) * 4); } } @@ -2306,8 +2294,9 @@ } return; } - if (!(m_dwSongFlags & SONG_FIRSTTICK) || (m_nMusicSpeed == 1)) { //rewbs.PortaA01fix - DoFreqSlide(pChn, (int)(param << 2)); + if (!(m_dwSongFlags & SONG_FIRSTTICK) || (m_nMusicSpeed == 1)) //rewbs.PortaA01fix + { + DoFreqSlide(pChn, int(param) * 4); } } @@ -3749,7 +3738,11 @@ pChn->nLoopStart = pSmp->nLoopStart; pChn->nLoopEnd = pSmp->nLoopEnd; if (pChn->nLength > pChn->nLoopEnd) pChn->nLength = pChn->nLoopEnd; - LimitMax(pChn->nPos, pChn->nLength); + if(pChn->nPos > pChn->nLength) + { + pChn->nPos = pChn->nLength; + pChn->nPosLo = 0; + } } else { pChn->dwFlags &= ~(CHN_LOOP|CHN_PINGPONGLOOP|CHN_PINGPONGFLAG); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-10-03 20:59:19
|
Revision: 1081 http://modplug.svn.sourceforge.net/modplug/?rev=1081&view=rev Author: saga-games Date: 2011-10-03 20:59:13 +0000 (Mon, 03 Oct 2011) Log Message: ----------- [Fix] XM Compatibility: An instrument number (no matter what number) next to a note-off event recalls the default settings of the previously playing instrument. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-10-03 20:47:23 UTC (rev 1080) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-10-03 20:59:13 UTC (rev 1081) @@ -1477,7 +1477,7 @@ // This is only applied if the instrument column is empty and if there is either no note or a "normal" note (e.g. no note off) if(instr == 0 && note <= NOTE_MAX) { - for(INSTRUMENTINDEX nIns = 1; nIns <= m_nInstruments; nIns++) + for(INSTRUMENTINDEX nIns = 1; nIns <= GetNumInstruments(); nIns++) { if(Instruments[nIns] == pChn->pModInstrument) { @@ -1486,6 +1486,18 @@ } } } + } else if(note == NOTE_KEYOFF && instr && IsCompatibleMode(TRK_FASTTRACKER2)) + { + // Instrument settings are recalled if an instrument number (no matter which) is found next to a Key-Off note. + // Using the same stupid HACK as above. Maybe it's time to change something? + for(INSTRUMENTINDEX nIns = 1; nIns <= GetNumInstruments(); nIns++) + { + if(Instruments[nIns] == pChn->pModInstrument) + { + InstrumentChange(pChn, nIns, false, true, false); + break; + } + } } } if (retrigEnv) //Case: instrument with no note data. @@ -3693,17 +3705,17 @@ } pChn->dwFlags |= CHN_FASTVOLRAMP; - MODINSTRUMENT *pHeader = pChn->pModInstrument; + const MODINSTRUMENT *pIns = pChn->pModInstrument; // instro sends to a midi chan - if (pHeader && pHeader->nMidiChannel>0 && pHeader->nMidiChannel<17) + if (pIns && pIns->nMidiChannel > 0 && pIns->nMidiChannel < 17) { - UINT nPlug = pHeader->nMixPlug; + UINT nPlug = pIns->nMixPlug; if ((nPlug) && (nPlug <= MAX_MIXPLUGINS)) { IMixPlugin *pPlug = (IMixPlugin*)m_MixPlugins[nPlug-1].pMixPlugin; if (pPlug) { - pPlug->MidiCommand(pHeader->nMidiChannel, pHeader->nMidiProgram, pHeader->wMidiBank, /*pChn->nNote+*/NOTE_KEYOFF, 0, nChn); + pPlug->MidiCommand(pIns->nMidiChannel, pIns->nMidiProgram, pIns->wMidiBank, /*pChn->nNote+*/NOTE_KEYOFF, 0, nChn); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-10-04 13:45:14
|
Revision: 1082 http://modplug.svn.sourceforge.net/modplug/?rev=1082&view=rev Author: saga-games Date: 2011-10-04 13:45:05 +0000 (Tue, 04 Oct 2011) Log Message: ----------- [Ref] Greatly simplified the code of those instrument number related XM compatibility hacks. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-10-03 20:59:13 UTC (rev 1081) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-10-04 13:45:05 UTC (rev 1082) @@ -1309,7 +1309,7 @@ UINT vol = pChn->rowCommand.vol; UINT cmd = pChn->rowCommand.command; UINT param = pChn->rowCommand.param; - bool bPorta = ((cmd != CMD_TONEPORTAMENTO) && (cmd != CMD_TONEPORTAVOL) && (volcmd != VOLCMD_TONEPORTAMENTO)) ? false : true; + bool bPorta = (cmd == CMD_TONEPORTAMENTO) || (cmd == CMD_TONEPORTAVOL) || (volcmd == VOLCMD_TONEPORTAMENTO); UINT nStartTick = 0; @@ -1441,10 +1441,17 @@ UINT note = pChn->rowCommand.note; if (instr) pChn->nNewIns = instr; bool retrigEnv = (!note) && (instr); - + // Now it's time for some FT2 crap... - if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) + if (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) { + if(IsCompatibleMode(TRK_FASTTRACKER2) && instr) + { + // Apparently, any note number in a pattern causes instruments to retrigger - no matter if there's a Note Off next to it or whatever. + // Test cases: keyoff+instr.xm, delay.xm + retrigEnv = true; + } + // XM: FT2 ignores a note next to a K00 effect, and a fade-out seems to be done when no volume envelope is present (not exactly the Kxx behaviour) if(cmd == CMD_KEYOFF && param == 0 && IsCompatibleMode(TRK_FASTTRACKER2)) { @@ -1468,38 +1475,10 @@ if(note == NOTE_NONE) { note = pChn->nNote - pChn->nTranspose; - } else if(note >= NOTE_MIN_SPECIAL) - { - // Gah! Note Off + Note Delay will cause envelopes to *retrigger*! How stupid is that? - retrigEnv = true; } - // Stupid HACK to retrieve the last used instrument *number* for rouge note delays in XM - // This is only applied if the instrument column is empty and if there is either no note or a "normal" note (e.g. no note off) - if(instr == 0 && note <= NOTE_MAX) - { - for(INSTRUMENTINDEX nIns = 1; nIns <= GetNumInstruments(); nIns++) - { - if(Instruments[nIns] == pChn->pModInstrument) - { - instr = nIns; - break; - } - } - } - } else if(note == NOTE_KEYOFF && instr && IsCompatibleMode(TRK_FASTTRACKER2)) - { - // Instrument settings are recalled if an instrument number (no matter which) is found next to a Key-Off note. - // Using the same stupid HACK as above. Maybe it's time to change something? - for(INSTRUMENTINDEX nIns = 1; nIns <= GetNumInstruments(); nIns++) - { - if(Instruments[nIns] == pChn->pModInstrument) - { - InstrumentChange(pChn, nIns, false, true, false); - break; - } - } } } + if (retrigEnv) //Case: instrument with no note data. { //IT compatibility: Instrument with no note. @@ -1547,7 +1526,7 @@ } // New Note Action ? - if ((note) && (note <= NOTE_MAX) && (!bPorta)) + if (note != NOTE_NONE && NOTE_IS_VALID(note) && !bPorta) { CheckNNA(nChn, instr, note, FALSE); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-10-21 00:25:29
|
Revision: 1113 http://modplug.svn.sourceforge.net/modplug/?rev=1113&view=rev Author: saga-games Date: 2011-10-21 00:25:23 +0000 (Fri, 21 Oct 2011) Log Message: ----------- [Fix] Sustain loops + instrument number + portamento was broken since revision 1109. Revision Links: -------------- http://modplug.svn.sourceforge.net/modplug/?rev=1109&view=rev Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-10-20 22:15:55 UTC (rev 1112) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-10-21 00:25:23 UTC (rev 1113) @@ -662,14 +662,11 @@ return; } - pChn->nLength = pSmp->nLength; - pChn->nLoopStart = pSmp->nLoopStart; - pChn->nLoopEnd = pSmp->nLoopEnd; - // Tone-Portamento doesn't reset the pingpong direction flag if ((bPorta) && (pSmp == pChn->pModSample)) { - if(GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) return; + // If channel length is 0, we cut a previous sample using SCx. In that case, we have to update sample length, loop points, etc... + if(GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT) && pChn->nLength != 0) return; pChn->dwFlags &= ~(CHN_KEYOFF|CHN_NOTEFADE); pChn->dwFlags = (pChn->dwFlags & (CHN_CHANNELFLAGS | CHN_PINGPONGFLAG)) | (pSmp->uFlags & CHN_SAMPLEFLAGS); } else @@ -700,7 +697,11 @@ pChn->nVolSwing = pChn->nPanSwing = 0; pChn->nResSwing = pChn->nCutSwing = 0; } + pChn->pModSample = pSmp; + pChn->nLength = pSmp->nLength; + pChn->nLoopStart = pSmp->nLoopStart; + pChn->nLoopEnd = pSmp->nLoopEnd; // IT Compatibility: Autovibrato reset if(IsCompatibleMode(TRK_IMPULSETRACKER)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2011-12-10 14:59:42
|
Revision: 1144 http://modplug.svn.sourceforge.net/modplug/?rev=1144&view=rev Author: saga-games Date: 2011-12-10 14:59:35 +0000 (Sat, 10 Dec 2011) Log Message: ----------- [Fix] IT compatibility: Portamento is not picked up from stopped notes anymore (Test case: Fade-Porta.it) Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-12-03 22:52:03 UTC (rev 1143) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2011-12-10 14:59:35 UTC (rev 1144) @@ -902,11 +902,20 @@ // IT Compatibility: Update multisample instruments frequency even if instrument is not specified (fixes the guitars in spx-shuttledeparture.it) if(!bPorta && pSmp && IsCompatibleMode(TRK_IMPULSETRACKER)) pChn->nC5Speed = pSmp->nC5Speed; - // XM Compatibility: Ignore notes with portamento if there was no note playing. - if(bPorta && (pChn->nInc == 0) && IsCompatibleMode(TRK_FASTTRACKER2)) + if(bPorta && pChn->nInc == 0) { - pChn->nPeriod = 0; - return; + if(IsCompatibleMode(TRK_FASTTRACKER2)) + { + // XM Compatibility: Ignore notes with portamento if there was no note playing. + // Test case: 3xx-no-old-samp.xm + pChn->nPeriod = 0; + return; + } else if(IsCompatibleMode(TRK_IMPULSETRACKER)) + { + // IT Compatibility: Ignore portamento command if no note was playing (f.e. if a previous note has faded out). + // Test case: Fade-Porta.it + bPorta = false; + } } if (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2|MOD_TYPE_MED)) @@ -3620,14 +3629,15 @@ } } else if(IsCompatibleMode(TRK_FASTTRACKER2)) { - // XM Compatibility: Don't play note + // XM Compatibility: Don't play note if offset is beyond sample length + // Test case: 3xx-no-old-samp.xm pChn->dwFlags |= CHN_FASTVOLRAMP; pChn->nVolume = pChn->nPeriod = 0; } } - } else - if ((param < pChn->nLength) && (m_nType & (MOD_TYPE_MTM|MOD_TYPE_DMF))) + } else if ((param < pChn->nLength) && (GetType() & (MOD_TYPE_MTM|MOD_TYPE_DMF))) { + // XXX what's this? pChn->nPos = param; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-02-19 18:09:22
|
Revision: 1187 http://modplug.svn.sourceforge.net/modplug/?rev=1187&view=rev Author: saga-games Date: 2012-02-19 18:09:15 +0000 (Sun, 19 Feb 2012) Log Message: ----------- [Fix] XM Compatibility: Portamento shouldn't be reset when there is a note or instrument number (test case: Porta-Pickup.xm) Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-02-19 01:39:01 UTC (rev 1186) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-02-19 18:09:15 UTC (rev 1187) @@ -797,8 +797,13 @@ pChn->pSample = pSmp->pSample; pChn->nTranspose = pSmp->RelativeTone; + // FT2 compatibility: Don't reset portamento target with new instrument numbers. + // Test case: Porta-Pickup.xm + if(!IsCompatibleMode(TRK_FASTTRACKER2)) + { + pChn->nPortamentoDest = 0; + } pChn->m_PortamentoFineSteps = 0; - pChn->nPortamentoDest = 0; if (pChn->dwFlags & CHN_SUSTAINLOOP) { @@ -938,7 +943,16 @@ if (period) { if ((!bPorta) || (!pChn->nPeriod)) pChn->nPeriod = period; - if(!newTuning) pChn->nPortamentoDest = period; + if(!newTuning) + { + // FT2 compatibility: Don't reset portamento target with new notes. + // Test case: Porta-Pickup.xm + if(bPorta || !IsCompatibleMode(TRK_FASTTRACKER2)) + { + pChn->nPortamentoDest = period; + } + } + if ((!bPorta) || ((!pChn->nLength) && (!(GetType() & MOD_TYPE_S3M)))) { pChn->pModSample = pSmp; @@ -1009,7 +1023,9 @@ } } } + pChn->dwFlags &= ~(CHN_EXTRALOUD|CHN_KEYOFF); + // Enable Ramping if (!bPorta) { @@ -1025,6 +1041,7 @@ if(!IsCompatibleMode(TRK_FASTTRACKER2)) pChn->nRetrigCount = 0; pChn->nTremorCount = 0; } + if (bResetEnv) { pChn->nVolSwing = pChn->nPanSwing = 0; @@ -2310,8 +2327,8 @@ // Pattern Break / Position Jump only if no loop running // Test case for FT2 exception: PatLoop-Jumps.xm, PatLoop-Various.xm - if ((!doPatternLoop || IsCompatibleMode(TRK_FASTTRACKER2)) - && (nBreakRow != ROWINDEX_INVALID || nPosJump != ORDERINDEX_INVALID)) + if ((nBreakRow != ROWINDEX_INVALID || nPosJump != ORDERINDEX_INVALID) + && (!doPatternLoop || IsCompatibleMode(TRK_FASTTRACKER2))) { if (nPosJump == ORDERINDEX_INVALID) nPosJump = m_nCurrentOrder + 1; if (nBreakRow == ROWINDEX_INVALID) nBreakRow = 0; @@ -2322,24 +2339,21 @@ nPosJump = 0; } - // This checks whether we're jumping to the same row we're already on. - // Sounds pretty stupid and pointless to me. And noone else does this, either. + // IT / FT2 compatibility: don't reset loop count on pattern break. + // Test case: gm-trippy01.it, PatLoop-Break.xm, PatLoop-Weird.xm + if (nPosJump != m_nCurrentOrder && !IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2)) { - // IT / FT2 compatibility: don't reset loop count on pattern break. - // Test case: PatLoop-Break.xm - if (nPosJump != m_nCurrentOrder && !IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2)) + for (CHANNELINDEX i = 0; i < GetNumChannels(); i++) { - for (CHANNELINDEX i = 0; i < m_nChannels; i++) - { - Chn[i].nPatternLoopCount = 0; - } + Chn[i].nPatternLoopCount = 0; } - m_nNextOrder = nPosJump; - m_nNextRow = nBreakRow; - m_bPatternTransitionOccurred = true; } - } //Ends condition (nBreakRow >= 0) || (nPosJump >= 0) - //SetRowVisited(m_nCurrentPattern, m_nRow); + m_nNextOrder = nPosJump; + m_nNextRow = nBreakRow; + m_bPatternTransitionOccurred = true; + + } + } return TRUE; } @@ -4046,7 +4060,7 @@ { // This was the last loop - // IT compatibility 10. Pattern loops (+ same fix for XM and MOD files) + // IT compatibility 10. Pattern loops (+ same fix for XM / MOD / S3M files) if(!IsCompatibleMode(TRK_IMPULSETRACKER | TRK_FASTTRACKER2 | TRK_PROTRACKER | TRK_SCREAMTRACKER)) { MODCHANNEL *p = Chn; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-05-04 11:25:20
|
Revision: 1259 http://modplug.svn.sourceforge.net/modplug/?rev=1259&view=rev Author: saga-games Date: 2012-05-04 11:25:10 +0000 (Fri, 04 May 2012) Log Message: ----------- [Fix] IT compatibility: Sample and instrument panning overrides surround if Quad Surround is disabled (Test case: SmpInsPanSurround.it) Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-04-28 16:39:50 UTC (rev 1258) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-05-04 11:25:10 UTC (rev 1259) @@ -716,14 +716,32 @@ if (pIns) { pChn->nInsVol = (pSmp->nGlobalVol * pIns->nGlobalVol) >> 6; - if (pIns->dwFlags & INS_SETPANNING) pChn->nPan = pIns->nPan; + // Default instrument panning + if (pIns->dwFlags & INS_SETPANNING) + { + pChn->nPan = pIns->nPan; + // IT compatibility: Sample and instrument panning overrides channel surround status. + // Test case: SmpInsPanSurround.it + if(IsCompatibleMode(TRK_IMPULSETRACKER) && !(m_dwSongFlags & SONG_SURROUNDPAN)) + { + pChn->dwFlags &= ~CHN_SURROUND; + } + } } else { pChn->nInsVol = pSmp->nGlobalVol; } + + // Default sample panning if((pSmp->uFlags & CHN_PANNING) || (GetType() & MOD_TYPE_XM)) { pChn->nPan = pSmp->nPan; + // IT compatibility: Sample and instrument panning overrides channel surround status. + // Test case: SmpInsPanSurround.it + if(IsCompatibleMode(TRK_IMPULSETRACKER) && !(m_dwSongFlags & SONG_SURROUNDPAN)) + { + pChn->dwFlags &= ~CHN_SURROUND; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2012-05-14 22:43:10
|
Revision: 1271 http://modplug.svn.sourceforge.net/modplug/?rev=1271&view=rev Author: saga-games Date: 2012-05-14 22:43:04 +0000 (Mon, 14 May 2012) Log Message: ----------- [Fix] Fixed frequency slide inaccuracies (tx BeRo!) Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-05-14 22:23:45 UTC (rev 1270) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2012-05-14 22:43:04 UTC (rev 1271) @@ -2394,17 +2394,6 @@ } break; - // Midi Controller - case CMD_MIDI: // MIDI Controller (on first tick only) - case CMD_SMOOTHMIDI: // MIDI Controller (smooth, i.e. on every tick) - - /*if((cmd == CMD_MIDI) && !(m_dwSongFlags & SONG_FIRSTTICK)) break; - if (param < 0x80) - ProcessMIDIMacro(nChn, (cmd == CMD_SMOOTHMIDI), m_MidiCfg.szMidiSFXExt[pChn->nActiveMacro], param); - else - ProcessMIDIMacro(nChn, (cmd == CMD_SMOOTHMIDI), m_MidiCfg.szMidiZXXExt[(param & 0x7F)], 0);*/ - break; - // IMF Commands case CMD_NOTESLIDEUP: NoteSlide(pChn, param, true); @@ -2612,7 +2601,7 @@ void CSoundFile::FinePortamentoUp(ModChannel *pChn, UINT param) //------------------------------------------------------------- { - if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) + if (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) { if (param) pChn->nOldFinePortaUpDown = param; else param = pChn->nOldFinePortaUpDown; } @@ -2622,7 +2611,12 @@ { if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))) { + int oldPeriod = pChn->nPeriod; pChn->nPeriod = _muldivr(pChn->nPeriod, LinearSlideDownTable[param & 0x0F], 65536); + if(oldPeriod == pChn->nPeriod) + { + pChn->nPeriod--; + } } else { pChn->nPeriod -= (int)(param * 4); @@ -2636,7 +2630,7 @@ void CSoundFile::FinePortamentoDown(ModChannel *pChn, UINT param) //--------------------------------------------------------------- { - if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) + if (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) { if (param) pChn->nOldFinePortaUpDown = param; else param = pChn->nOldFinePortaUpDown; } @@ -2646,7 +2640,12 @@ { if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))) { + int oldPeriod = pChn->nPeriod; pChn->nPeriod = _muldivr(pChn->nPeriod, LinearSlideUpTable[param & 0x0F], 65536); + if(oldPeriod == pChn->nPeriod) + { + pChn->nPeriod++; + } } else { pChn->nPeriod += (int)(param * 4); @@ -2660,7 +2659,7 @@ void CSoundFile::ExtraFinePortamentoUp(ModChannel *pChn, UINT param) //------------------------------------------------------------------ { - if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) + if (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) { if (param) pChn->nOldFinePortaUpDown = param; else param = pChn->nOldFinePortaUpDown; } @@ -2670,7 +2669,12 @@ { if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))) { + int oldPeriod = pChn->nPeriod; pChn->nPeriod = _muldivr(pChn->nPeriod, FineLinearSlideDownTable[param & 0x0F], 65536); + if(oldPeriod == pChn->nPeriod) + { + pChn->nPeriod--; + } } else { pChn->nPeriod -= (int)(param); @@ -2684,7 +2688,7 @@ void CSoundFile::ExtraFinePortamentoDown(ModChannel *pChn, UINT param) //-------------------------------------------------------------------- { - if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) + if (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) { if (param) pChn->nOldFinePortaUpDown = param; else param = pChn->nOldFinePortaUpDown; } @@ -2694,7 +2698,12 @@ { if ((m_dwSongFlags & SONG_LINEARSLIDES) && (!(GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)))) { + int oldPeriod = pChn->nPeriod; pChn->nPeriod = _muldivr(pChn->nPeriod, FineLinearSlideUpTable[param & 0x0F], 65536); + if(oldPeriod == pChn->nPeriod) + { + pChn->nPeriod++; + } } else { pChn->nPeriod += (int)(param); @@ -3139,8 +3148,7 @@ { pChn->nEFxSpeed = param; if(m_dwSongFlags & SONG_FIRSTTICK) InvertLoop(pChn); - } - else // XM: Set Active Midi Macro + } else // XM: Set Active Midi Macro { pChn->nActiveMacro = param; } @@ -3306,7 +3314,12 @@ // SDx: Note Delay // SEx: Pattern Delay for x rows // SFx: S3M: Not used, IT: Set Active Midi Macro - case 0xF0: pChn->nActiveMacro = param; break; + case 0xF0: + if(GetType() != MOD_TYPE_S3M) + { + pChn->nActiveMacro = param; + } + break; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |