mirror of https://github.com/mgba-emu/mgba.git
GBA Audio: Fix crash in audio subsampling if timing lockstep breaks
This commit is contained in:
parent
a4c2571d98
commit
79193b914b
1
CHANGES
1
CHANGES
|
@ -24,6 +24,7 @@ Other fixes:
|
|||
- Debugger: Fix writing to specific segment in command-line debugger
|
||||
- GB: Fix uninitialized save data when loading undersized temporary saves
|
||||
- GBA Audio: Fix crash if audio FIFOs and timers get out of sync
|
||||
- GBA Audio: Fix crash in audio subsampling if timing lockstep breaks
|
||||
- GBA Memory: Let raw access read high MMIO addresses
|
||||
- Qt: Fix savestate preview sizes with different scales (fixes mgba.io/i/2560)
|
||||
- Qt: Fix potential crash when configuring shortcuts
|
||||
|
|
|
@ -80,7 +80,7 @@ struct GBAAudio {
|
|||
int32_t sampleInterval;
|
||||
|
||||
int32_t lastSample;
|
||||
int sampleIndex;
|
||||
unsigned sampleIndex;
|
||||
struct mStereoSample currentSamples[GBA_MAX_SAMPLES];
|
||||
|
||||
bool forceDisableChA;
|
||||
|
|
|
@ -232,6 +232,9 @@ void GBAAudioWriteSOUNDBIAS(struct GBAAudio* audio, uint16_t value) {
|
|||
if (oldSampleInterval != audio->sampleInterval) {
|
||||
timestamp -= audio->lastSample;
|
||||
audio->sampleIndex = timestamp >> (9 - GBARegisterSOUNDBIASGetResolution(value));
|
||||
if (audio->sampleIndex >= GBA_MAX_SAMPLES) {
|
||||
audio->sampleIndex = 0;
|
||||
}
|
||||
if (audio->p->stream && audio->p->stream->audioRateChanged) {
|
||||
audio->p->stream->audioRateChanged(audio->p->stream, GBA_ARM7TDMI_FREQUENCY / audio->sampleInterval);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue