Minor cleanups

This commit is contained in:
2022-07-30 02:12:25 -07:00
parent 7107b307e2
commit 5bfa43d591
22 changed files with 206 additions and 109 deletions

22
include/math_ppc.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef _MATH_PPC_H_
#define _MATH_PPC_H_
inline float sqrtf(float x)
{
static const double _half=.5;
static const double _three=3.0;
volatile float y;
if(x > 0.0f)
{
double guess = __frsqrte((double)x); /* returns an approximation to */
guess = _half*guess*(_three - guess*guess*x); /* now have 12 sig bits */
guess = _half*guess*(_three - guess*guess*x); /* now have 24 sig bits */
guess = _half*guess*(_three - guess*guess*x); /* now have 32 sig bits */
y=(float)(x*guess);
return y ;
}
return x ;
}
#endif

View File

@@ -99,7 +99,7 @@ void sndAuxCallbackDelay(u8 reason, SND_AUX_INFO* info, void* user);
s32 sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay);
s32 sndAuxCallbackPrepareDelay(SND_AUX_DELAY* rev);
s32 sndAuxCallbackShutdownDelay(SND_AUX_DELAY* rev);
s32 sndAuxCallbackUpdateSettingsReverbHI(SND_AUX_REVERBHI *rev);
s32 sndAuxCallbackUpdateSettingsReverbHI(SND_AUX_REVERBHI* rev);
typedef struct _SND_REVSTD_DELAYLINE {
s32 inPoint;
@@ -133,10 +133,22 @@ typedef struct SND_AUX_REVERBSTD {
f32 preDelay;
} SND_AUX_REVERBSTD;
void sndAuxCallbackReverbSTD(u8 reason,SND_AUX_INFO *info,void *user);
s32 sndAuxCallbackPrepareReverbSTD(SND_AUX_REVERBSTD *rev);
s32 sndAuxCallbackShutdownReverbSTD(SND_AUX_REVERBSTD *rev);
s32 sndAuxCallbackUpdateSettingsReverbSTD(SND_AUX_REVERBSTD *rev);
void sndAuxCallbackReverbSTD(u8 reason, SND_AUX_INFO* info, void* user);
s32 sndAuxCallbackPrepareReverbSTD(SND_AUX_REVERBSTD* rev);
s32 sndAuxCallbackShutdownReverbSTD(SND_AUX_REVERBSTD* rev);
s32 sndAuxCallbackUpdateSettingsReverbSTD(SND_AUX_REVERBSTD* rev);
typedef struct SND_FVECTOR {
f32 x;
f32 y;
f32 z;
} SND_FVECTOR;
typedef struct SND_FMATRIX {
f32 m[3][3];
f32 t[3];
} SND_FMATRIX;
#ifdef __cplusplus
}
#endif

View File

@@ -29,6 +29,13 @@ void sndConvertTicks(u32* out, u32 seconds);
u32 sndConvert2Ms(u32 time);
extern SND_HOOKS salHooks;
/* Math */
void salApplyMatrix(const SND_FMATRIX* a, const SND_FVECTOR* b, SND_FVECTOR* out);
float salNormalizeVector(SND_FVECTOR* vec);
void salCrossProduct(SND_FVECTOR* out, const SND_FVECTOR* a, const SND_FVECTOR* b);
void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in);
#ifdef __cplusplus
}
#endif