mirror of https://github.com/mgba-emu/mgba.git
GBA Audio: Fix sample timing drifting when changing sample interval
This commit is contained in:
parent
c358f22403
commit
1c41e1e051
1
CHANGES
1
CHANGES
|
@ -11,6 +11,7 @@ Emulation fixes:
|
||||||
- GB Serialize: Add missing Pocket Cam state to savestates
|
- GB Serialize: Add missing Pocket Cam state to savestates
|
||||||
- GB SIO: Disabling SIO should cancel pending transfers (fixes mgba.io/i/2537)
|
- GB SIO: Disabling SIO should cancel pending transfers (fixes mgba.io/i/2537)
|
||||||
- GB Video: Implement DMG-style sprite ordering
|
- GB Video: Implement DMG-style sprite ordering
|
||||||
|
- GBA Audio: Fix sample timing drifting when changing sample interval
|
||||||
- GBA BIOS: Fix clobbering registers with word-sized CpuSet
|
- GBA BIOS: Fix clobbering registers with word-sized CpuSet
|
||||||
- GBA Video: Disable BG target 1 blending when OBJ blending (fixes mgba.io/i/2722)
|
- GBA Video: Disable BG target 1 blending when OBJ blending (fixes mgba.io/i/2722)
|
||||||
Other fixes:
|
Other fixes:
|
||||||
|
|
|
@ -253,12 +253,17 @@ void GBAAudioWriteSOUNDCNT_X(struct GBAAudio* audio, uint16_t value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBAAudioWriteSOUNDBIAS(struct GBAAudio* audio, uint16_t value) {
|
void GBAAudioWriteSOUNDBIAS(struct GBAAudio* audio, uint16_t value) {
|
||||||
|
GBAAudioSample(audio, mTimingCurrentTime(&audio->p->timing));
|
||||||
audio->soundbias = value;
|
audio->soundbias = value;
|
||||||
int32_t oldSampleInterval = audio->sampleInterval;
|
int32_t oldSampleInterval = audio->sampleInterval;
|
||||||
audio->sampleInterval = 0x200 >> GBARegisterSOUNDBIASGetResolution(value);
|
audio->sampleInterval = 0x200 >> GBARegisterSOUNDBIASGetResolution(value);
|
||||||
if (oldSampleInterval != audio->sampleInterval && audio->p->stream && audio->p->stream->audioRateChanged) {
|
if (oldSampleInterval != audio->sampleInterval) {
|
||||||
|
audio->lastSample += oldSampleInterval * audio->sampleIndex;
|
||||||
|
audio->sampleIndex = 0;
|
||||||
|
if (audio->p->stream && audio->p->stream->audioRateChanged) {
|
||||||
audio->p->stream->audioRateChanged(audio->p->stream, GBA_ARM7TDMI_FREQUENCY / audio->sampleInterval);
|
audio->p->stream->audioRateChanged(audio->p->stream, GBA_ARM7TDMI_FREQUENCY / audio->sampleInterval);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBAAudioWriteWaveRAM(struct GBAAudio* audio, int address, uint32_t value) {
|
void GBAAudioWriteWaveRAM(struct GBAAudio* audio, int address, uint32_t value) {
|
||||||
|
|
Loading…
Reference in New Issue