VGM export: cap streams to 44100Hz

VGMPlay doesn't like higher frequencies
This commit is contained in:
tildearrow 2023-06-22 16:45:31 -05:00
parent 95b51e6307
commit 06a2d10ba1

View file

@ -622,11 +622,14 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
} }
} }
break; break;
case 1: // set sample freq case 1: { // set sample freq
int realFreq=write.val;
if (realFreq<0) realFreq=0;
if (realFreq>44100) realFreq=44100;
w->writeC(0x92); w->writeC(0x92);
w->writeC(streamID); w->writeC(streamID);
w->writeI(write.val); w->writeI(realFreq);
loopFreq[streamID]=write.val; loopFreq[streamID]=realFreq;
if (pendingFreq[streamID]!=-1) { if (pendingFreq[streamID]!=-1) {
DivSample* sample=song.sample[pendingFreq[streamID]]; DivSample* sample=song.sample[pendingFreq[streamID]];
w->writeC(0x95); w->writeC(0x95);
@ -641,6 +644,7 @@ void DivEngine::performVGMWrite(SafeWriter* w, DivSystem sys, DivRegWrite& write
pendingFreq[streamID]=-1; pendingFreq[streamID]=-1;
} }
break; break;
}
case 2: // stop sample case 2: // stop sample
w->writeC(0x94); w->writeC(0x94);
w->writeC(streamID); w->writeC(streamID);