sound streams: don't restart frame on rate change

This commit is contained in:
dinkc64 2024-05-19 09:22:52 -04:00
parent 37ad0726d5
commit faa6580258

View File

@ -31,11 +31,6 @@
// -- input samplerate change
// stream.set_rate(new_rate);
// doing this live (during a frame) causes the buffer to restart!
// * berzerk, (atari) games with tms5220/tms5110 write silence before
// rate changes, so this is not a problem.
// should we encounter something that needs to rate change several times
// per frame, while outputting non-silence then a little re-write is in-order..
struct Stream {
// the re-sampler section
@ -65,6 +60,8 @@ struct Stream {
nSampleRateFrom = rate_from;
nSampleSize = (UINT64)nSampleRateFrom * (1 << 16) / ((nSampleRateTo == 0) ? 44100 : nSampleRateTo);
nSampleSize_Otherway = (UINT64)((nSampleRateTo == 0) ? 44100 : nSampleRateTo) * (1 << 16) / ((nSampleRateFrom == 0) ? 44100 : nSampleRateFrom);
// origially this restarted the frame (nPosition = 0), but this breaks
// qbert, as the game writes rate changes several times per frame.
}
void exit() {
nSampleSize = nFractionalPosition = 0;