Merge struct audiohandle and struct sndstate

This commit is contained in:
Ryan Dwyer 2021-11-10 22:28:22 +10:00
parent ecc4493e8c
commit 80de3d4209
21 changed files with 185 additions and 207 deletions

View File

@ -159,16 +159,10 @@ typedef struct {
} N_AL19Event; } N_AL19Event;
typedef struct { typedef struct {
struct audiohandle *handle; struct sndstate *sndstate;
u32 data; u32 data;
} N_ALGenericEvent; } N_ALGenericEvent;
struct audiohandle;
typedef struct {
struct audiohandle *handle;
} N_AL400Event;
typedef struct { typedef struct {
s16 type; s16 type;
union { union {
@ -185,7 +179,6 @@ typedef struct {
N_ALOscEvent osc; N_ALOscEvent osc;
N_AL18Event evt18; N_AL18Event evt18;
N_AL19Event evt19; N_AL19Event evt19;
N_AL400Event evt400;
N_ALGenericEvent generic; N_ALGenericEvent generic;
} msg; } msg;
} N_ALEvent; } N_ALEvent;

View File

@ -55,7 +55,7 @@
u32 var8009d0d0[2]; u32 var8009d0d0[2];
s32 var8009d0d8; s32 var8009d0d8;
u32 var8009d0dc; u32 var8009d0dc;
struct audiohandle *g_BgunAudioHandles[4]; struct sndstate *g_BgunAudioHandles[4];
u32 var8009d0f0; u32 var8009d0f0;
u32 var8009d0f4; u32 var8009d0f4;
u32 var8009d0f8; u32 var8009d0f8;
@ -117,7 +117,7 @@ u32 var8009d14c;
u32 var8009d0d0[2]; u32 var8009d0d0[2];
s32 var8009d0d8; s32 var8009d0d8;
struct audiohandle *g_BgunAudioHandles[4]; struct sndstate *g_BgunAudioHandles[4];
struct fireslot g_Fireslots[NUM_FIRESLOTS]; struct fireslot g_Fireslots[NUM_FIRESLOTS];
u32 fill2[1]; u32 fill2[1];
#endif #endif
@ -6908,7 +6908,7 @@ const char var7f1ab898[] = "rofftime";
// } // }
// //
// if (playsound) { // if (playsound) {
// struct audiohandle *handle; // struct sndstate *handle;
// //
//#if VERSION >= VERSION_NTSC_1_0 //#if VERSION >= VERSION_NTSC_1_0
// OSPri prevpri = osGetThreadPri(0); // OSPri prevpri = osGetThreadPri(0);
@ -7748,10 +7748,10 @@ s32 bgunTickIncAttackEmpty(struct handweaponinfo *info, s32 handnum, struct hand
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
OSPri prevpri = osGetThreadPri(0); OSPri prevpri = osGetThreadPri(0);
struct audiohandle *handle; struct sndstate *handle;
osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1); osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1);
#else #else
struct audiohandle *handle; struct sndstate *handle;
#endif #endif
handle = sndStart(var80095200, SFX_HIT_WATER, NULL, -1, -1, -1, -1, -1); handle = sndStart(var80095200, SFX_HIT_WATER, NULL, -1, -1, -1, -1, -1);
@ -7774,10 +7774,10 @@ s32 bgunTickIncAttackEmpty(struct handweaponinfo *info, s32 handnum, struct hand
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
OSPri prevpri = osGetThreadPri(0); OSPri prevpri = osGetThreadPri(0);
struct audiohandle *handle; struct sndstate *handle;
osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1); osSetThreadPri(0, osGetThreadPri(&g_AudioManager.thread) + 1);
#else #else
struct audiohandle *handle; struct sndstate *handle;
#endif #endif
handle = sndStart(var80095200, SFX_FIREEMPTY, NULL, -1, -1, -1, -1, -1); handle = sndStart(var80095200, SFX_FIREEMPTY, NULL, -1, -1, -1, -1, -1);
@ -8135,21 +8135,21 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand *
&& !g_PlayerInvincible && !g_PlayerInvincible
&& !g_Vars.currentplayer->isdead) { && !g_Vars.currentplayer->isdead) {
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
struct audiohandle *handle1; struct sndstate *handle1;
f32 speed1; f32 speed1;
struct audiohandle *handle2; struct sndstate *handle2;
OSPri prevpri1; OSPri prevpri1;
f32 speed2; f32 speed2;
OSPri prevpri2; OSPri prevpri2;
struct audiohandle *handle3; struct sndstate *handle3;
f32 speed3; f32 speed3;
OSPri prevpri3; OSPri prevpri3;
#else #else
struct audiohandle *handle1; struct sndstate *handle1;
f32 speed1; f32 speed1;
struct audiohandle *handle2; struct sndstate *handle2;
f32 speed2; f32 speed2;
struct audiohandle *handle3; struct sndstate *handle3;
f32 speed3; f32 speed3;
#endif #endif
@ -27168,7 +27168,7 @@ glabel var7f1aca90
/** /**
* Find and return an available audio handle out of a pool of four. * Find and return an available audio handle out of a pool of four.
*/ */
struct audiohandle **bgunAllocateAudioHandle(void) struct sndstate **bgunAllocateAudioHandle(void)
{ {
s32 i; s32 i;
@ -27186,7 +27186,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum)
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
u32 rand1 = random(); u32 rand1 = random();
u32 rand2 = random(); u32 rand2 = random();
struct audiohandle **handle; struct sndstate **handle;
if (g_Vars.lvupdate240 <= 0) { if (g_Vars.lvupdate240 <= 0) {
return; return;
@ -27331,7 +27331,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum)
#else #else
u32 rand1 = random(); u32 rand1 = random();
u32 rand2 = random(); u32 rand2 = random();
struct audiohandle **handle; struct sndstate **handle;
if (g_Vars.lvupdate240 <= 0) { if (g_Vars.lvupdate240 <= 0) {
return; return;
@ -27465,7 +27465,7 @@ void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum)
void bgun0f0a8404(struct coord *pos, s16 *rooms, s32 arg2) void bgun0f0a8404(struct coord *pos, s16 *rooms, s32 arg2)
{ {
if (g_Vars.lvupdate240 > 0) { if (g_Vars.lvupdate240 > 0) {
struct audiohandle **handle = bgunAllocateAudioHandle(); struct sndstate **handle = bgunAllocateAudioHandle();
if (handle) { if (handle) {
sndStart(var80095200, SFX_HIT_GLASS, handle, -1, -1, -1, -1, -1); sndStart(var80095200, SFX_HIT_GLASS, handle, -1, -1, -1, -1, -1);
@ -27480,7 +27480,7 @@ void bgun0f0a8404(struct coord *pos, s16 *rooms, s32 arg2)
void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s16 *arg3) void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s16 *arg3)
{ {
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
struct audiohandle **handle; struct sndstate **handle;
u32 rand1 = random(); u32 rand1 = random();
u32 rand2 = random(); u32 rand2 = random();
bool playdefault; bool playdefault;
@ -27579,7 +27579,7 @@ void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s
} }
} }
#else #else
struct audiohandle **handle; struct sndstate **handle;
u32 rand1 = random(); u32 rand1 = random();
u32 rand2 = random(); u32 rand2 = random();
s16 soundnum; s16 soundnum;

View File

@ -12018,7 +12018,7 @@ bool aiChrBeginOrEndTeleport(void)
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
s32 audiopri; s32 audiopri;
#endif #endif
struct audiohandle *handle; struct sndstate *handle;
fvalue = 0.4; fvalue = 0.4;
chr = chrFindById(g_Vars.chrdata, cmd[4]); chr = chrFindById(g_Vars.chrdata, cmd[4]);
prevplayernum = g_Vars.currentplayernum; prevplayernum = g_Vars.currentplayernum;
@ -12076,7 +12076,7 @@ bool aiIfChrTeleportFullWhite(void)
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
s32 audiopri; s32 audiopri;
#endif #endif
struct audiohandle *handle; struct sndstate *handle;
if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) {
u32 playernum = propGetPlayerNum(chr->prop); u32 playernum = propGetPlayerNum(chr->prop);

View File

@ -197,7 +197,7 @@ void menuPlaySound(s32 menusound)
} }
if (sound != -1) { if (sound != -1) {
struct audiohandle *handle; struct sndstate *handle;
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
OSPri prevpri = osGetThreadPri(NULL); OSPri prevpri = osGetThreadPri(NULL);

View File

@ -3463,7 +3463,7 @@ void hudmsgsTick(void)
sndStart(var80095200, SFX_HUDMSG, NULL, -1, -1, -1, -1, -1); sndStart(var80095200, SFX_HUDMSG, NULL, -1, -1, -1, -1, -1);
#else #else
// Probable mismatch here for ntsc-beta // Probable mismatch here for ntsc-beta
static struct audiohandle *var800736b0nb = NULL; static struct sndstate *var800736b0nb = NULL;
sndStart(var80095200, SFX_HUDMSG, &var800736b0nb, -1, -1, -1, -1, -1); sndStart(var80095200, SFX_HUDMSG, &var800736b0nb, -1, -1, -1, -1, -1);
#endif #endif
} }

View File

@ -106,7 +106,7 @@
#include "data.h" #include "data.h"
#include "types.h" #include "types.h"
struct audiohandle *g_MiscSfxAudioHandles[3]; struct sndstate *g_MiscSfxAudioHandles[3];
u32 var800aa5bc; u32 var800aa5bc;
s32 g_MiscSfxActiveTypes[3]; s32 g_MiscSfxActiveTypes[3];
@ -121,7 +121,7 @@ s32 g_StageTimeElapsed60 = 0;
s32 g_MpTimeLimit60 = SECSTOTIME60(60 * 10); // 10 minutes s32 g_MpTimeLimit60 = SECSTOTIME60(60 * 10); // 10 minutes
s32 g_MpScoreLimit = 10; s32 g_MpScoreLimit = 10;
s32 g_MpTeamScoreLimit = 20; s32 g_MpTeamScoreLimit = 20;
struct audiohandle *g_MiscAudioHandle = NULL; struct sndstate *g_MiscAudioHandle = NULL;
s32 g_NumReasonsToEndMpMatch = 0; s32 g_NumReasonsToEndMpMatch = 0;
f32 g_StageTimeElapsed1f = 0; f32 g_StageTimeElapsed1f = 0;
bool var80084040 = true; bool var80084040 = true;
@ -3792,7 +3792,7 @@ Gfx *lvRender(Gfx *gdl)
} }
if (var80075d78 <= 0) { if (var80075d78 <= 0) {
static struct audiohandle *g_CutsceneStaticAudioHandle = NULL; static struct sndstate *g_CutsceneStaticAudioHandle = NULL;
static s32 g_CutsceneStaticTimer = 100; static s32 g_CutsceneStaticTimer = 100;
static u8 g_CutsceneStaticActive = false; static u8 g_CutsceneStaticActive = false;
bool cutscenehasstatic = false; bool cutscenehasstatic = false;

View File

@ -2841,7 +2841,7 @@ Gfx *nbombCreateGdl(void)
return gdlstart; return gdlstart;
} }
struct audiohandle *g_NbombAudioHandle = NULL; struct sndstate *g_NbombAudioHandle = NULL;
Gfx *nbombRender(Gfx *gdl, struct nbomb *nbomb, Gfx *subgdl) Gfx *nbombRender(Gfx *gdl, struct nbomb *nbomb, Gfx *subgdl)
{ {

View File

@ -446,7 +446,7 @@ void weaponPlayWhooshSound(s32 weaponnum, struct prop *prop)
if (soundnum != -1) { if (soundnum != -1) {
if (prop == g_Vars.currentplayer->prop) { if (prop == g_Vars.currentplayer->prop) {
struct audiohandle *handle; struct sndstate *handle;
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
u32 stack; u32 stack;
OSPri prevpri = osGetThreadPri(0); OSPri prevpri = osGetThreadPri(0);
@ -481,7 +481,7 @@ void func0f060bac(s32 weaponnum, struct prop *prop)
{ {
s32 soundnum = -1; s32 soundnum = -1;
f32 speed = 1; f32 speed = 1;
struct audiohandle *handle; struct sndstate *handle;
if (weaponnum == WEAPON_UNARMED) { if (weaponnum == WEAPON_UNARMED) {
soundnum = SFX_THUD_808F; soundnum = SFX_THUD_808F;

View File

@ -121,7 +121,7 @@ struct monitorthing *g_MonitorThings;
u32 g_TintedGlassEnabled = 0; u32 g_TintedGlassEnabled = 0;
s32 g_AlarmTimer = 0; s32 g_AlarmTimer = 0;
struct audiohandle *g_AlarmAudioHandle = NULL; struct sndstate *g_AlarmAudioHandle = NULL;
f32 g_AlarmSpeakerWeight = 64; f32 g_AlarmSpeakerWeight = 64;
f32 g_AlarmSpeakerDirection = 1; f32 g_AlarmSpeakerDirection = 1;
f32 g_GasReleaseTimer240 = 0; f32 g_GasReleaseTimer240 = 0;
@ -129,7 +129,7 @@ bool g_GasReleasing = false;
struct coord g_GasPos = {0}; struct coord g_GasPos = {0};
s32 g_GasLastCough60 = 0; s32 g_GasLastCough60 = 0;
f32 g_GasSoundTimer240 = 0; f32 g_GasSoundTimer240 = 0;
struct audiohandle *g_GasAudioHandle = NULL; struct sndstate *g_GasAudioHandle = NULL;
u32 g_CountdownTimerOff = COUNTDOWNTIMERREASON_AI; u32 g_CountdownTimerOff = COUNTDOWNTIMERREASON_AI;
bool g_CountdownTimerRunning = false; bool g_CountdownTimerRunning = false;
f32 g_CountdownTimerValue60 = 0; f32 g_CountdownTimerValue60 = 0;

View File

@ -246,7 +246,7 @@ void sightTick(bool sighton)
if (sighton) { if (sighton) {
if (g_Vars.currentplayer->lookingatprop.prop) { if (g_Vars.currentplayer->lookingatprop.prop) {
if (g_Vars.currentplayer->lookingatprop.prop != g_Vars.currentplayer->cmpfollowprops[0].prop) { if (g_Vars.currentplayer->lookingatprop.prop != g_Vars.currentplayer->cmpfollowprops[0].prop) {
struct audiohandle *handle; struct sndstate *handle;
handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1); handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1);
@ -272,7 +272,7 @@ void sightTick(bool sighton)
index = sightFindFreeTargetIndex(1); index = sightFindFreeTargetIndex(1);
if (index >= 0) { if (index >= 0) {
struct audiohandle *handle; struct sndstate *handle;
handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1); handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1);
@ -295,7 +295,7 @@ void sightTick(bool sighton)
index = sightFindFreeTargetIndex(4); index = sightFindFreeTargetIndex(4);
if (index >= 0) { if (index >= 0) {
struct audiohandle *handle; struct sndstate *handle;
handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1); handle = snd00010718(&handle, 0, 0x7fff, 0x40, 7, 1, 1, -1, 1);

View File

@ -1902,7 +1902,7 @@ u32 var80062854 = 0x00000000;
u32 var80062858 = 0x00000000; u32 var80062858 = 0x00000000;
u32 var8006285c = 0x00000000; u32 var8006285c = 0x00000000;
u32 var80062860 = 0x447a0000; u32 var80062860 = 0x447a0000;
struct audiohandle *g_TitleAudioHandle = NULL; struct sndstate *g_TitleAudioHandle = NULL;
u32 var80062868 = 0x00000000; u32 var80062868 = 0x00000000;
u32 var8006286c = 0x00000000; u32 var8006286c = 0x00000000;

View File

@ -128,7 +128,7 @@ extern struct criteria_multiroomentered *g_MultiroomEnteredCriterias;
extern struct criteria_holograph *g_HolographCriterias; extern struct criteria_holograph *g_HolographCriterias;
extern u32 var8009d0d0[2]; extern u32 var8009d0d0[2];
extern s32 var8009d0d8; extern s32 var8009d0d8;
extern struct audiohandle *g_BgunAudioHandles[4]; extern struct sndstate *g_BgunAudioHandles[4];
extern struct fireslot g_Fireslots[]; extern struct fireslot g_Fireslots[];
extern struct casing g_Casings[20]; extern struct casing g_Casings[20];
extern struct var8009da60 var8009da60[8]; extern struct var8009da60 var8009da60[8];

View File

@ -3412,6 +3412,11 @@
#define SMOKETYPE_DEBRIS 21 // Crash site cockpit, Skedar Ruins outro #define SMOKETYPE_DEBRIS 21 // Crash site cockpit, Skedar Ruins outro
#define SMOKETYPE_UFO 22 // AF1 outro #define SMOKETYPE_UFO 22 // AF1 outro
#define SNDSTATEFLAG_01 0x01
#define SNDSTATEFLAG_02 0x02
#define SNDSTATEFLAG_04 0x04
#define SNDSTATEFLAG_10 0x10
#define SOLOSTAGEINDEX_DEFECTION 0x00 #define SOLOSTAGEINDEX_DEFECTION 0x00
#define SOLOSTAGEINDEX_INVESTIGATION 0x01 #define SOLOSTAGEINDEX_INVESTIGATION 0x01
#define SOLOSTAGEINDEX_EXTRACTION 0x02 #define SOLOSTAGEINDEX_EXTRACTION 0x02

View File

@ -199,14 +199,14 @@ extern s16 var80067ff0[];
extern f32 var80069880; extern f32 var80069880;
extern u32 g_TintedGlassEnabled; extern u32 g_TintedGlassEnabled;
extern s32 g_AlarmTimer; extern s32 g_AlarmTimer;
extern struct audiohandle *g_AlarmAudioHandle; extern struct sndstate *g_AlarmAudioHandle;
extern f32 g_AlarmSpeakerWeight; extern f32 g_AlarmSpeakerWeight;
extern f32 g_GasReleaseTimer240; extern f32 g_GasReleaseTimer240;
extern bool g_GasReleasing; extern bool g_GasReleasing;
extern struct coord g_GasPos; extern struct coord g_GasPos;
extern s32 g_GasLastCough60; extern s32 g_GasLastCough60;
extern f32 g_GasSoundTimer240; extern f32 g_GasSoundTimer240;
extern struct audiohandle *g_GasAudioHandle; extern struct sndstate *g_GasAudioHandle;
extern u32 g_CountdownTimerOff; extern u32 g_CountdownTimerOff;
extern bool g_CountdownTimerRunning; extern bool g_CountdownTimerRunning;
extern f32 g_CountdownTimerValue60; extern f32 g_CountdownTimerValue60;

View File

@ -136,7 +136,7 @@ void bgunTickMaulerCharge(void);
void bgun0f0a6c30(void); void bgun0f0a6c30(void);
s32 bgunAllocateFireslot(void); s32 bgunAllocateFireslot(void);
void bgun0f0a7138(Gfx **gdl); void bgun0f0a7138(Gfx **gdl);
struct audiohandle **bgunAllocateAudioHandle(void); struct sndstate **bgunAllocateAudioHandle(void);
void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum); void bgunPlayPropHitSound(struct gset *gset, struct prop *prop, s32 texturenum);
void bgun0f0a8404(struct coord *pos, s16 *rooms, s32 arg2); void bgun0f0a8404(struct coord *pos, s16 *rooms, s32 arg2);
void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s16 *arg3); void bgunPlayBgHitSound(struct gset *gset, struct coord *arg1, s32 texturenum, s16 *arg3);

View File

@ -26,7 +26,7 @@ u32 func0f094940(void);
u32 func0f094b1c(void); u32 func0f094b1c(void);
u32 func0f094d78(void); u32 func0f094d78(void);
void func0f094ef4(struct coord *pos, s16 *rooms, s32 soundnum, s32 *arg3, s32 *arg4); void func0f094ef4(struct coord *pos, s16 *rooms, s32 soundnum, s32 *arg3, s32 *arg4);
void func0f09505c(struct audiohandle *handle, struct coord *pos, f32 arg2, f32 arg3, f32 arg4, s16 *rooms, s16 soundnum, u16 arg7, u32 arg8); void func0f09505c(struct sndstate *handle, struct coord *pos, f32 arg2, f32 arg3, f32 arg4, s16 *rooms, s16 soundnum, u16 arg7, u32 arg8);
u32 func0f095200(void); u32 func0f095200(void);
s32 func0f095278(s32 channelnum); s32 func0f095278(s32 channelnum);

View File

@ -4,21 +4,21 @@
#include "data.h" #include "data.h"
#include "types.h" #include "types.h"
void func00033090(struct audiohandle *handle); void func00033090(struct sndstate *handle);
u32 func00033100(void); u32 func00033100(void);
u16 sndpCountStates(s16 *numfreeptr, s16 *numallocedptr); u16 sndpCountStates(s16 *numfreeptr, s16 *numallocedptr);
void func00033378(void *fn); void func00033378(void *fn);
u32 func00033390(void); u32 func00033390(void);
void func00033634(void *fn); void func00033634(void *fn);
bool audioIsPlaying(struct audiohandle *handle); bool audioIsPlaying(struct sndstate *handle);
struct audiohandle *func00033820(s32 arg0, s16 soundnum, s32 arg2, s32 arg3, f32 arg4, s32 arg5, s32 arg6, struct audiohandle **handle); struct sndstate *func00033820(s32 arg0, s16 soundnum, s32 arg2, s32 arg3, f32 arg4, s32 arg5, s32 arg6, struct sndstate **handle);
void audioStop(struct audiohandle *handle); void audioStop(struct sndstate *handle);
void func00033bc0(struct audiohandle *handle); void func00033bc0(struct sndstate *handle);
void func00033db0(void); void func00033db0(void);
void func00033dd8(void); void func00033dd8(void);
void audioPostEvent(struct audiohandle *handle, s16 type, s32 data); void audioPostEvent(struct sndstate *handle, s16 type, s32 data);
u16 func00033ec4(u8 index); u16 func00033ec4(u8 index);
struct audiohandle *func00033f08(void); struct sndstate *func00033f08(void);
ALMicroTime sndpGetCurTime(void); ALMicroTime sndpGetCurTime(void);
void func00033f44(u8 index, u16 volume); void func00033f44(u8 index, u16 volume);

View File

@ -32,9 +32,9 @@ void snd0000fe50(void);
void sndTick(void); void sndTick(void);
bool sndIsDisabled(void); bool sndIsDisabled(void);
void snd0001036c(u8 arg0); void snd0001036c(u8 arg0);
void sndAdjust(struct audiohandle **handle, s32 arg1, s32 arg2, s32 speakerweight, s16 soundnum, f32 arg5, s32 arg6, s32 arg7, s32 arg8); void sndAdjust(struct sndstate **handle, s32 arg1, s32 arg2, s32 speakerweight, s16 soundnum, f32 arg5, s32 arg6, s32 arg7, s32 arg8);
struct audiohandle *snd00010718(struct audiohandle **handle, s32 arg1, s32 arg2, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7, s32 arg8); struct sndstate *snd00010718(struct sndstate **handle, s32 arg1, s32 arg2, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7, s32 arg8);
struct audiohandle *sndStart(s32 arg0, s16 sound, struct audiohandle **handle, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7); struct sndstate *sndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7);
void snd00010ae4(s32 soundnum, s32 arg1, s32 arg2, s32 arg3); void snd00010ae4(s32 soundnum, s32 arg1, s32 arg2, s32 arg3);
void sndPlayNosedive(s32 seconds); void sndPlayNosedive(s32 seconds);
void sndStopNosedive(void); void sndStopNosedive(void);

View File

@ -2123,29 +2123,32 @@ struct eyespy {
/*0x7c*/ f32 pitch; /*0x7c*/ f32 pitch;
}; };
struct var8005f120_08_04 { struct sndstate_08_04 {
u16 unk00; u16 unk00;
u8 unk02; u8 unk02;
}; };
struct audiohandle_08 { struct sndstate_08 {
u32 unk00; u32 unk00;
struct var8005f120_08_04 *unk04; struct sndstate_08_04 *unk04;
}; };
struct audiohandle { struct sndstate {
/*0x00*/ ALLink node; /*0x00*/ ALLink node;
/*0x08*/ struct audiohandle_08 *unk08; /*0x08*/ struct sndstate_08 *unk08;
/*0x0c*/ N_ALVoice voice; /*0x0c*/ N_ALVoice voice;
/*0x28*/ u32 unk28; /*0x28*/ u32 unk28;
/*0x2c*/ u32 unk2c; /*0x2c*/ u32 unk2c;
/*0x30*/ struct audiohandle **unk30; /*0x30*/ struct sndstate **unk30;
/*0x34*/ u32 unk34; /*0x34*/ u32 unk34;
/*0x38*/ u32 unk38; /*0x38*/ u32 unk38;
/*0x3c*/ u32 unk3c; /*0x3c*/ u32 unk3c;
/*0x40*/ u32 unk40; /*0x40*/ u32 unk40;
/*0x44*/ u8 unk44; /*0x44*/ u8 flags;
/*0x45*/ u8 playing; /*0x45*/ u8 playing;
#if VERSION >= VERSION_NTSC_1_0
/*0x48*/ u32 unk48;
#endif
}; };
/** /**
@ -2276,8 +2279,8 @@ struct hand {
/*0x07e8*/ struct coord adjustpos; /*0x07e8*/ struct coord adjustpos;
/*0x07f4*/ f32 xshift; /*0x07f4*/ f32 xshift;
/*0x07f8*/ struct coord aimpos; /*0x07f8*/ struct coord aimpos;
/*0x0804*/ struct audiohandle *audiohandle2; /*0x0804*/ struct sndstate *audiohandle2;
/*0x0808*/ struct audiohandle *audiohandle3; /*0x0808*/ struct sndstate *audiohandle3;
/*0x080c*/ s32 allowshootframe; /*0x080c*/ s32 allowshootframe;
/*0x0810*/ s32 lastshootframe60; /*0x0810*/ s32 lastshootframe60;
/*0x0814*/ struct beam beam; /*0x0814*/ struct beam beam;
@ -2434,7 +2437,7 @@ struct hand {
/*0x0d74*/ u16 gunroundsspent[4]; // actually a countdown timer /*0x0d74*/ u16 gunroundsspent[4]; // actually a countdown timer
/*0x0d7c*/ u32 ispare1; /*0x0d7c*/ u32 ispare1;
/*0x0d80*/ struct guncmd *unk0d80; /*0x0d80*/ struct guncmd *unk0d80;
/*0x0d84*/ struct audiohandle *audiohandle; /*0x0d84*/ struct sndstate *audiohandle;
/*0x0d88*/ u32 ispare4; /*0x0d88*/ u32 ispare4;
/*0x0d8c*/ u32 ispare5; /*0x0d8c*/ u32 ispare5;
/*0x0d90*/ u32 ispare6; /*0x0d90*/ u32 ispare6;
@ -2556,7 +2559,7 @@ struct player {
/*0x00d4*/ struct model *model00d4; /*0x00d4*/ struct model *model00d4;
/*0x00d8*/ bool isdead; /*0x00d8*/ bool isdead;
/*0x00dc*/ f32 bondhealth; // frac (range 0-1) /*0x00dc*/ f32 bondhealth; // frac (range 0-1)
/*0x00e0*/ struct audiohandle *chokehandle; /*0x00e0*/ struct sndstate *chokehandle;
/*0x00e4*/ f32 oldhealth; /*0x00e4*/ f32 oldhealth;
/*0x00e8*/ f32 oldarmour; /*0x00e8*/ f32 oldarmour;
/*0x00ec*/ f32 apparenthealth; /*0x00ec*/ f32 apparenthealth;
@ -3765,8 +3768,8 @@ struct fireslotthing {
struct fireslot { struct fireslot {
/*0x00*/ s32 endlvframe; /*0x00*/ s32 endlvframe;
#if VERSION < VERSION_NTSC_1_0 #if VERSION < VERSION_NTSC_1_0
struct audiohandle *unk04nb; struct sndstate *unk04nb;
struct audiohandle *unk08nb; struct sndstate *unk08nb;
#endif #endif
/*0x04*/ struct beam beam; /*0x04*/ struct beam beam;
}; };
@ -5783,7 +5786,7 @@ struct weatherdata {
/*0x28*/ u32 unk28; /*0x28*/ u32 unk28;
/*0x2c*/ u32 unk2c; /*0x2c*/ u32 unk2c;
/*0x30*/ u32 unk30; /*0x30*/ u32 unk30;
/*0x34*/ struct audiohandle *audiohandles[4]; /*0x34*/ struct sndstate *audiohandles[4];
/*0x44*/ s32 unk44; /*0x44*/ s32 unk44;
/*0x48*/ s32 unk48; /*0x48*/ s32 unk48;
/*0x4c*/ s32 unk4c; /*0x4c*/ s32 unk4c;
@ -6693,7 +6696,7 @@ struct shard {
}; };
struct audiochannel { struct audiochannel {
/*0x00*/ struct audiohandle *audiohandle; /*0x00*/ struct sndstate *audiohandle;
/*0x04*/ s16 soundnum04; /*0x04*/ s16 soundnum04;
/*0x06*/ s16 unk06; /*0x06*/ s16 unk06;
/*0x08*/ s16 unk08; /*0x08*/ s16 unk08;
@ -6827,8 +6830,8 @@ struct nbomb {
s16 unk14; s16 unk14;
f32 unk18; f32 unk18;
struct prop *prop; struct prop *prop;
struct audiohandle *audiohandle20; struct sndstate *audiohandle20;
struct audiohandle *audiohandle24; struct sndstate *audiohandle24;
}; };
struct roomacousticdata { struct roomacousticdata {
@ -7346,29 +7349,6 @@ struct var8007f8dc {
/*0x100*/ u32 unk100; /*0x100*/ u32 unk100;
}; };
struct sndstate {
ALLink node;
u32 unk08;
u32 unk0c;
u32 unk10;
u32 unk14;
u32 unk18;
u32 unk1c;
u32 unk20;
u32 unk24;
u32 unk28;
u32 unk2c;
u32 unk30;
u32 unk34;
u32 unk38;
u32 unk3c;
u32 unk40;
u32 unk44;
#if VERSION >= VERSION_NTSC_1_0
u32 unk48;
#endif
};
struct asistream { struct asistream {
s32 unk00; s32 unk00;
s32 (*unk04)(s32 arg0, void *arg1, s32 arg2, s32 arg3); s32 (*unk04)(s32 arg0, void *arg1, s32 arg2, s32 arg3);

View File

@ -9,20 +9,20 @@
u32 var8009c330; u32 var8009c330;
s16 *var8009c334; s16 *var8009c334;
struct audiohandle *g_SndpAllocHandlesHead = NULL; struct sndstate *g_SndpAllocStatesHead = NULL;
struct audiohandle *g_SndpAllocHandlesTail = NULL; struct sndstate *g_SndpAllocStatesTail = NULL;
struct audiohandle *g_SndpFreeHandlesHead = NULL; struct sndstate *g_SndpFreeStatesHead = NULL;
N_ALSndPlayer *g_SndPlayer = &var8009c2d0; N_ALSndPlayer *g_SndPlayer = &var8009c2d0;
s16 var8005f130 = 0; s16 var8005f130 = 0;
u32 var8005f134 = 0; u32 var8005f134 = 0;
u32 var8005f138 = 0; u32 var8005f138 = 0;
void *var8005f13c = NULL; // function callback void *var8005f13c = NULL; // function callback
void (*var8005f140)(struct audiohandle_08 *) = NULL; void (*var8005f140)(struct sndstate_08 *) = NULL;
void func00033378(void *fn); void func00033378(void *fn);
void func00033634(void *fn); void func00033634(void *fn);
void sndpFreeHandle(struct audiohandle *handle); void sndpFreeState(struct sndstate *state);
void func00033bc0(struct audiohandle *handle); void func00033bc0(struct sndstate *state);
void n_alSndpNew(ALSndpConfig *config) void n_alSndpNew(ALSndpConfig *config)
{ {
@ -42,7 +42,7 @@ void n_alSndpNew(ALSndpConfig *config)
ptr = alHeapAlloc(config->heap, 1, config->maxEvents * 0x1c); ptr = alHeapAlloc(config->heap, 1, config->maxEvents * 0x1c);
n_alEvtqNew(&g_SndPlayer->evtq, ptr, config->maxEvents); n_alEvtqNew(&g_SndPlayer->evtq, ptr, config->maxEvents);
g_SndpFreeHandlesHead = g_SndPlayer->sndState; g_SndpFreeStatesHead = g_SndPlayer->sndState;
for (i = 1; i < config->maxStates; i++) { for (i = 1; i < config->maxStates; i++) {
struct sndstate *sndstate = g_SndPlayer->sndState; struct sndstate *sndstate = g_SndPlayer->sndState;
@ -323,8 +323,8 @@ glabel var7005477c
/* 31de4: 8fa90070 */ lw $t1,0x70($sp) /* 31de4: 8fa90070 */ lw $t1,0x70($sp)
/* 31de8: 11200040 */ beqz $t1,.L00031eec /* 31de8: 11200040 */ beqz $t1,.L00031eec
/* 31dec: 00000000 */ nop /* 31dec: 00000000 */ nop
/* 31df0: 3c0c8006 */ lui $t4,%hi(g_SndpAllocHandlesTail) /* 31df0: 3c0c8006 */ lui $t4,%hi(g_SndpAllocStatesTail)
/* 31df4: 8d8cf124 */ lw $t4,%lo(g_SndpAllocHandlesTail)($t4) /* 31df4: 8d8cf124 */ lw $t4,%lo(g_SndpAllocStatesTail)($t4)
/* 31df8: afac0054 */ sw $t4,0x54($sp) /* 31df8: afac0054 */ sw $t4,0x54($sp)
.L00031dfc: .L00031dfc:
/* 31dfc: 8fab0054 */ lw $t3,0x54($sp) /* 31dfc: 8fab0054 */ lw $t3,0x54($sp)
@ -3005,17 +3005,17 @@ glabel var7005477c
); );
#endif #endif
void func00033090(struct audiohandle *handle) void func00033090(struct sndstate *state)
{ {
if (handle->unk44 & 4) { if (state->flags & SNDSTATEFLAG_04) {
n_alSynStopVoice(&handle->voice); n_alSynStopVoice(&state->voice);
n_alSynFreeVoice(&handle->voice); n_alSynFreeVoice(&state->voice);
} }
sndpFreeHandle(handle); sndpFreeState(state);
// @todo: Remove cast // @todo: Remove cast
_removeEvents(&g_SndPlayer->evtq, (N_ALSoundState *)handle, 0xffff); _removeEvents(&g_SndPlayer->evtq, (N_ALSoundState *)state, 0xffff);
} }
GLOBAL_ASM( GLOBAL_ASM(
@ -3095,13 +3095,13 @@ u16 sndpCountStates(s16 *numfreeptr, s16 *numallocedptr)
u16 numalloced; u16 numalloced;
u16 numfree; u16 numfree;
u16 numalloced2; u16 numalloced2;
struct audiohandle *ahandle = g_SndpAllocHandlesHead; struct sndstate *state1 = g_SndpAllocStatesHead;
struct audiohandle *bhandle = g_SndpFreeHandlesHead; struct sndstate *state2 = g_SndpFreeStatesHead;
struct audiohandle *chandle = g_SndpAllocHandlesTail; struct sndstate *state3 = g_SndpAllocStatesTail;
for (numalloced = 0; ahandle; numalloced++, ahandle = (struct audiohandle *)ahandle->node.next); for (numalloced = 0; state1; numalloced++, state1 = (struct sndstate *)state1->node.next);
for (numfree = 0; bhandle; numfree++, bhandle = (struct audiohandle *)bhandle->node.next); for (numfree = 0; state2; numfree++, state2 = (struct sndstate *)state2->node.next);
for (numalloced2 = 0; chandle; numalloced2++, chandle = (struct audiohandle *)chandle->node.prev); for (numalloced2 = 0; state3; numalloced2++, state3 = (struct sndstate *)state3->node.prev);
*numfreeptr = numfree; *numfreeptr = numfree;
*numallocedptr = numalloced; *numallocedptr = numalloced;
@ -3148,36 +3148,36 @@ glabel func00033390
/* 333f8: 0c012194 */ jal osSetIntMask /* 333f8: 0c012194 */ jal osSetIntMask
/* 333fc: 24040001 */ addiu $a0,$zero,0x1 /* 333fc: 24040001 */ addiu $a0,$zero,0x1
/* 33400: afa2001c */ sw $v0,0x1c($sp) /* 33400: afa2001c */ sw $v0,0x1c($sp)
/* 33404: 3c0b8006 */ lui $t3,%hi(g_SndpFreeHandlesHead) /* 33404: 3c0b8006 */ lui $t3,%hi(g_SndpFreeStatesHead)
/* 33408: 8d6bf128 */ lw $t3,%lo(g_SndpFreeHandlesHead)($t3) /* 33408: 8d6bf128 */ lw $t3,%lo(g_SndpFreeStatesHead)($t3)
/* 3340c: afab0024 */ sw $t3,0x24($sp) /* 3340c: afab0024 */ sw $t3,0x24($sp)
/* 33410: 8fac0024 */ lw $t4,0x24($sp) /* 33410: 8fac0024 */ lw $t4,0x24($sp)
/* 33414: 1180007d */ beqz $t4,.L0003360c /* 33414: 1180007d */ beqz $t4,.L0003360c
/* 33418: 00000000 */ nop /* 33418: 00000000 */ nop
/* 3341c: 8fad0024 */ lw $t5,0x24($sp) /* 3341c: 8fad0024 */ lw $t5,0x24($sp)
/* 33420: 3c018006 */ lui $at,%hi(g_SndpFreeHandlesHead) /* 33420: 3c018006 */ lui $at,%hi(g_SndpFreeStatesHead)
/* 33424: 8dae0000 */ lw $t6,0x0($t5) /* 33424: 8dae0000 */ lw $t6,0x0($t5)
/* 33428: ac2ef128 */ sw $t6,%lo(g_SndpFreeHandlesHead)($at) /* 33428: ac2ef128 */ sw $t6,%lo(g_SndpFreeStatesHead)($at)
/* 3342c: 0c00c5e9 */ jal alUnlink /* 3342c: 0c00c5e9 */ jal alUnlink
/* 33430: 8fa40024 */ lw $a0,0x24($sp) /* 33430: 8fa40024 */ lw $a0,0x24($sp)
/* 33434: 3c0f8006 */ lui $t7,%hi(g_SndpAllocHandlesHead) /* 33434: 3c0f8006 */ lui $t7,%hi(g_SndpAllocStatesHead)
/* 33438: 8deff120 */ lw $t7,%lo(g_SndpAllocHandlesHead)($t7) /* 33438: 8deff120 */ lw $t7,%lo(g_SndpAllocStatesHead)($t7)
/* 3343c: 11e0000f */ beqz $t7,.L0003347c /* 3343c: 11e0000f */ beqz $t7,.L0003347c
/* 33440: 00000000 */ nop /* 33440: 00000000 */ nop
/* 33444: 3c188006 */ lui $t8,%hi(g_SndpAllocHandlesHead) /* 33444: 3c188006 */ lui $t8,%hi(g_SndpAllocStatesHead)
/* 33448: 8f18f120 */ lw $t8,%lo(g_SndpAllocHandlesHead)($t8) /* 33448: 8f18f120 */ lw $t8,%lo(g_SndpAllocStatesHead)($t8)
/* 3344c: 8fb90024 */ lw $t9,0x24($sp) /* 3344c: 8fb90024 */ lw $t9,0x24($sp)
/* 33450: af380000 */ sw $t8,0x0($t9) /* 33450: af380000 */ sw $t8,0x0($t9)
/* 33454: 8fa80024 */ lw $t0,0x24($sp) /* 33454: 8fa80024 */ lw $t0,0x24($sp)
/* 33458: ad000004 */ sw $zero,0x4($t0) /* 33458: ad000004 */ sw $zero,0x4($t0)
/* 3345c: 3c0a8006 */ lui $t2,%hi(g_SndpAllocHandlesHead) /* 3345c: 3c0a8006 */ lui $t2,%hi(g_SndpAllocStatesHead)
/* 33460: 8d4af120 */ lw $t2,%lo(g_SndpAllocHandlesHead)($t2) /* 33460: 8d4af120 */ lw $t2,%lo(g_SndpAllocStatesHead)($t2)
/* 33464: 8fa90024 */ lw $t1,0x24($sp) /* 33464: 8fa90024 */ lw $t1,0x24($sp)
/* 33468: ad490004 */ sw $t1,0x4($t2) /* 33468: ad490004 */ sw $t1,0x4($t2)
/* 3346c: 8fab0024 */ lw $t3,0x24($sp) /* 3346c: 8fab0024 */ lw $t3,0x24($sp)
/* 33470: 3c018006 */ lui $at,%hi(g_SndpAllocHandlesHead) /* 33470: 3c018006 */ lui $at,%hi(g_SndpAllocStatesHead)
/* 33474: 1000000c */ b .L000334a8 /* 33474: 1000000c */ b .L000334a8
/* 33478: ac2bf120 */ sw $t3,%lo(g_SndpAllocHandlesHead)($at) /* 33478: ac2bf120 */ sw $t3,%lo(g_SndpAllocStatesHead)($at)
.L0003347c: .L0003347c:
/* 3347c: 8fac0024 */ lw $t4,0x24($sp) /* 3347c: 8fac0024 */ lw $t4,0x24($sp)
/* 33480: ad800004 */ sw $zero,0x4($t4) /* 33480: ad800004 */ sw $zero,0x4($t4)
@ -3185,11 +3185,11 @@ glabel func00033390
/* 33488: 8dae0004 */ lw $t6,0x4($t5) /* 33488: 8dae0004 */ lw $t6,0x4($t5)
/* 3348c: adae0000 */ sw $t6,0x0($t5) /* 3348c: adae0000 */ sw $t6,0x0($t5)
/* 33490: 8faf0024 */ lw $t7,0x24($sp) /* 33490: 8faf0024 */ lw $t7,0x24($sp)
/* 33494: 3c018006 */ lui $at,%hi(g_SndpAllocHandlesHead) /* 33494: 3c018006 */ lui $at,%hi(g_SndpAllocStatesHead)
/* 33498: ac2ff120 */ sw $t7,%lo(g_SndpAllocHandlesHead)($at) /* 33498: ac2ff120 */ sw $t7,%lo(g_SndpAllocStatesHead)($at)
/* 3349c: 8fb80024 */ lw $t8,0x24($sp) /* 3349c: 8fb80024 */ lw $t8,0x24($sp)
/* 334a0: 3c018006 */ lui $at,%hi(g_SndpAllocHandlesTail) /* 334a0: 3c018006 */ lui $at,%hi(g_SndpAllocStatesTail)
/* 334a4: ac38f124 */ sw $t8,%lo(g_SndpAllocHandlesTail)($at) /* 334a4: ac38f124 */ sw $t8,%lo(g_SndpAllocStatesTail)($at)
.L000334a8: .L000334a8:
/* 334a8: 0c012194 */ jal osSetIntMask /* 334a8: 0c012194 */ jal osSetIntMask
/* 334ac: 8fa4001c */ lw $a0,0x1c($sp) /* 334ac: 8fa4001c */ lw $a0,0x1c($sp)
@ -3304,46 +3304,46 @@ void func00033634(void *fn)
var8005f140 = fn; var8005f140 = fn;
} }
void sndpFreeHandle(struct audiohandle *handle) void sndpFreeState(struct sndstate *state)
{ {
var8005f134--; var8005f134--;
if (g_SndpAllocHandlesHead == handle) { if (g_SndpAllocStatesHead == state) {
g_SndpAllocHandlesHead = (struct audiohandle *)handle->node.next; g_SndpAllocStatesHead = (struct sndstate *)state->node.next;
} }
if (g_SndpAllocHandlesTail == handle) { if (g_SndpAllocStatesTail == state) {
g_SndpAllocHandlesTail = (struct audiohandle *)handle->node.prev; g_SndpAllocStatesTail = (struct sndstate *)state->node.prev;
} }
alUnlink(&handle->node); alUnlink(&state->node);
if (g_SndpFreeHandlesHead) { if (g_SndpFreeStatesHead) {
handle->node.next = &g_SndpFreeHandlesHead->node; state->node.next = &g_SndpFreeStatesHead->node;
handle->node.prev = NULL; state->node.prev = NULL;
g_SndpFreeHandlesHead->node.prev = &handle->node; g_SndpFreeStatesHead->node.prev = &state->node;
g_SndpFreeHandlesHead = handle; g_SndpFreeStatesHead = state;
} else { } else {
handle->node.next = handle->node.prev = NULL; state->node.next = state->node.prev = NULL;
g_SndpFreeHandlesHead = handle; g_SndpFreeStatesHead = state;
} }
if (handle->unk44 & 4) { if (state->flags & SNDSTATEFLAG_04) {
var8005f130--; var8005f130--;
} }
handle->playing = 0; state->playing = 0;
if (handle->unk30) { if (state->unk30) {
if (*handle->unk30 == handle) { if (*state->unk30 == state) {
*handle->unk30 = 0; *state->unk30 = 0;
} }
handle->unk30 = NULL; state->unk30 = NULL;
} }
if (var8005f140) { if (var8005f140) {
var8005f140(handle->unk08); var8005f140(state->unk08);
} }
} }
@ -3362,10 +3362,10 @@ glabel func000337c8
/* 337ec: 00000000 */ nop /* 337ec: 00000000 */ nop
); );
bool audioIsPlaying(struct audiohandle *handle) bool audioIsPlaying(struct sndstate *state)
{ {
if (handle) { if (state) {
return handle->playing; return state->playing;
} else { } else {
return false; return false;
} }
@ -3784,43 +3784,43 @@ glabel func00033820
); );
#endif #endif
void audioStop(struct audiohandle *handle) void audioStop(struct sndstate *state)
{ {
N_ALEvent evt; N_ALEvent evt;
#if VERSION >= VERSION_NTSC_FINAL #if VERSION >= VERSION_NTSC_FINAL
if (handle && (handle->unk44 & 2)) { if (state && (state->flags & SNDSTATEFLAG_02)) {
func00033bc0(handle); func00033bc0(state);
} else { } else {
evt.type = AL_400_EVT; evt.type = AL_400_EVT;
evt.msg.evt400.handle = handle; evt.msg.generic.sndstate = state;
if (handle != NULL) { if (state != NULL) {
evt.msg.evt400.handle->unk44 &= ~0x10; evt.msg.generic.sndstate->flags &= ~SNDSTATEFLAG_10;
n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0); n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0);
} }
} }
#elif VERSION >= VERSION_NTSC_1_0 #elif VERSION >= VERSION_NTSC_1_0
// NTSC 1.0 lacks the null handle check // NTSC 1.0 lacks the null state check
if (handle->unk44 & 2) { if (state->flags & SNDSTATEFLAG_02) {
func00033bc0(handle); func00033bc0(state);
} else { } else {
evt.type = AL_400_EVT; evt.type = AL_400_EVT;
evt.msg.evt400.handle = handle; evt.msg.generic.sndstate = state;
if (handle != NULL) { if (state != NULL) {
evt.msg.evt400.handle->unk44 &= ~0x10; evt.msg.generic.sndstate->flags &= ~SNDSTATEFLAG_10;
n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0); n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0);
} }
} }
#else #else
evt.type = AL_400_EVT; evt.type = AL_400_EVT;
evt.msg.evt400.handle = handle; evt.msg.generic.sndstate = state;
if (handle != NULL) { if (state != NULL) {
evt.msg.evt400.handle->unk44 &= ~0x10; evt.msg.generic.sndstate->flags &= ~SNDSTATEFLAG_10;
n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0); n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0);
} }
@ -3828,59 +3828,59 @@ void audioStop(struct audiohandle *handle)
} }
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
void func00033bc0(struct audiohandle *handle) void func00033bc0(struct sndstate *state)
{ {
N_ALEvent evt; N_ALEvent evt;
evt.type = AL_80_EVT; evt.type = AL_80_EVT;
evt.msg.generic.handle = handle; evt.msg.generic.sndstate = state;
if (handle) { if (state) {
evt.msg.generic.handle->unk44 &= ~0x10; evt.msg.generic.sndstate->flags &= ~SNDSTATEFLAG_10;
n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0); n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0);
} }
} }
#endif #endif
void func00033c30(u8 arg0) void func00033c30(u8 flags)
{ {
OSIntMask mask = osSetIntMask(1); OSIntMask mask = osSetIntMask(1);
N_ALEvent evt; N_ALEvent evt;
struct audiohandle *handle = g_SndpAllocHandlesHead; struct sndstate *state = g_SndpAllocStatesHead;
while (handle) { while (state) {
evt.type = AL_400_EVT; evt.type = AL_400_EVT;
evt.msg.generic.handle = handle; evt.msg.generic.sndstate = state;
if ((handle->unk44 & arg0) == arg0) { if ((state->flags & flags) == flags) {
evt.msg.generic.handle->unk44 &= ~0x10; evt.msg.generic.sndstate->flags &= ~SNDSTATEFLAG_10;
n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0); n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0);
} }
handle = (struct audiohandle *)handle->node.next; state = (struct sndstate *)state->node.next;
} }
osSetIntMask(mask); osSetIntMask(mask);
} }
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
void func00033cf0(u8 arg0) void func00033cf0(u8 flags)
{ {
OSIntMask mask = osSetIntMask(1); OSIntMask mask = osSetIntMask(1);
N_ALEvent evt; N_ALEvent evt;
struct audiohandle *handle = g_SndpAllocHandlesHead; struct sndstate *state = g_SndpAllocStatesHead;
while (handle) { while (state) {
evt.type = AL_80_EVT; evt.type = AL_80_EVT;
evt.msg.generic.handle = handle; evt.msg.generic.sndstate = state;
if ((handle->unk44 & arg0) == arg0) { if ((state->flags & flags) == flags) {
evt.msg.generic.handle->unk44 &= ~0x10; evt.msg.generic.sndstate->flags &= ~SNDSTATEFLAG_10;
n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0); n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0);
} }
handle = (struct audiohandle *)handle->node.next; state = (struct sndstate *)state->node.next;
} }
osSetIntMask(mask); osSetIntMask(mask);
@ -3890,34 +3890,34 @@ void func00033cf0(u8 arg0)
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
void func00033db0(void) void func00033db0(void)
{ {
func00033cf0(1); func00033cf0(SNDSTATEFLAG_01);
} }
#endif #endif
void func00033dd8(void) void func00033dd8(void)
{ {
func00033c30(1); func00033c30(SNDSTATEFLAG_01);
} }
void func00033e00(void) void func00033e00(void)
{ {
func00033c30(0x11); func00033c30(SNDSTATEFLAG_01 | SNDSTATEFLAG_10);
} }
void func00033e28(void) void func00033e28(void)
{ {
func00033c30(3); func00033c30(SNDSTATEFLAG_01 | SNDSTATEFLAG_02);
} }
void audioPostEvent(struct audiohandle *handle, s16 type, s32 data) void audioPostEvent(struct sndstate *state, s16 type, s32 data)
{ {
N_ALEvent evt; N_ALEvent evt;
evt.type = type; evt.type = type;
evt.msg.generic.handle = handle; evt.msg.generic.sndstate = state;
evt.msg.generic.data = data; evt.msg.generic.data = data;
if (handle) { if (state) {
n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0); n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0);
} else { } else {
// empty // empty
@ -3930,9 +3930,9 @@ u16 func00033ec4(u8 index)
} }
#if VERSION >= VERSION_NTSC_1_0 #if VERSION >= VERSION_NTSC_1_0
struct audiohandle *func00033f08(void) struct sndstate *func00033f08(void)
{ {
return g_SndpAllocHandlesHead; return g_SndpAllocStatesHead;
} }
#endif #endif
@ -3947,16 +3947,16 @@ void func00033f44(u8 index, u16 volume)
{ {
if (var8009c334) { if (var8009c334) {
OSIntMask mask = osSetIntMask(1); OSIntMask mask = osSetIntMask(1);
struct audiohandle *handle = g_SndpAllocHandlesHead; struct sndstate *state = g_SndpAllocStatesHead;
s32 i; s32 i;
N_ALEvent evt; N_ALEvent evt;
var8009c334[index] = volume; var8009c334[index] = volume;
for (i = 0; handle != NULL; i++, handle = (struct audiohandle *)handle->node.next) { for (i = 0; state != NULL; i++, state = (struct sndstate *)state->node.next) {
if ((handle->unk08->unk04->unk02 & 0x1f) == index) { if ((state->unk08->unk04->unk02 & 0x1f) == index) {
evt.type = AL_800_EVT; evt.type = AL_800_EVT;
evt.msg.generic.handle = handle; evt.msg.generic.sndstate = state;
n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0); n_alEvtqPostEvent(&g_SndPlayer->evtq, &evt, 0, 0);
} }
} }

View File

@ -62,8 +62,8 @@ s32 g_SndUfoVolume = 0;
s32 g_SndUfoAge240 = -1; s32 g_SndUfoAge240 = -1;
s32 g_SndUfoDuration240 = 0; s32 g_SndUfoDuration240 = 0;
struct audiohandle *g_SndNosediveHandle = NULL; struct sndstate *g_SndNosediveHandle = NULL;
struct audiohandle *g_SndUfoHandle = NULL; struct sndstate *g_SndUfoHandle = NULL;
u16 g_SfxVolume = 32767; u16 g_SfxVolume = 32767;
s32 g_SoundMode = (VERSION >= VERSION_NTSC_1_0 ? SOUNDMODE_STEREO : SOUNDMODE_SURROUND); s32 g_SoundMode = (VERSION >= VERSION_NTSC_1_0 ? SOUNDMODE_STEREO : SOUNDMODE_SURROUND);
@ -4576,7 +4576,7 @@ glabel sndStart
); );
// Mismatch: Likely related to soundnumhack // Mismatch: Likely related to soundnumhack
//struct audiohandle *sndStart(s32 arg0, s16 sound, struct audiohandle **handle, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7) //struct sndstate *sndStart(s32 arg0, s16 sound, struct sndstate **handle, s32 arg3, s32 arg4, f32 arg5, s32 arg6, s32 arg7)
//{ //{
// union soundnumhack sp44; // union soundnumhack sp44;
// union soundnumhack sp40; // union soundnumhack sp40;