Cleaned up ft2play loop handling and fixed bidirectional loops
parent
cd5f1e0821
commit
10316cfd06
|
@ -2927,25 +2927,25 @@ static inline void mix8b(PLAYER *p, uint32_t ch, uint32_t samples)
|
|||
{
|
||||
if (loopDir == 1)
|
||||
{
|
||||
if (samplePosition <= sampleLoopBegin)
|
||||
if (samplePosition < sampleLoopBegin)
|
||||
{
|
||||
samplePosition = sampleLoopBegin + (sampleLoopBegin - samplePosition);
|
||||
samplePosition = sampleLoopBegin;
|
||||
loopDir = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (samplePosition >= sampleLoopEnd)
|
||||
if (samplePosition == sampleLoopEnd)
|
||||
{
|
||||
samplePosition = sampleLoopEnd - (samplePosition - sampleLoopEnd);
|
||||
samplePosition = sampleLoopEnd - 1;
|
||||
loopDir = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (samplePosition >= sampleLoopEnd)
|
||||
samplePosition = sampleLoopBegin + (samplePosition - sampleLoopEnd);
|
||||
if (samplePosition == sampleLoopEnd)
|
||||
samplePosition = sampleLoopBegin;
|
||||
}
|
||||
}
|
||||
else if ((samplePosition < 0) || (samplePosition >= sampleLength))
|
||||
|
@ -3092,25 +3092,25 @@ static inline void mix8bstereo(PLAYER *p, uint32_t ch, uint32_t samples)
|
|||
{
|
||||
if (loopDir == 1)
|
||||
{
|
||||
if (samplePosition <= sampleLoopBegin)
|
||||
if (samplePosition < sampleLoopBegin)
|
||||
{
|
||||
samplePosition = sampleLoopBegin + (sampleLoopBegin - samplePosition);
|
||||
samplePosition = sampleLoopBegin;
|
||||
loopDir = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (samplePosition >= sampleLoopEnd)
|
||||
if (samplePosition == sampleLoopEnd)
|
||||
{
|
||||
samplePosition = sampleLoopEnd - (samplePosition - sampleLoopEnd);
|
||||
samplePosition = sampleLoopEnd - 1;
|
||||
loopDir = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (samplePosition >= sampleLoopEnd)
|
||||
samplePosition = sampleLoopBegin + (samplePosition - sampleLoopEnd);
|
||||
if (samplePosition == sampleLoopEnd)
|
||||
samplePosition = sampleLoopBegin;
|
||||
}
|
||||
}
|
||||
else if ((samplePosition < 0) || (samplePosition >= sampleLength))
|
||||
|
@ -3254,25 +3254,25 @@ static inline void mix16b(PLAYER *p, uint32_t ch, uint32_t samples)
|
|||
{
|
||||
if (loopDir == 1)
|
||||
{
|
||||
if (samplePosition <= sampleLoopBegin)
|
||||
if (samplePosition < sampleLoopBegin)
|
||||
{
|
||||
samplePosition = sampleLoopBegin + (sampleLoopBegin - samplePosition);
|
||||
samplePosition = sampleLoopBegin;
|
||||
loopDir = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (samplePosition >= sampleLoopEnd)
|
||||
if (samplePosition == sampleLoopEnd)
|
||||
{
|
||||
samplePosition = sampleLoopEnd - (samplePosition - sampleLoopEnd);
|
||||
samplePosition = sampleLoopEnd - 1;
|
||||
loopDir = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (samplePosition >= sampleLoopEnd)
|
||||
samplePosition = sampleLoopBegin + (samplePosition - sampleLoopEnd);
|
||||
if (samplePosition == sampleLoopEnd)
|
||||
samplePosition = sampleLoopBegin;
|
||||
}
|
||||
}
|
||||
else if ((samplePosition < 0) || (samplePosition >= sampleLength))
|
||||
|
@ -3419,25 +3419,25 @@ static inline void mix16bstereo(PLAYER *p, uint32_t ch, uint32_t samples)
|
|||
{
|
||||
if (loopDir == 1)
|
||||
{
|
||||
if (samplePosition <= sampleLoopBegin)
|
||||
if (samplePosition < sampleLoopBegin)
|
||||
{
|
||||
samplePosition = sampleLoopBegin + (sampleLoopBegin - samplePosition);
|
||||
samplePosition = sampleLoopBegin;
|
||||
loopDir = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (samplePosition >= sampleLoopEnd)
|
||||
if (samplePosition == sampleLoopEnd)
|
||||
{
|
||||
samplePosition = sampleLoopEnd - (samplePosition - sampleLoopEnd);
|
||||
samplePosition = sampleLoopEnd - 1;
|
||||
loopDir = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (samplePosition >= sampleLoopEnd)
|
||||
samplePosition = sampleLoopBegin + (samplePosition - sampleLoopEnd);
|
||||
if (samplePosition == sampleLoopEnd)
|
||||
samplePosition = sampleLoopBegin;
|
||||
}
|
||||
}
|
||||
else if ((samplePosition < 0) || (samplePosition >= sampleLength))
|
||||
|
@ -4002,4 +4002,4 @@ void ft2play_GetInfo(void *_p, ft2_info *info)
|
|||
info->channels_playing = (uint8_t)channels_playing;
|
||||
}
|
||||
|
||||
// EOF
|
||||
// EOF
|
||||
|
|
Loading…
Reference in New Issue