port: fix aEnvMixer; fix some misc warnings
hopefully that was the last of the big audio issues
This commit is contained in:
parent
60e64e1a1d
commit
288b37a1b3
|
|
@ -120,7 +120,11 @@ typedef struct ALLink_s {
|
|||
void alUnlink(ALLink *element);
|
||||
void alLink(ALLink *element, ALLink *after);
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
typedef s32 (*ALDMAproc)(s32 addr, s32 len, void *state);
|
||||
#else
|
||||
typedef uintptr_t (*ALDMAproc)(uintptr_t addr, s32 len, void *state);
|
||||
#endif
|
||||
typedef ALDMAproc (*ALDMANew)(void *state);
|
||||
|
||||
void alCopy(void *src, void *dest, s32 len);
|
||||
|
|
|
|||
|
|
@ -97,9 +97,13 @@ extern "C" {
|
|||
|
||||
/* Address translation routines and macros */
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
extern u32 osVirtualToPhysical(void *);
|
||||
extern void * osPhysicalToVirtual(u32);
|
||||
|
||||
#else
|
||||
extern uintptr_t osVirtualToPhysical(void *);
|
||||
extern void * osPhysicalToVirtual(uintptr_t);
|
||||
#endif
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
|
|
|
|||
|
|
@ -38,18 +38,18 @@ void aPlayMP3Impl(const void *mp3file, u32 mp3size, void *out);
|
|||
|
||||
#define aDisable(pkt, o, b, c) aDisableImpl(o, b, c)
|
||||
#define aClearBuffer(pkt, d, c) aClearBufferImpl(d, c)
|
||||
#define aLoadBuffer(pkt, c, d, s) aLoadBufferImpl(s, d, c)
|
||||
#define aSaveBuffer(pkt, c, s, d) aSaveBufferImpl(s, d, c)
|
||||
#define aLoadADPCM(pkt, c, d) aLoadADPCMImpl(c, d)
|
||||
#define aLoadBuffer(pkt, c, d, s) aLoadBufferImpl((void *)(s), d, c)
|
||||
#define aSaveBuffer(pkt, c, s, d) aSaveBufferImpl(s, (int16_t *)(d), c)
|
||||
#define aLoadADPCM(pkt, c, d) aLoadADPCMImpl(c, (int16_t *)(d))
|
||||
#define aDMEMMove(pkt, i, o, c) aDMEMMoveImpl(i, o, c)
|
||||
#define aSetLoop(pkt, a) aSetLoopImpl(a)
|
||||
#define aADPCMdec(pkt, s, f, c, i, o) aADPCMdecImpl(f, s, c, i, o)
|
||||
#define aResample(pkt, s, f, p, i, o) aResampleImpl(f, p, s, i, o)
|
||||
#define aSetLoop(pkt, a) aSetLoopImpl((void *)(a))
|
||||
#define aADPCMdec(pkt, s, f, c, i, o) aADPCMdecImpl(f, (void *)(s), c, i, o)
|
||||
#define aResample(pkt, s, f, p, i, o) aResampleImpl(f, p, (void *)(s), i, o)
|
||||
#define aInterleave(pkt) aInterleaveImpl()
|
||||
#define aMix(pkt, f, g, i, o) aMixImpl(f, g, i, o)
|
||||
#define aEnvMixer(pkt, f, t, s) aEnvMixerImpl(f, s, t)
|
||||
#define aEnvMixer(pkt, f, t, s) aEnvMixerImpl(f, (void *)(s), t)
|
||||
#define aSetVolume(pkt, f, v, t, r) aSetVolumeImpl(f, v, t, r)
|
||||
#define aPoleFilter(pkt, f, g, t, s) aPoleFilterImpl(f, g, t, s)
|
||||
#define aPlayMP3(pkt, a, b, c) aPlayMP3Impl(a, b, c)
|
||||
#define aPlayMP3(pkt, a, b, c) aPlayMP3Impl((void *)(a), b, (void *)(c))
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "bss.h"
|
||||
|
||||
#include "video.h"
|
||||
#include "audio.h"
|
||||
#include "input.h"
|
||||
#include "fs.h"
|
||||
#include "romdata.h"
|
||||
|
|
|
|||
|
|
@ -511,6 +511,14 @@ void aEnvMixerImpl(uint8_t flags, ENVMIX_STATE state, int16_t rvol) {
|
|||
int16_t *wet[2] = {BUF_S16(OFS_AUX_L), BUF_S16(OFS_AUX_R)};
|
||||
int nsamples = NUM_SAMPLES;
|
||||
|
||||
struct {
|
||||
int32_t t[2];
|
||||
int32_t rate[2];
|
||||
int16_t tgt[2];
|
||||
int16_t voldry;
|
||||
int16_t volwet;
|
||||
} *savedstate = (void *)state;
|
||||
|
||||
rspa.vol[1] = rvol; // why the fuck is this here?
|
||||
|
||||
// naudio uses a linear envelope
|
||||
|
|
@ -521,21 +529,20 @@ void aEnvMixerImpl(uint8_t flags, ENVMIX_STATE state, int16_t rvol) {
|
|||
|
||||
if (flags & A_INIT) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
t[i] = rspa.vol[i] << 16;
|
||||
tgt[i] = rspa.target[i] << 16;
|
||||
t[i] = rspa.vol[i] << 16;
|
||||
rate[i] = rspa.rate[i] >> 3;
|
||||
tgt[i] = rspa.target[i] << 16;
|
||||
}
|
||||
voldry = rspa.vol_dry;
|
||||
volwet = rspa.vol_wet;
|
||||
} else {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
int16_t *base = state + i * 4;
|
||||
t[i] = base[0];
|
||||
tgt[i] = base[1] << 16;
|
||||
rate[i] = *(int32_t *)&base[2];
|
||||
t[i] = savedstate->t[i];
|
||||
rate[i] = savedstate->rate[i];
|
||||
tgt[i] = savedstate->tgt[i] << 16;
|
||||
}
|
||||
voldry = state[8];
|
||||
volwet = state[9];
|
||||
voldry = savedstate->voldry;
|
||||
volwet = savedstate->volwet;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_BIG_ENDIAN
|
||||
|
|
@ -574,16 +581,15 @@ void aEnvMixerImpl(uint8_t flags, ENVMIX_STATE state, int16_t rvol) {
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
int16_t *base = state + i * 4;
|
||||
base[0] = t[i];
|
||||
base[1] = tgt[i] >> 16;
|
||||
*(int32_t *)&base[2] = rate[i];
|
||||
}
|
||||
state[8] = voldry;
|
||||
state[9] = volwet;
|
||||
|
||||
#undef XOR
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
savedstate->t[i] = t[i];
|
||||
savedstate->rate[i] = rate[i];
|
||||
savedstate->tgt[i] = tgt[i] >> 16;
|
||||
}
|
||||
savedstate->voldry = voldry;
|
||||
savedstate->volwet = volwet;
|
||||
}
|
||||
|
||||
// flags is always 0 in PD
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <ultra64.h>
|
||||
#include <PR/ultrasched.h>
|
||||
|
|
@ -77,7 +76,6 @@ extern u8 *g_MempHeap;
|
|||
extern u32 g_MempHeapSize;
|
||||
|
||||
void rngSetSeed(u32 seed);
|
||||
void schedFrame(OSSched *sc);
|
||||
|
||||
bool var8005d9b0 = false;
|
||||
s32 g_StageNum = STAGE_TITLE;
|
||||
|
|
@ -207,14 +205,6 @@ Gfx var8005dcc8[] = {
|
|||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
Gfx var8005dcf0[] = {
|
||||
gsSPSegment(0x00, 0x00000000),
|
||||
gsSPDisplayList(&var800613a0),
|
||||
gsSPDisplayList(&var80061380),
|
||||
gsDPFullSync(),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
s32 g_MainIsBooting = 1;
|
||||
|
||||
void mainInit(void)
|
||||
|
|
@ -522,8 +512,8 @@ void mainLoop(void)
|
|||
|
||||
void mainTick(void)
|
||||
{
|
||||
Gfx *gdl;
|
||||
Gfx *gdlstart;
|
||||
Gfx *gdl = NULL;
|
||||
Gfx *gdlstart = NULL;
|
||||
OSScMsg msg = {OS_SC_DONE_MSG};
|
||||
s32 i;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@
|
|||
|
||||
struct admaitem {
|
||||
ALLink node;
|
||||
#ifdef PLATFORM_N64
|
||||
s32 startaddr;
|
||||
#else
|
||||
uintptr_t startaddr;
|
||||
#endif
|
||||
s32 lastframe;
|
||||
u8 *ptr;
|
||||
};
|
||||
|
|
@ -46,14 +50,23 @@ void admaInit(void)
|
|||
* that this buffer was last used in this frame. This is important for the
|
||||
* admaBeginFrame routine.
|
||||
*/
|
||||
#ifdef PLATFORM_N64
|
||||
s32 admaExec(s32 offset, s32 len, void *state)
|
||||
#else
|
||||
uintptr_t admaExec(uintptr_t offset, s32 len, void *state)
|
||||
#endif
|
||||
{
|
||||
void *foundbuffer;
|
||||
s32 delta;
|
||||
struct admaitem *item = g_AdmaState.firstused;
|
||||
struct admaitem *lastitem = NULL;
|
||||
#ifdef PLATFORM_N64
|
||||
s32 end = offset + len;
|
||||
s32 buffend;
|
||||
#else
|
||||
uintptr_t end = offset + len;
|
||||
uintptr_t buffend;
|
||||
#endif
|
||||
|
||||
// Check to see if a buffer already contains the sample
|
||||
while (item) {
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ s32 mp3util000462f8(u8 *arg0, s32 *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5,
|
|||
} else {
|
||||
cVar1 = *(s8 *)piVar4;
|
||||
uVar3 = uVar5 & 7;
|
||||
piVar4 = (s32 *)((u8 *)piVar4 + (uVar3 + 1 >> 3));
|
||||
piVar4 = (s32 *)((u8 *)piVar4 + ((uVar3 + 1) >> 3));
|
||||
uVar5 = uVar5 + 1;
|
||||
if (((u32)cVar1 >> (7 - uVar3 & 0x1f) & 1) == 0) {
|
||||
if (((u32)cVar1 >> ((7 - uVar3) & 0x1f) & 1) == 0) {
|
||||
*puVar7 = 0;
|
||||
} else {
|
||||
*puVar7 = 1;
|
||||
|
|
@ -97,9 +97,9 @@ s32 mp3util000462f8(u8 *arg0, s32 *arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5,
|
|||
} else {
|
||||
cVar1 = *(s8 *)piVar4;
|
||||
uVar2 = uVar5 & 7;
|
||||
piVar4 = (s32 *)((u8 *)piVar4 + (uVar2 + 1 >> 3));
|
||||
piVar4 = (s32 *)((u8 *)piVar4 + ((uVar2 + 1) >> 3));
|
||||
uVar5 = uVar5 + 1;
|
||||
if (((u32)cVar1 >> (7 - uVar2 & 0x1f) & 1) == 0) {
|
||||
if (((u32)cVar1 >> ((7 - uVar2) & 0x1f) & 1) == 0) {
|
||||
puVar7[1] = 0;
|
||||
} else {
|
||||
puVar7[1] = 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue