|
From: <man...@us...> - 2013-05-19 14:53:51
|
Revision: 2127
http://sourceforge.net/p/modplug/code/2127
Author: manxorist
Date: 2013-05-19 14:53:45 +0000 (Sun, 19 May 2013)
Log Message:
-----------
[Ref] Remove CHN_NOIDO and CHN_HQSRC ChannelFlags and remove CSoundFile::GetResamplingFlag. Instead, store the interpolation mode (which depends on per instrument interpolation mode and the global setting) computed by CSoundFile::ReadNote directly into ModChannel::resamplingMode.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/Fastmix.cpp
trunk/OpenMPT/soundlib/ModChannel.h
trunk/OpenMPT/soundlib/Resampler.h
trunk/OpenMPT/soundlib/Snd_defs.h
trunk/OpenMPT/soundlib/Sndfile.h
trunk/OpenMPT/soundlib/Sndmix.cpp
Modified: trunk/OpenMPT/soundlib/Fastmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-05-19 14:46:20 UTC (rev 2126)
+++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-05-19 14:53:45 UTC (rev 2127)
@@ -1488,7 +1488,7 @@
if (pChannel->dwFlags[CHN_FILTER]) nFlags |= MIXNDX_FILTER;
#endif
//rewbs.resamplerConf
- nFlags |= GetResamplingFlag(pChannel);
+ nFlags |= ResamplingModeToMixFlags(pChannel->resamplingMode);
//end rewbs.resamplerConf
if ((nFlags < 0x20) && (pChannel->rightVol == pChannel->leftVol)
&& ((!pChannel->nRampLength) || (pChannel->rightRamp == pChannel->leftRamp)))
@@ -1627,29 +1627,7 @@
return nchused;
}
-UINT CSoundFile::GetResamplingFlag(const ModChannel *pChannel)
-//------------------------------------------------------------
-{
- if (pChannel->pModInstrument) {
- if(IsKnownResamplingMode(pChannel->pModInstrument->nResampling))
- {
- return ResamplingModeToMixFlags(pChannel->pModInstrument->nResampling);
- }
- }
- //didn't manage to get flag from instrument header, use channel flags.
- if(pChannel->dwFlags[CHN_HQSRC])
- {
- return ResamplingModeToMixFlags(m_Resampler.m_Settings.SrcMode);
- } else if(!pChannel->dwFlags[CHN_NOIDO])
- {
- return MIXNDX_LINEARSRC;
- }
-
- return 0;
-}
-
-
void CSoundFile::ProcessPlugins(UINT nCount)
//------------------------------------------
{
Modified: trunk/OpenMPT/soundlib/ModChannel.h
===================================================================
--- trunk/OpenMPT/soundlib/ModChannel.h 2013-05-19 14:46:20 UTC (rev 2126)
+++ trunk/OpenMPT/soundlib/ModChannel.h 2013-05-19 14:53:45 UTC (rev 2127)
@@ -83,6 +83,7 @@
ROWINDEX nPatternLoop;
CHANNELINDEX nMasterChn;
// 8-bit members
+ uint8 resamplingMode;
uint8 nRestoreResonanceOnNewNote; //Like above
uint8 nRestoreCutoffOnNewNote; //Like above
uint8 nNote, nNNA;
Modified: trunk/OpenMPT/soundlib/Resampler.h
===================================================================
--- trunk/OpenMPT/soundlib/Resampler.h 2013-05-19 14:46:20 UTC (rev 2126)
+++ trunk/OpenMPT/soundlib/Resampler.h 2013-05-19 14:53:45 UTC (rev 2127)
@@ -65,6 +65,4 @@
~CResampler() {}
void InitializeTables(bool force=false);
bool IsHQ() const { return m_Settings.SrcMode >= SRCMODE_SPLINE && m_Settings.SrcMode < SRCMODE_DEFAULT; }
- bool IsUltraHQ() const { return m_Settings.SrcMode >= SRCMODE_POLYPHASE && m_Settings.SrcMode < SRCMODE_DEFAULT; }
- bool Is(ResamplingMode cmp) const { return m_Settings.SrcMode == cmp; }
};
Modified: trunk/OpenMPT/soundlib/Snd_defs.h
===================================================================
--- trunk/OpenMPT/soundlib/Snd_defs.h 2013-05-19 14:46:20 UTC (rev 2126)
+++ trunk/OpenMPT/soundlib/Snd_defs.h 2013-05-19 14:53:45 UTC (rev 2127)
@@ -136,8 +136,8 @@
CHN_KEYOFF = 0x200, // exit sustain
CHN_NOTEFADE = 0x400, // fade note (instrument mode)
CHN_SURROUND = 0x800, // use surround channel
- CHN_NOIDO = 0x1000, // (IDO = Interpolation Do?) Indicates if the channel is near enough to an exact multiple of the base frequency that any interpolation won't be noticeable - or if interpolation was switched off completely. --Storlek
- CHN_HQSRC = 0x2000, // High quality sample rate conversion (i.e. apply interpolation)
+ // UNUSED = 0x1000,
+ // UNUSED = 0x2000,
CHN_FILTER = 0x4000, // Apply resonant filter on sample
CHN_VOLUMERAMP = 0x8000, // Apply volume ramping
CHN_VIBRATO = 0x10000, // Apply vibrato
Modified: trunk/OpenMPT/soundlib/Sndfile.h
===================================================================
--- trunk/OpenMPT/soundlib/Sndfile.h 2013-05-19 14:46:20 UTC (rev 2126)
+++ trunk/OpenMPT/soundlib/Sndfile.h 2013-05-19 14:53:45 UTC (rev 2127)
@@ -574,7 +574,6 @@
void ResetChannels();
UINT Read(LPVOID lpBuffer, UINT cbBuffer);
UINT CreateStereoMix(int count);
- UINT GetResamplingFlag(const ModChannel *pChannel);
BOOL FadeSong(UINT msec);
BOOL GlobalFadeSong(UINT msec);
void ProcessPlugins(UINT nCount);
Modified: trunk/OpenMPT/soundlib/Sndmix.cpp
===================================================================
--- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-05-19 14:46:20 UTC (rev 2126)
+++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-05-19 14:53:45 UTC (rev 2127)
@@ -2005,27 +2005,28 @@
// Clipping volumes
//if (pChn->nNewRightVol > 0xFFFF) pChn->nNewRightVol = 0xFFFF;
//if (pChn->nNewLeftVol > 0xFFFF) pChn->nNewLeftVol = 0xFFFF;
- // Check IDO
- if (m_Resampler.Is(SRCMODE_NEAREST))
+
+ ResamplingMode resamplingMode = m_Resampler.m_Settings.SrcMode; // default to global mixer settings
+ if(pChn->pModInstrument && IsKnownResamplingMode(pChn->pModInstrument->nResampling))
{
- pChn->dwFlags.set(CHN_NOIDO);
- } else
+ // for defined resampling modes, use per-instrument resampling modes if set
+ resamplingMode = (ResamplingMode)pChn->pModInstrument->nResampling;
+ }
+ // disable interpolation in certain cases
+ if(pChn->nInc == 0x10000)
{
- pChn->dwFlags.reset(CHN_NOIDO | CHN_HQSRC);
-
- if (pChn->nInc == 0x10000)
+ // exact samplerate match, do not resample at all, regardless of selected resampler
+ resamplingMode = SRCMODE_NEAREST;
+ } else if(resamplingMode == SRCMODE_LINEAR)
+ {
+ if(((pChn->nInc >= 0xFF00) && (pChn->nInc < 0x10100)))
{
- pChn->dwFlags.set(CHN_NOIDO);
- } else
- if (m_Resampler.IsHQ())
- {
- pChn->dwFlags.set(CHN_HQSRC);
- } else
- {
- if ((pChn->nInc >= 0xFF00) && (pChn->nInc < 0x10100))
- pChn->dwFlags.set(CHN_NOIDO);
+ // disable interpolation if rates are too close
+ resamplingMode = SRCMODE_NEAREST;
}
}
+ // store for the mixer
+ pChn->resamplingMode = (uint8)resamplingMode;
/*if (m_pConfig->getUseGlobalPreAmp())
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|