Welcome! Log In Create A New Profile



Posted by ObsidianX 
March 29, 2012 01:36AM
Hey folks,

I've been trying to get sound to work in my project for a while now and nothing I've tried so far has progressed me past this crash that I hit after a few seconds of audio playback. I've been testing the project in Dolphin and every time it crashes Dolphin tells me this:

Src\HW\Memmap.cpp:672 E[MI]: Unknown Pointer 0x546315a0 PC 0x546315b8 LR 0x546315ba

The values never change and I was wondering if there was any significance to these values? I've tried looking around on the hardware wiki pages but nothing has come up. It doesn't matter what sound is playing at the time of the crash and no matter what it will crash after X amount of sound has played back.

I'm currently using ASNDLib as I couldn't get AESNDLib to stream properly. The sound that does get to play isn't corrupt and sounds as it should.

Any help would be greatly appreciated!

Re: ASND/AESND Crashes
March 29, 2012 05:53AM
Post your code.
Re: ASND/AESND Crashes
March 30, 2012 10:37AM
Well I was trying my best to keep it on the down-low until it was completed but I just can't seem to figure this one out so here's the source for the project:


The ASND implementation is in trunk/arch/Sound/RageSoundDriver_Wii.cpp

snd->GetPCM can be found in trunk/RageSound.cpp:569

The game engine uses Tremor for OGG files and MAD for MP3 files -- both types cause the crash. If GetPCM is commented out then the crash doesn't occur. I've tried using a heap buffer, a data-segment buffer, a stack buffer...

Any help would be greatly appreciated so this project can finally release :)
Re: ASND/AESND Crashes
March 30, 2012 01:25PM
Ok, had a quick look and spotted a big problem right away.
You're using SoundFillBuffer as the callback function for your voices, which means it will get executed by an interrupt handler. That means it can't use mutexes (because mutexes only function properly inside threads and the context isn't in a thread) and it can't use floating point (not supported in interrupt handlers) which will be used by the libMAD decoder in the GetPCM call.

What I suggest is creating a high priority thread and message queue (either roll your own or see libogc's message.h - but beware, the function definitions are slightly wrong). The thread waits for messages to arrive, each message can either specify a voice that needs filling or an exit signal. Then make a new voice callback that simply pushes the appropriate messages to signal the thread.
Tip: Unlike mutexes, you can release semaphores inside a callback (because they're not "owned" by a thread). So a cheap message queue could be implemented by:
- a static u32 array (to hold the messages)
- a semaphore that gets released/incremented when a new message is "pushed" (by the callback) and waited/decremented by the thread when it "pops" a message.
Sorry, only registered users may post in this forum.

Click here to login