|
From: <man...@us...> - 2013-05-20 18:47:35
|
Revision: 2154
http://sourceforge.net/p/modplug/code/2154
Author: manxorist
Date: 2013-05-20 18:47:29 +0000 (Mon, 20 May 2013)
Log Message:
-----------
[Ref] Apply m_nTempoFactor for all tempo modes.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Sndfile.cpp
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/soundlib/Sndfile.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-05-20 18:35:04 UTC (rev 2153)
+++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-05-20 18:47:29 UTC (rev 2154)
@@ -1694,11 +1694,7 @@
{
case tempo_mode_classic:
default:
-#ifdef MODPLUG_TRACKER
m_nSamplesPerTick = (m_MixerSettings.gdwMixingFreq * 5) / (m_nMusicTempo << 1);
-#else // !MODPLUG_TRACKER
- m_nSamplesPerTick = (m_MixerSettings.gdwMixingFreq * 5 * m_nTempoFactor) / (m_nMusicTempo << 8);
-#endif
break;
case tempo_mode_modern:
@@ -1709,6 +1705,9 @@
m_nSamplesPerTick = m_MixerSettings.gdwMixingFreq / m_nMusicTempo;
break;
}
+#ifndef MODPLUG_TRACKER
+ m_nSamplesPerTick = Util::muldivr(m_nSamplesPerTick, m_nTempoFactor, 128);
+#endif // !MODPLUG_TRACKER
}
@@ -1716,18 +1715,17 @@
UINT CSoundFile::GetTickDuration(UINT tempo, UINT speed, ROWINDEX rowsPerBeat)
//----------------------------------------------------------------------------
{
+ UINT retval = 0;
switch(m_nTempoMode)
{
case tempo_mode_classic:
default:
-#ifdef MODPLUG_TRACKER
- return (m_MixerSettings.gdwMixingFreq * 5) / (tempo << 1);
-#else // !MODPLUG_TRACKER
- return (m_MixerSettings.gdwMixingFreq * 5 * m_nTempoFactor) / (tempo << 8);
-#endif
+ retval = (m_MixerSettings.gdwMixingFreq * 5) / (tempo << 1);
+ break;
case tempo_mode_alternative:
- return m_MixerSettings.gdwMixingFreq / tempo;
+ retval = m_MixerSettings.gdwMixingFreq / tempo;
+ break;
case tempo_mode_modern:
{
@@ -1746,9 +1744,15 @@
m_dBufferDiff++;
}
ASSERT(abs(m_dBufferDiff) < 1);
- return bufferCount;
+ retval = bufferCount;
}
+ break;
}
+#ifndef MODPLUG_TRACKER
+ // when the user modifies the tempo, we do not really care about accurate tempo error accumulation
+ retval = Util::muldivr(retval, m_nTempoFactor, 128);
+#endif // !MODPLUG_TRACKER
+ return retval;
}
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-05-20 18:35:04 UTC (rev 2153)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-05-20 18:47:29 UTC (rev 2154)
@@ -1909,7 +1909,7 @@
int32 ninc = Util::muldiv(freq, 0x10000, m_MixerSettings.gdwMixingFreq << FREQ_FRACBITS);
if ((ninc >= 0xFFB0) && (ninc <= 0x10090)) ninc = 0x10000;
#ifndef MODPLUG_TRACKER
- if (m_nFreqFactor != 128) ninc = (ninc * m_nFreqFactor) >> 7;
+ ninc = Util::muldivr(ninc, m_nFreqFactor, 128);
#endif // !MODPLUG_TRACKER
Limit(ninc, 3, 0xFF0000);
pChn->nInc = (ninc + 1) & ~3;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|