|
From: <sag...@us...> - 2015-03-01 14:49:18
|
Revision: 4799
http://sourceforge.net/p/modplug/code/4799
Author: saga-games
Date: 2015-03-01 14:49:12 +0000 (Sun, 01 Mar 2015)
Log Message:
-----------
[Ref] Small chances here and there with no change in functionality
Modified Paths:
--------------
trunk/OpenMPT/soundlib/ModInstrument.cpp
trunk/OpenMPT/soundlib/ModSample.cpp
trunk/OpenMPT/soundlib/ModSequence.cpp
trunk/OpenMPT/soundlib/modcommand.cpp
trunk/OpenMPT/soundlib/patternContainer.cpp
trunk/OpenMPT/soundlib/patternContainer.h
Modified: trunk/OpenMPT/soundlib/ModInstrument.cpp
===================================================================
--- trunk/OpenMPT/soundlib/ModInstrument.cpp 2015-03-01 12:30:39 UTC (rev 4798)
+++ trunk/OpenMPT/soundlib/ModInstrument.cpp 2015-03-01 14:49:12 UTC (rev 4799)
@@ -76,7 +76,8 @@
}
-// Get envelope value at a given tick. Returns value in range [0.0, 1.0].
+// Get envelope value at a given tick. Assumes that the envelope data is in rage [0, rangeIn],
+// returns value in range [0, rangeOut].
int32 InstrumentEnvelope::GetValueFromPosition(int position, int32 rangeOut, int32 rangeIn) const
//-----------------------------------------------------------------------------------------------
{
@@ -202,7 +203,7 @@
nMidiChannel = 1;
}
- // FT2 only has signed Pitch Wheel Depth, and it's limited to 0...36 (in the GUI, at least. As you would expect it from FT2, this value is actually not sanitized on load).
+ // FT2 only has unsigned Pitch Wheel Depth, and it's limited to 0...36 (in the GUI, at least. As you would expect it from FT2, this value is actually not sanitized on load).
midiPWD = static_cast<int8>(abs(midiPWD));
Limit(midiPWD, int8(0), int8(36));
Modified: trunk/OpenMPT/soundlib/ModSample.cpp
===================================================================
--- trunk/OpenMPT/soundlib/ModSample.cpp 2015-03-01 12:30:39 UTC (rev 4798)
+++ trunk/OpenMPT/soundlib/ModSample.cpp 2015-03-01 14:49:12 UTC (rev 4799)
@@ -193,7 +193,7 @@
const SmpLength maxSize = Util::MaxValueOfType(numSamples);
const SmpLength lookaheadBufferSize = 16 + (1 + 4 + 4) * InterpolationMaxLookahead;
- if(numSamples > maxSize || lookaheadBufferSize > maxSize - numSamples)
+ if(numSamples > MAX_SAMPLE_LENGTH || lookaheadBufferSize > maxSize - numSamples)
{
return 0;
}
Modified: trunk/OpenMPT/soundlib/ModSequence.cpp
===================================================================
--- trunk/OpenMPT/soundlib/ModSequence.cpp 2015-03-01 12:30:39 UTC (rev 4798)
+++ trunk/OpenMPT/soundlib/ModSequence.cpp 2015-03-01 14:49:12 UTC (rev 4799)
@@ -492,7 +492,7 @@
{
#ifdef MODPLUG_TRACKER
// Allow conversion only if there's only one sequence.
- if(GetNumSequences() != 1 || m_sndFile.GetType() != MOD_TYPE_MPT)
+ if(GetNumSequences() != 1 || m_sndFile.GetModSpecifications().sequencesMax <= 1)
return false;
bool hasSepPatterns = false;
@@ -554,7 +554,7 @@
{
if(m->command == CMD_POSITIONJUMP && m->param >= startOrd)
{
- m->param = static_cast<BYTE>(m->param - startOrd);
+ m->param = static_cast<ModCommand::PARAM>(m->param - startOrd);
}
}
}
@@ -639,7 +639,7 @@
m_sndFile.AddToLog(mpt::String::Print("CONFLICT: Pattern break commands in Pattern %1 might be broken since it has been used in several sequences!", nPat));
}
}
- m->param = static_cast<BYTE>(m->param + nFirstOrder);
+ m->param = static_cast<ModCommand::PARAM>(m->param + nFirstOrder);
patternsFixed[nPat] = removedSequences;
}
}
Modified: trunk/OpenMPT/soundlib/modcommand.cpp
===================================================================
--- trunk/OpenMPT/soundlib/modcommand.cpp 2015-03-01 12:30:39 UTC (rev 4798)
+++ trunk/OpenMPT/soundlib/modcommand.cpp 2015-03-01 14:49:12 UTC (rev 4799)
@@ -375,10 +375,6 @@
}
break;
- case CMD_SPEED:
- param = std::min<PARAM>(param, (toType == MOD_TYPE_XM) ? 0x1F : 0x20);
- break;
-
case CMD_TEMPO:
if(param < 0x20) command = CMD_NONE; // no tempo slides
break;
@@ -487,26 +483,21 @@
} // End if(oldTypeIsIT_MPT && newTypeIsXM)
///////////////////////////////////
- // MOD <-> XM: Speed/Tempo update
- if(oldTypeIsMOD && newTypeIsXM)
+ // MOD / XM Speed/Tempo limits
+ if(newTypeIsMOD_XM)
{
switch(command)
{
case CMD_SPEED:
- param = std::min<PARAM>(param, 0x1F);
+ param = std::min<PARAM>(param, (toType == MOD_TYPE_XM) ? 0x1F : 0x20);
break;
- }
- } else if(oldTypeIsXM && newTypeIsMOD)
- {
- switch(command)
- {
+ break;
case CMD_TEMPO:
- param = std::max<PARAM>(param, 0x21);
+ param = std::max<PARAM>(param, (toType == MOD_TYPE_XM) ? 0x20 : 0x21);
break;
}
}
-
///////////////////////////////////////////////////////////////////////
// Convert MOD to anything - adjust effect memory, remove Invert Loop
if(oldTypeIsMOD)
Modified: trunk/OpenMPT/soundlib/patternContainer.cpp
===================================================================
--- trunk/OpenMPT/soundlib/patternContainer.cpp 2015-03-01 12:30:39 UTC (rev 4798)
+++ trunk/OpenMPT/soundlib/patternContainer.cpp 2015-03-01 14:49:12 UTC (rev 4799)
@@ -91,19 +91,14 @@
m_Patterns[index].RemoveSignature();
m_Patterns[index].SetName("");
- if(!m_Patterns[index]) return false;
-
- return true;
+ return m_Patterns[index] != nullptr;
}
-bool CPatternContainer::Remove(const PATTERNINDEX ipat)
+void CPatternContainer::Remove(const PATTERNINDEX ipat)
//-----------------------------------------------------
{
- if(ipat >= m_Patterns.size())
- return true;
- m_Patterns[ipat].Deallocate();
- return false;
+ if(ipat < m_Patterns.size()) m_Patterns[ipat].Deallocate();
}
@@ -114,7 +109,7 @@
return false;
const ModCommand *m = m_Patterns[nPat].m_ModCommands;
- for(size_t i = m_Patterns[nPat].GetNumChannels() * m_Patterns[nPat].GetNumRows(); i > 0; i--, m++)
+ for(const ModCommand *mEnd = m + m_Patterns[nPat].GetNumChannels() * m_Patterns[nPat].GetNumRows(); m != mEnd; m++)
{
if(!m->IsEmpty(true))
return false;
@@ -123,17 +118,6 @@
}
-PATTERNINDEX CPatternContainer::GetIndex(const MODPATTERN* const pPat) const
-//--------------------------------------------------------------------------
-{
- const PATTERNINDEX endI = static_cast<PATTERNINDEX>(m_Patterns.size());
- for(PATTERNINDEX i = 0; i<endI; i++)
- if(&m_Patterns[i] == pPat) return i;
-
- return endI;
-}
-
-
void CPatternContainer::ResizeArray(const PATTERNINDEX newSize)
//-------------------------------------------------------------
{
@@ -246,7 +230,7 @@
nPatterns = nCount;
LimitMax(nPatterns, ModSpecs::mptm.patternsMax);
if (nPatterns > patc.Size())
- patc.ResizeArray(nPatterns);
+ patc.ResizeArray(nPatterns);
for(uint16 i = 0; i < nPatterns; i++)
{
ssb.ReadItem(patc[i], srlztn::ID::FromInt<uint16>(i), &ReadModPattern);
Modified: trunk/OpenMPT/soundlib/patternContainer.h
===================================================================
--- trunk/OpenMPT/soundlib/patternContainer.h 2015-03-01 12:30:39 UTC (rev 4798)
+++ trunk/OpenMPT/soundlib/patternContainer.h 2015-03-01 14:49:12 UTC (rev 4799)
@@ -61,7 +61,7 @@
//Remove pattern from given position. Currently it actually makes the pattern
//'invisible' - the pattern data is cleared but the actual pattern object won't get removed.
- bool Remove(const PATTERNINDEX index);
+ void Remove(const PATTERNINDEX index);
// Applies function object for modcommands in patterns in given range.
// Return: Copy of the function object.
@@ -75,9 +75,6 @@
CSoundFile& GetSoundFile() {return m_rSndFile;}
const CSoundFile& GetSoundFile() const {return m_rSndFile;}
- //Returns the index of given pattern, Size() if not found.
- PATTERNINDEX GetIndex(const MODPATTERN* const pPat) const;
-
// Return true if pattern can be accessed with operator[](iPat), false otherwise.
bool IsValidIndex(const PATTERNINDEX iPat) const {return (iPat < Size());}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|