mirror of https://github.com/mgba-emu/mgba.git
GB Audio: Fix channels 1/2 not playing when resetting volume (fixes #2614)
This commit is contained in:
parent
4fefa0c51a
commit
083585b565
1
CHANGES
1
CHANGES
|
@ -3,6 +3,7 @@ Features:
|
|||
- New unlicensed GB mappers: NT (older types 1 and 2), Li Cheng, GGB-81
|
||||
- Debugger: Add range watchpoints
|
||||
Emulation fixes:
|
||||
- GB Audio: Fix channels 1/2 not playing when resetting volume (fixes mgba.io/i/2614)
|
||||
- GB Serialize: Don't write BGP/OBP when loading SCGB state (fixes mgba.io/i/2694)
|
||||
- GB SIO: Further fix bidirectional transfer starting
|
||||
- GBA: Fix resetting key IRQ state (fixes mgba.io/i/2716)
|
||||
|
|
|
@ -480,7 +480,7 @@ void GBAudioRun(struct GBAudio* audio, int32_t timestamp, int channels) {
|
|||
GBAudioSample(audio, timestamp);
|
||||
}
|
||||
|
||||
if (audio->playingCh1 && (channels & 0x1)) {
|
||||
if (audio->playingCh1 && (channels & 0x1) && audio->ch1.envelope.dead != 2) {
|
||||
int period = 4 * (2048 - audio->ch1.control.frequency) * audio->timingFactor;
|
||||
int32_t diff = timestamp - audio->ch1.lastUpdate;
|
||||
if (diff >= period) {
|
||||
|
@ -490,7 +490,7 @@ void GBAudioRun(struct GBAudio* audio, int32_t timestamp, int channels) {
|
|||
_updateSquareSample(&audio->ch1);
|
||||
}
|
||||
}
|
||||
if (audio->playingCh2 && (channels & 0x2)) {
|
||||
if (audio->playingCh2 && (channels & 0x2) && audio->ch2.envelope.dead != 2) {
|
||||
int period = 4 * (2048 - audio->ch2.control.frequency) * audio->timingFactor;
|
||||
int32_t diff = timestamp - audio->ch2.lastUpdate;
|
||||
if (diff >= period) {
|
||||
|
@ -863,7 +863,7 @@ bool _writeEnvelope(struct GBAudioEnvelope* envelope, uint8_t value, enum GBAudi
|
|||
envelope->currentVolume &= 0xF;
|
||||
}
|
||||
_updateEnvelopeDead(envelope);
|
||||
return (envelope->initialVolume || envelope->direction) && envelope->dead != 2;
|
||||
return envelope->initialVolume || envelope->direction;
|
||||
}
|
||||
|
||||
static void _updateSquareSample(struct GBAudioSquareChannel* ch) {
|
||||
|
|
Loading…
Reference in New Issue