#include "game_types.h"

/* Sound_InitChannel4 @ 0x08011CBC (real 56B) -- inits sound channel 4 (table+52, struct+48, enable bit 0x20). Mirrors src/matched/Sound_InitChannel4.c. */
/* Initializes sound channel 4: looks up (table[52], struct[48]), clears
   the wave register, sets enable bit 0x20 in the channel flags, and
   raises the channel strobe. Template shared by channels 0-11. */
extern int Math_InitLookup(int a, int b);

void Sound_InitChannel4(void)
{
    int *cfg = *(int **)0x020001F8;
    int *st = *(int **)0x020001F8;
    Math_InitLookup(*(int *)((char *)cfg + 52), *(int *)((char *)st + 48));
    *(volatile unsigned short *)0x04000208 = 0;
    *(volatile unsigned short *)0x03007FF8 |= 0x20;
    *(volatile unsigned short *)0x04000208 = 1;
}
