Closed copyrat90 closed 10 months ago
Setting the sound length while playing is also behaves differently.
https://github.com/nba-emu/NanoBoyAdvance/assets/34793045/9fa9469a-d166-4e0e-b12d-73e16a7039c4
#include <tonc.h>
int main(void) {
irq_init(NULL);
irq_enable(II_VBLANK);
REG_SNDSTAT = SSTAT_ENABLE;
REG_SNDDSCNT = SDS_DMG100;
REG_SNDDMGCNT = SDMG_LVOL(7) | SDMG_RVOL(7) | SDMG_LSQR1 | SDMG_RSQR1;
REG_SND1CNT = SSQR_IVOL(15) | SSQR_TIME(7) | SSQR_LEN(0);
REG_SND1FREQ = SFREQ_RESET | SFREQ_RATE(416) | SFREQ_TIMED;
int wait = 5;
while (1) {
if (--wait == 0) {
REG_SND1CNT = SSQR_IVOL(15) | SSQR_TIME(7) | SSQR_LEN(0);
wait = 5;
}
VBlankIntrWait();
}
}
Also, setting the initial envelop volume while playing shouldn't cut the note away.
Hardware
https://github.com/nba-emu/NanoBoyAdvance/assets/34793045/48a8b338-8a3b-40dc-a3ae-2b7496a6b753
NBA
https://github.com/nba-emu/NanoBoyAdvance/assets/34793045/57ba6505-0cf8-4934-9844-934ec3267b08
#include <tonc.h>
int main(void) {
irq_init(NULL);
irq_enable(II_VBLANK);
REG_SNDSTAT = SSTAT_ENABLE;
REG_SNDDSCNT = SDS_DMG100;
REG_SNDDMGCNT = SDMG_LVOL(7) | SDMG_RVOL(7) | SDMG_LSQR1 | SDMG_RSQR1;
REG_SND1CNT = SSQR_IVOL(15) | SSQR_TIME(0);
REG_SND1FREQ = SFREQ_RESET | SFREQ_RATE(416);
int wait = 45;
while (1) {
if (--wait == 0) {
REG_SND1CNT = SSQR_IVOL(7) | SSQR_TIME(0);
}
VBlankIntrWait();
}
}
Thanks for all these tests. I will take a look at this asap!
All three tests should be fixed with commit https://github.com/nba-emu/NanoBoyAdvance/commit/ba587e4ee063226ab6712746fc100273ff65103a. Most of these issues were caused by implementing the bugged envelope "Zombie" mode described to exist in GB sound documentation. However it turns out that the "Zombie" mode may have been fixed on GBA systems.
This change can be tested with the latest development build.
In the hardware, the envelop goes as expected, but in NBA it stops the sound immediately.
Hardware -> NBA recording
https://github.com/nba-emu/NanoBoyAdvance/assets/34793045/7341a28e-f89e-4710-9dc1-1a639bf18e74
Test ROM
F0_F7_no_retrig.zip
Code