Skip to content

Commit

Permalink
Hopefully worked out all WAV loop bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
KinoMyu committed Apr 2, 2018
1 parent 4197fe8 commit 8bce221
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions clHCA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ void clHCA::AsyncDecode(stChannel* channelsOffset, unsigned int blocknum, void*&
}
int seekhead = 0;
char* outwavptr = (char*)outputwavptr + ((_mode >> 3) * blocknum * _channelCount << 10) + _wavheadersize;
unsigned int loopsize = (((_loopEnd - _loopStart - 1) << 10) + 1023 - _muteFooter) * (_mode >> 3) * _channelCount;
unsigned int loopsize = (((_loopEnd - _loopStart - 1) << 10) + (_loopFlg ? 1024 - _muteFooter : 1024)) * (_mode >> 3) * _channelCount;
if(blocknum == 0)
{
PrepDecode(channelsOffset, 1);
Expand Down Expand Up @@ -709,24 +709,24 @@ void clHCA::AsyncDecode(stChannel* channelsOffset, unsigned int blocknum, void*&
float f = channelsOffset[k].wave[i][j] * _rva_volume;
if (f > 1) { f = 1; }
else if (f < -1) { f = -1; }
if (blocknum + x <= _loopStart)
if (blocknum + x < _loopStart)
{
((void(*)(float, void *, int&))_modeFunction)(f, outwavptr, seekhead);
}
else if (blocknum + x <= _loopEnd)
else if (blocknum + x < _loopEnd)
{
int s = 0;
for (int l = 0; l <= _loopNum; ++l)
{
s = seekhead;
if (blocknum + x != _loopEnd || i * 0x80 + j < 1024 - _muteFooter)
if (blocknum + x < _loopEnd - 1 || i * 0x80 + j < (_loopFlg ? 1024 - _muteFooter : 1024))
{
((void(*)(float, void *, int&))_modeFunction)(f, outwavptr + l * loopsize, s);
}
}
seekhead = s;
}
else
else if (blocknum + x < _blockCount - 1 || i * 0x80 + j < 1024 - _muteFooter)
{
((void(*)(float, void *, int&))_modeFunction)(f, outwavptr + _loopNum * loopsize, seekhead);
}
Expand Down

0 comments on commit 8bce221

Please sign in to comment.