libnds: soundDisable() makes lid closing hang the ARM7

Post Reply
User avatar
fincs
( ͡° ͜ʖ ͡°)
Posts: 93
Joined: Mon Jul 12, 2010 9:45 pm
Location: Seville, Spain
Contact:

libnds: soundDisable() makes lid closing hang the ARM7

Post by fincs » Fri Oct 28, 2011 7:50 pm

Hi,
This code:

Code: Select all

#include <nds.h>
#include <stdio.h>

int main()
{
	consoleDemoInit();
	iprintf("Hello World!\n");
	soundEnable();
	int i;
	for (i = 0; i < 60; i ++) swiWaitForVBlank();
	soundDisable();
	iprintf("Now try to close the lid!\n");
	for(;;);
		swiWaitForVBlank();
}
has a problem after soundDisable() is called: if the lid is closed, the ARM7 hangs. I've done some debugging, and this ARM7 line appears to produce the problem:

Code: Select all

void disableSound() { // libnds/source/arm7/audio.c, line 139
    (...)
    powerOff(POWER_SOUND);
}
I'm using the latest version of everything.

EDIT: libnds/source/arm7/system.c, line 64, function powerValueHandler():

Code: Select all

swiChangeSoundBias(0,0x400);
(...)
swiChangeSoundBias(1,0x400);
This won't work because sound registers don't work when the sound HW is powered off. I'd suggest to add a check to only call swiChangeSoundBias() when REG_POWERCNT's bit0 is 1.
Donate to devkitPro - help us stay alive!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests