|
From: <man...@us...> - 2015-05-25 10:13:46
|
Revision: 5165
http://sourceforge.net/p/modplug/code/5165
Author: manxorist
Date: 2015-05-25 10:13:40 +0000 (Mon, 25 May 2015)
Log Message:
-----------
[Ref] Small simplification in tuning code.
Modified Paths:
--------------
trunk/OpenMPT/soundlib/tuning.cpp
trunk/OpenMPT/soundlib/tuning.h
Modified: trunk/OpenMPT/soundlib/tuning.cpp
===================================================================
--- trunk/OpenMPT/soundlib/tuning.cpp 2015-05-25 09:26:54 UTC (rev 5164)
+++ trunk/OpenMPT/soundlib/tuning.cpp 2015-05-25 10:13:40 UTC (rev 5165)
@@ -89,7 +89,6 @@
m_GroupSize = 0;
m_GroupRatio = 0;
m_RatioTableFine.clear();
- BelowRatios = AboveRatios = DefaultBARFUNC;
}
}
@@ -102,7 +101,6 @@
m_StepMin = vr.first;
ProSetGroupSize(static_cast<UNOTEINDEXTYPE>(v.size()));
ProSetGroupRatio(r);
- BelowRatios = AboveRatios = DefaultBARFUNC;
m_RatioTable.resize(vr.second-vr.first+1);
std::copy(v.begin(), v.end(), m_RatioTable.begin() + (ratiostartpos - vr.first));
@@ -138,7 +136,6 @@
m_StepMin = vr.first;
ProSetGroupSize(s);
ProSetGroupRatio(r);
- BelowRatios = AboveRatios = DefaultBARFUNC;
const RATIOTYPE stepRatio = pow(r, static_cast<RATIOTYPE>(1)/s);
m_RatioTable.resize(vr.second - vr.first + 1);
@@ -183,18 +180,15 @@
}
-CTuningRTI::RATIOTYPE CTuningRTI::DefaultBARFUNC(const NOTEINDEXTYPE&, const STEPINDEXTYPE&)
-//---------------------------------------------------------------
-{
- return 1;
-}
+const RATIOTYPE CTuningRTI::s_DefaultFallbackRatio = 1.0f;
+
//Without finetune
CTuning::RATIOTYPE CTuningRTI::GetRatio(const NOTEINDEXTYPE& stepsFromCentre) const
//-------------------------------------------------------------------------------------
{
- if(stepsFromCentre < m_StepMin) return BelowRatios(stepsFromCentre,0);
- if(stepsFromCentre >= m_StepMin + static_cast<NOTEINDEXTYPE>(m_RatioTable.size())) return AboveRatios(stepsFromCentre,0);
+ if(stepsFromCentre < m_StepMin) return s_DefaultFallbackRatio;
+ if(stepsFromCentre >= m_StepMin + static_cast<NOTEINDEXTYPE>(m_RatioTable.size())) return s_DefaultFallbackRatio;
return m_RatioTable[stepsFromCentre - m_StepMin];
}
@@ -228,8 +222,8 @@
fineStep = ((fsCount + 1) - (abs(baseStepDiff) % (fsCount+1))) % (fsCount+1);
}
- if(note < m_StepMin) return BelowRatios(note, fineStep);
- if(note >= m_StepMin + static_cast<NOTEINDEXTYPE>(m_RatioTable.size())) return AboveRatios(note, fineStep);
+ if(note < m_StepMin) return s_DefaultFallbackRatio;
+ if(note >= m_StepMin + static_cast<NOTEINDEXTYPE>(m_RatioTable.size())) return s_DefaultFallbackRatio;
if(fineStep) return m_RatioTable[note - m_StepMin] * GetRatioFine(note, fineStep);
else return m_RatioTable[note - m_StepMin];
Modified: trunk/OpenMPT/soundlib/tuning.h
===================================================================
--- trunk/OpenMPT/soundlib/tuning.h 2015-05-25 09:26:54 UTC (rev 5164)
+++ trunk/OpenMPT/soundlib/tuning.h 2015-05-25 10:13:40 UTC (rev 5165)
@@ -24,15 +24,10 @@
class CTuningRTI : public CTuning //RTI <-> Ratio Table Implementation
//================================
{
-public:
-//BEGIN TYPEDEFS:
- typedef RATIOTYPE (BARFUNC)(const NOTEINDEXTYPE&, const STEPINDEXTYPE&);
- //BARFUNC <-> Beyond Array Range FUNCtion.
-//END TYPEDEFS
public:
//BEGIN STATIC CONST MEMBERS:
- static RATIOTYPE DefaultBARFUNC(const NOTEINDEXTYPE&, const STEPINDEXTYPE&);
+ static const RATIOTYPE s_DefaultFallbackRatio;
static const NOTEINDEXTYPE s_StepMinDefault = -64;
static const UNOTEINDEXTYPE s_RatioTableSizeDefault = 128;
static const USTEPINDEXTYPE s_RatioTableFineSizeMaxDefault = 1000;
@@ -168,11 +163,6 @@
//m_GroupSize should always be >= 0.
NOTEINDEXTYPE m_GroupSize;
RATIOTYPE m_GroupRatio;
-
-
- BARFUNC* BelowRatios;
- BARFUNC* AboveRatios;
- //Defines the ratio to return if the ratio table runs out.
//<----Actual data members
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|