Fix VAG looping.

This commit is contained in:
Unknown W. Brackets 2013-05-27 16:41:17 -07:00
parent 91bdc0617e
commit 7b154f9a2e
2 changed files with 6 additions and 4 deletions

View File

@ -76,7 +76,7 @@ u32 sceSasInit(u32 core, u32 grainSize, u32 maxVoices, u32 outputMode, u32 sampl
for (int i = 0; i < sas->maxVoices; i++) {
sas->voices[i].sampleRate = sampleRate;
sas->voices[i].playing = false;
sas->voices[i].loop = true; // inverted flag
sas->voices[i].loop = false;
}
return 0;
}
@ -140,7 +140,7 @@ u32 sceSasSetVoice(u32 core, int voiceNum, u32 vagAddr, int size, int loop) {
v.type = VOICETYPE_VAG;
v.vagAddr = vagAddr;
v.vagSize = size;
v.loop = loop ? false : true;
v.loop = loop ? true : false;
v.ChangedParams(vagAddr == prevVagAddr);
return 0;
}
@ -170,7 +170,7 @@ u32 sceSasSetVoicePCM(u32 core, int voiceNum, u32 pcmAddr, int size, int loop)
v.pcmAddr = pcmAddr;
v.pcmSize = size;
v.pcmIndex = 0;
v.loop = loop ? false : true;
v.loop = loop ? true : false;
v.playing = true;
v.ChangedParams(pcmAddr == prevPcmAddr);
return 0;

View File

@ -97,10 +97,12 @@ void VagDecoder::GetSamples(s16 *outSamples, int numSamples) {
for (int i = 0; i < numSamples; i++) {
if (curSample == 28) {
if (loopAtNextBlock_) {
read_ = data_ + 16 * loopStartBlock_;
// data_ starts at curBlock = -1.
read_ = data_ + 16 * loopStartBlock_ + 16;
readp = Memory::GetPointer(read_);
origp = readp;
curBlock_ = loopStartBlock_;
loopAtNextBlock_ = false;
}
DecodeBlock(readp);
if (end_) {