#43592 - Pacifist - Wed May 25, 2005 12:00 am
Since the ARM7 runs the sounds and my game is on the ARM9 I need a way to tell the ARM7 when to play sounds.
Is there a good way to do this? The only method that springs to mind is adding things to the IPC but I don't like the sound of that at all.
Forgive me if if this has been discussed and I just haven't dug enough.
#43603 - tepples - Wed May 25, 2005 2:34 am
The Super NES had an IPC only four bytes wide in each direction. Just be glad you're not coding on that.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#43848 - DekuTree64 - Fri May 27, 2005 8:44 am
Yeah, I did it with an IPC-type structure, just placed right after the IPC:
Code: |
// Commands filled out by ARM9 to tell ARM7 what to do
typedef struct _SND_COMMAND
{
u8 cmdType; // SND_COMMAND_TYPE enum
u8 param[3]; // Depend on cmdType
u32 param32; // Mainly for commands that need to send a pointer
} SND_COMMAND;
// Processor communication area
typedef struct _SND_CONTROL
{
SND_COMMAND cmd[MAX_SND_COMMANDS];
u8 curCmd;
BOOL bInitialized;
} SND_CONTROL;
#define sndControl ((SND_CONTROL*)(IPC_ADDR + sizeof(TransferRegion))) |
Then ARM9 writes commands to that buffer, and then increments the curCmd. ARM7 checks curCmd every frame and compares it to its own current command index to see if any new ones have been sent.
The command struct is pretty arbitrary, I just set up the params that way so it's nice and 4-byte aligned, and has 4 bytes worth of param so ARM9 can send pointers to song data and stuff.
Hopefully I'll be able to release the MOD player that uses it in the next couple of days, maybe get some music going in any GBAX entries that wouldn't have time for sound otherwise :)
Just gotta speed up the pattern loading (it uses straight .mod files, so it has to convert periods in the pattern data into note numbers, and currently uses a dumb loop that takes several frames to run...), and get things tidied up a little.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku
#43871 - Pacifist - Fri May 27, 2005 3:27 pm
Yeah this is exactly what I ended up doing.