GBA Audio: Call audioRateChanged on reset if applicable

This commit is contained in:
Vicki Pfau 2024-05-07 22:32:33 -07:00
parent 8106fbf51c
commit e5333f4e7c
1 changed files with 7 additions and 1 deletions

View File

@ -43,6 +43,7 @@ void GBAAudioInit(struct GBAAudio* audio, size_t samples) {
audio->forceDisableChA = false; audio->forceDisableChA = false;
audio->forceDisableChB = false; audio->forceDisableChB = false;
audio->masterVolume = GBA_AUDIO_VOLUME_MAX; audio->masterVolume = GBA_AUDIO_VOLUME_MAX;
audio->sampleInterval = GBA_ARM7TDMI_FREQUENCY / 0x8000;
} }
void GBAAudioReset(struct GBAAudio* audio) { void GBAAudioReset(struct GBAAudio* audio) {
@ -81,7 +82,12 @@ void GBAAudioReset(struct GBAAudio* audio) {
audio->chBLeft = false; audio->chBLeft = false;
audio->chBTimer = false; audio->chBTimer = false;
audio->enable = false; audio->enable = false;
if (audio->sampleInterval != GBA_ARM7TDMI_FREQUENCY / 0x8000) {
audio->sampleInterval = GBA_ARM7TDMI_FREQUENCY / 0x8000; audio->sampleInterval = GBA_ARM7TDMI_FREQUENCY / 0x8000;
if (audio->p->stream && audio->p->stream->audioRateChanged) {
audio->p->stream->audioRateChanged(audio->p->stream, GBA_ARM7TDMI_FREQUENCY / audio->sampleInterval);
}
}
audio->psg.sampleInterval = audio->sampleInterval; audio->psg.sampleInterval = audio->sampleInterval;
} }