SkyEmu
SkyEmu copied to clipboard
Setting DMG initial volume while playing cuts the note
Setting the DMG initial envelop volume while already playing a note cuts the note away. But it's not cut on the actual GBA hardware.
Playback Recordings
Hardware
https://github.com/skylersaleh/SkyEmu/assets/34793045/a2e2205a-0479-4e40-9e96-37b4b5b1749b
SkyEmu
https://github.com/skylersaleh/SkyEmu/assets/34793045/9e7eec6b-67c3-4446-9583-8d0a2d33a9f2
Test ROM
Code
This snippet should be compile fine with devkitARM + libtonc.
#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();
}
}