mirror of https://github.com/mgba-emu/mgba.git
GB Audio: Fix regressions
This commit is contained in:
parent
1fb7d7a4a3
commit
ad32c0f750
|
@ -164,12 +164,12 @@ mLOG_DECLARE_CATEGORY(GB_STATE);
|
|||
* | 0x00197: Reserved (leave zero)
|
||||
* 0x00198 - 0x0019F: Global cycle counter
|
||||
* 0x001A0 - 0x001A1: Program counter for last cartridge read
|
||||
* 0x001A2 - 0x00247: Reserved (leave zero)
|
||||
* 0x00248 - 0x0025F: Additional audio state
|
||||
* | 0x00248 - 0x0024B: Last sample timestamp
|
||||
* | 0x0024C: Current audio sample index
|
||||
* | 0x0024D - 0x0024F: Reserved (leave zero)
|
||||
* | 0x00250 - 0x0025F: Audio rendered samples
|
||||
* 0x001A2 - 0x001D7: Reserved (leave zero)
|
||||
* 0x001D8 - 0x0025F: Additional audio state
|
||||
* | 0x001D8 - 0x001DB: Last sample timestamp
|
||||
* | 0x001DC: Current audio sample index
|
||||
* | 0x001DD - 0x001DF: Reserved (leave zero)
|
||||
* | 0x001E0 - 0x0025F: Audio rendered samples
|
||||
* 0x00260 - 0x002FF: OAM
|
||||
* 0x00300 - 0x0037F: I/O memory
|
||||
* 0x00380 - 0x003FE: HRAM
|
||||
|
|
|
@ -474,9 +474,8 @@ void GBAudioRun(struct GBAudio* audio, int32_t timestamp, int channels) {
|
|||
if (!audio->enable) {
|
||||
return;
|
||||
}
|
||||
if (audio->p && channels != 0xF && timestamp - audio->lastSample > SAMPLE_INTERVAL) {
|
||||
if (audio->p && channels != 0xF && timestamp - audio->lastSample > (int) (SAMPLE_INTERVAL * audio->timingFactor)) {
|
||||
GBAudioSample(audio, timestamp);
|
||||
return;
|
||||
}
|
||||
|
||||
if (audio->playingCh1 && (channels & 0x1)) {
|
||||
|
@ -747,10 +746,9 @@ void GBAudioSamplePSG(struct GBAudio* audio, int16_t* left, int16_t* right) {
|
|||
}
|
||||
|
||||
void GBAudioSample(struct GBAudio* audio, int32_t timestamp) {
|
||||
timestamp -= audio->lastSample;
|
||||
timestamp -= audio->sampleIndex * SAMPLE_INTERVAL;
|
||||
|
||||
int interval = SAMPLE_INTERVAL * audio->timingFactor;
|
||||
timestamp -= audio->lastSample;
|
||||
timestamp -= audio->sampleIndex * interval;
|
||||
|
||||
int sample;
|
||||
for (sample = audio->sampleIndex; timestamp >= interval && sample < GB_MAX_SAMPLES; ++sample, timestamp -= interval) {
|
||||
|
|
Loading…
Reference in New Issue