ZSM export: fix two bugs w/ looped sample export

This commit is contained in:
MooingLemur 2023-07-08 23:51:54 -07:00 committed by tildearrow
parent e600747152
commit 73ea490fdb
2 changed files with 10 additions and 5 deletions

View File

@ -236,9 +236,12 @@ void DivPlatformVERA::tick(bool sysTick) {
if (s->samples>0) {
if (s->isLoopable()) {
// Inform the export process of the loop point for this sample
addWrite(67,s->loopStart&0xff);
addWrite(67,(s->loopStart>>8)&0xff);
addWrite(67,(s->loopStart>>16)&0xff);
int tmp_ls=(s->loopStart<<1); // for stereo
if (chan[16].pcm.depth16)
tmp_ls<<=1; // for 16 bit
addWrite(67,tmp_ls&0xff);
addWrite(67,(tmp_ls>>8)&0xff);
addWrite(67,(tmp_ls>>16)&0xff);
}
while (true) {
short tmp_l=0;

View File

@ -318,6 +318,7 @@ void DivZSM::flushWrites() {
}
pcmCache.resize(pcmCache.size()>>1);
pcmCtrlDCCache&=(unsigned char)~0x10; // clear stereo bit
pcmLoopPointCache>>=1; // halve the loop point
}
}
} else { // 8-bit
@ -334,6 +335,7 @@ void DivZSM::flushWrites() {
}
pcmCache.resize(pcmCache.size()>>1);
pcmCtrlDCCache&=(unsigned char)~0x10; // clear stereo bit
pcmLoopPointCache>>=1; // halve the loop point
}
}
}
@ -365,9 +367,9 @@ void DivZSM::flushWrites() {
inst.loopPoint=pcmLoopPointCache;
inst.isLooped=pcmIsLooped;
pcmInsts.push_back(inst);
pcmIsLooped=false;
pcmLoopPointCache=0;
}
pcmIsLooped=false;
pcmLoopPointCache=0;
}
if (extCmd0Len>63) { // this would be bad, but will almost certainly never happen
logE("ZSM: extCmd 0 exceeded maximum length of 63: %d",extCmd0Len);