mirror of
https://github.com/pret/pokestadium.git
synced 2026-08-09 11:17:21 -05:00
identify 43520.c as n_sl.c
This commit is contained in:
parent
75117c8aa3
commit
91a7e1bbf4
2
Makefile
2
Makefile
|
|
@ -128,7 +128,7 @@ SPLAT_YAML := $(TARGET)-$(VERSION).yaml
|
|||
|
||||
ENCRYPT_LIBLEO := $(PYTHON) tools/encrypt_libleo.py
|
||||
|
||||
IINC := -Iinclude -Isrc -Iassets/$(VERSION) -I. -I$(BUILD_DIR)
|
||||
IINC := -Iinclude -Isrc -Isrc/libnaudio -Iassets/$(VERSION) -I. -I$(BUILD_DIR)
|
||||
IINC += -Ilib/ultralib/include -Ilib/ultralib/include/PR -Ilib/ultralib/include/ido
|
||||
IINC += -Iinclude/
|
||||
|
||||
|
|
|
|||
|
|
@ -262,3 +262,5 @@ D_862082A0 = 0x862082A0; // size:0x10
|
|||
D_800AE4E8 = 0x800AE4E8; // size:0x30
|
||||
D_80072EE0 = 0x80072EE0;
|
||||
D_80077970 = 0x80077970; // size:0x2F3
|
||||
n_alGlobals = 0x80078580;
|
||||
n_syn = 0x80078584;
|
||||
|
|
|
|||
|
|
@ -1300,8 +1300,8 @@ func_800420F0 = 0x800420F0; // type:func
|
|||
func_80042158 = 0x80042158; // type:func
|
||||
func_80042850 = 0x80042850; // type:func
|
||||
func_800428FC = 0x800428FC; // type:func
|
||||
func_80042920 = 0x80042920; // type:func
|
||||
func_8004296C = 0x8004296C; // type:func
|
||||
n_alInit = 0x80042920; // type:func
|
||||
n_alClose = 0x8004296C; // type:func
|
||||
func_800429B0 = 0x800429B0; // type:func
|
||||
func_800429D0 = 0x800429D0; // type:func
|
||||
func_80042A2C = 0x80042A2C; // type:func
|
||||
|
|
@ -1384,7 +1384,7 @@ func_80048904 = 0x80048904; // type:func
|
|||
func_80048B90 = 0x80048B90; // type:func
|
||||
func_80048FA0 = 0x80048FA0; // type:func
|
||||
func_800490CC = 0x800490CC; // type:func
|
||||
func_800491C0 = 0x800491C0; // type:func
|
||||
n_alSynNew = 0x800491C0; // type:func
|
||||
func_80049490 = 0x80049490; // type:func
|
||||
func_800495F8 = 0x800495F8; // type:func
|
||||
func_80049628 = 0x80049628; // type:func
|
||||
|
|
@ -1463,7 +1463,7 @@ func_8004FC60 = 0x8004FC60; // type:func
|
|||
func_8004FCD8 = 0x8004FCD8; // type:func
|
||||
func_8004FD44 = 0x8004FD44; // type:func
|
||||
func_8004FD64 = 0x8004FD64; // type:func
|
||||
func_8004FD90 = 0x8004FD90; // type:func
|
||||
n_alSynDelete = 0x8004FD90; // type:func
|
||||
func_8004FDA0 = 0x8004FDA0; // type:func
|
||||
func_8004FE00 = 0x8004FE00; // type:func
|
||||
func_8004FF20 = 0x8004FF20; // type:func
|
||||
|
|
|
|||
26
src/43520.c
26
src/43520.c
|
|
@ -1,26 +0,0 @@
|
|||
#include "global.h"
|
||||
|
||||
void func_800491C0(s32 arg0);
|
||||
void func_8004FD90(void);
|
||||
|
||||
extern s32 D_80078580;
|
||||
|
||||
extern void* D_80078584;
|
||||
|
||||
void func_80042920(void* arg0, s32 arg1) {
|
||||
if (D_80078580 == 0) {
|
||||
D_80078580 = arg0;
|
||||
if (D_80078584 == NULL) {
|
||||
D_80078584 = arg0;
|
||||
func_800491C0(arg1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_8004296C(void) {
|
||||
if (D_80078580 != 0) {
|
||||
func_8004FD90();
|
||||
D_80078580 = 0;
|
||||
D_80078584 = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/49DC0/func_800491C0.s")
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/49DC0/n_alSynNew.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/49DC0/func_80049490.s")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "global.h"
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
struct UnkArray4 {
|
||||
u32 unk0;
|
||||
|
|
@ -21,7 +22,6 @@ struct UnkStruct8004EBF0 {
|
|||
};
|
||||
void func_80047500(void*, u8, void*, void*);
|
||||
struct UnkArray4* func_800495F8();
|
||||
extern struct UnkArray4* D_80078584; // who did this? fix later
|
||||
|
||||
void func_8004EBF0(struct UnkStruct8004EBF0* arg0, f32 arg1) {
|
||||
struct UnkArray4* temp_v0;
|
||||
|
|
@ -29,7 +29,7 @@ void func_8004EBF0(struct UnkStruct8004EBF0* arg0, f32 arg1) {
|
|||
if (arg0->unk8 != NULL) {
|
||||
temp_v0 = func_800495F8();
|
||||
if (temp_v0 != NULL) {
|
||||
temp_v0->unk4 = (s32)(D_80078584->unk1C + arg0->unk8->unk88);
|
||||
temp_v0->unk4 = (s32)(n_syn->paramSamples + arg0->unk8->unk88);
|
||||
temp_v0->unk8 = 7;
|
||||
temp_v0->unkC = arg1;
|
||||
temp_v0->unk0 = 0;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/50990/func_8004FD90.s")
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/50990/n_alSynDelete.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/50990/func_8004FDA0.s")
|
||||
|
|
|
|||
123
src/libnaudio/n_abi.h
Normal file
123
src/libnaudio/n_abi.h
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
/*====================================================================
|
||||
*
|
||||
* Copyright 1993, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
#ifndef _N_ABI__
|
||||
#define _N_ABI__
|
||||
|
||||
|
||||
/*
|
||||
* BEGIN C-specific section: (typedef's)
|
||||
*/
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
|
||||
/*
|
||||
* Macros to assemble the audio command list
|
||||
*/
|
||||
|
||||
#define n_aADPCMdec(pkt, s, f, c, a, d) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(s, 0, 24)); \
|
||||
_a->words.w1 = (_SHIFTL(f, 28, 4) | _SHIFTL(c, 16, 12) | \
|
||||
_SHIFTL(a, 12, 4) | _SHIFTL(d, 0, 12)); \
|
||||
}
|
||||
|
||||
#define n_aPoleFilter(pkt, f, g, t, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(g, 0, 16)); \
|
||||
_a->words.w1 = (_SHIFTL(t, 24, 8) | \
|
||||
_SHIFTL((unsigned int)(s), 0, 24)); \
|
||||
}
|
||||
|
||||
#define n_aEnvMixer(pkt, f, t, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8) |\
|
||||
_SHIFTL(t, 0, 16)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define n_aInterleave(pkt) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \
|
||||
}
|
||||
|
||||
#define n_aLoadBuffer(pkt, c, d, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_LOADBUFF, 24, 8) | _SHIFTL(c, 12, 12)|\
|
||||
_SHIFTL(d, 0, 12)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define n_aResample(pkt, s, f, p, i, o) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(s, 0, 24));\
|
||||
_a->words.w1 = (_SHIFTL(f, 30, 2) | _SHIFTL(p, 14, 16) | \
|
||||
_SHIFTL(i, 2, 12) | _SHIFTL(o, 0, 2)); \
|
||||
}
|
||||
|
||||
#define n_aSaveBuffer(pkt, c, d, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_SAVEBUFF, 24, 8) | _SHIFTL(c, 12, 12)|\
|
||||
_SHIFTL(d, 0, 12)); \
|
||||
_a->words.w1 = (unsigned int)(s); \
|
||||
}
|
||||
|
||||
#define n_aSetVolume(pkt, f, v, t, r) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||
_SHIFTL(v, 0, 16)); \
|
||||
_a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \
|
||||
}
|
||||
|
||||
#define n_aLoadADPCM(pkt, c, d) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
|
||||
_a->words.w1 = (unsigned int) d; \
|
||||
}
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#endif /* !_N_ABI__ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
114
src/libnaudio/n_libaudio_sc.h
Normal file
114
src/libnaudio/n_libaudio_sc.h
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/*====================================================================
|
||||
*
|
||||
* Copyright 1993, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*==================================================================== */
|
||||
|
||||
#ifndef __N_LIBAUDIO__
|
||||
#define __N_LIBAUDIO__
|
||||
|
||||
#include <PR/libaudio.h>
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/mbi.h>
|
||||
|
||||
typedef struct N_ALVoice_s {
|
||||
ALLink node;
|
||||
struct N_PVoice_s *pvoice;
|
||||
ALWaveTable *table;
|
||||
void *clientPrivate;
|
||||
s16 state;
|
||||
s16 priority;
|
||||
s16 fxBus;
|
||||
s16 unityPitch;
|
||||
} N_ALVoice;
|
||||
|
||||
typedef struct {
|
||||
ALPlayer *head; /* client list head */
|
||||
ALLink pFreeList; /* list of free physical voices */
|
||||
ALLink pAllocList; /* list of allocated physical voices */
|
||||
ALLink pLameList; /* list of voices ready to be freed */
|
||||
s32 paramSamples;
|
||||
s32 curSamples; /* samples from start of game */
|
||||
ALDMANew dma;
|
||||
ALHeap *heap;
|
||||
struct ALParam_s *paramList;
|
||||
struct N_ALMainBus_s *mainBus;
|
||||
struct N_ALAuxBus_s *auxBus;
|
||||
s32 numPVoices;
|
||||
s32 maxAuxBusses;
|
||||
s32 outputRate;
|
||||
s32 maxOutSamples;
|
||||
s32 sv_dramout;
|
||||
s32 sv_first;
|
||||
} N_ALSynth;
|
||||
|
||||
/*************************************************************/
|
||||
void n_alSynAddPlayer(ALPlayer *client);
|
||||
ALFxRef n_alSynAllocFX(s16 bus, ALSynConfig *c, ALHeap *hp);
|
||||
s32 n_alSynAllocVoice(N_ALVoice *voice, ALVoiceConfig *vc);
|
||||
void n_alSynDelete(void);
|
||||
void n_alSynFreeVoice(N_ALVoice *voice);
|
||||
ALFxRef n_alSynGetFXRef(s16 bus, s16 index);
|
||||
s16 n_alSynGetPriority(N_ALVoice *voice);
|
||||
void n_alSynRemovePlayer(ALPlayer *client);
|
||||
void n_alSynSetFXMix(N_ALVoice *v, u8 fxmix);
|
||||
void n_alSynSetFXParam(ALFxRef fx, s16 paramID, void *param);
|
||||
void n_alSynSetFXtype(s16 bus, ALFxId fxid, s32 rate);
|
||||
void n_alSynSetPan(N_ALVoice *v, u8 pan);
|
||||
void n_alSynSetPitch(N_ALVoice *v, f32 pitch);
|
||||
void n_alSynSetPriority(N_ALVoice *voice, s16 priority);
|
||||
void n_alSynSetVol(N_ALVoice *v, s16 volume, ALMicroTime t);
|
||||
void n_alSynStartVoice(N_ALVoice *v, ALWaveTable *table);
|
||||
void n_alSynStartVoiceParams(N_ALVoice *v, ALWaveTable *w,f32 pitch,
|
||||
s16 vol, ALPan pan, u8 fxmix, ALMicroTime t);
|
||||
void n_alSynStopVoice(N_ALVoice *v);
|
||||
void n_alSynNew(ALSynConfig *c);
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
* Audio Library (AL) stuff
|
||||
***********************************************************************/
|
||||
typedef struct {
|
||||
N_ALSynth drvr;
|
||||
} N_ALGlobals;
|
||||
|
||||
extern N_ALGlobals *n_alGlobals;
|
||||
extern N_ALSynth *n_syn;
|
||||
|
||||
void n_alInit(N_ALGlobals *g, ALSynConfig *c);
|
||||
void n_alClose(void);
|
||||
Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen);
|
||||
|
||||
/*
|
||||
* for n_audio micro code
|
||||
*/
|
||||
extern long long int n_aspMainTextStart[], n_aspMainTextEnd[];
|
||||
extern long long int n_aspMainDataStart[], n_aspMainDataEnd[];
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !__N_LIBAUDIO__ */
|
||||
|
||||
|
||||
|
||||
43
src/libnaudio/n_sl.c
Normal file
43
src/libnaudio/n_sl.c
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*====================================================================
|
||||
*
|
||||
* Copyright 1993, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
N_ALGlobals *n_alGlobals = 0;
|
||||
N_ALSynth *n_syn = 0;
|
||||
|
||||
void n_alInit(N_ALGlobals *g, ALSynConfig *c)
|
||||
{
|
||||
if (!n_alGlobals) { /* already initialized? */
|
||||
n_alGlobals = g;
|
||||
if(!n_syn) {
|
||||
n_syn = &n_alGlobals -> drvr;
|
||||
n_alSynNew(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void n_alClose(void)
|
||||
{
|
||||
if (n_alGlobals) {
|
||||
n_alSynDelete();
|
||||
n_alGlobals = 0;
|
||||
n_syn = 0;
|
||||
}
|
||||
}
|
||||
161
src/libnaudio/n_synthInternals.h
Normal file
161
src/libnaudio/n_synthInternals.h
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
/*====================================================================
|
||||
*
|
||||
* Copyright 1993, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
#ifndef __N_SYNTHINTERNALS__
|
||||
#define __N_SYNTHINTERNALS__
|
||||
|
||||
#include <synthInternals.h>
|
||||
#include "n_libaudio_sc.h"
|
||||
#include "n_abi.h"
|
||||
|
||||
#define SAMPLE_ROUND
|
||||
#undef SAMPLE_ROUND
|
||||
|
||||
#define FINAL_ROUND
|
||||
|
||||
#define SAMPLES 184
|
||||
#define SAMPLE184(delta) (((delta) + (SAMPLES / 2)) / SAMPLES) * SAMPLES
|
||||
#define FIXED_SAMPLE SAMPLES
|
||||
|
||||
#define N_AL_DECODER_IN 0
|
||||
#define N_AL_RESAMPLER_OUT 0
|
||||
#define N_AL_TEMP_0 0
|
||||
#define N_AL_DECODER_OUT 368
|
||||
#define N_AL_TEMP_1 368
|
||||
#define N_AL_TEMP_2 736
|
||||
#define N_AL_MAIN_L_OUT 1248
|
||||
#define N_AL_MAIN_R_OUT 1616
|
||||
#define N_AL_AUX_L_OUT 1984
|
||||
#define N_AL_AUX_R_OUT 2352
|
||||
|
||||
#define N_AL_DIVIDED 368
|
||||
|
||||
typedef struct {
|
||||
struct ALParam_s *next;
|
||||
s32 delta;
|
||||
s16 type;
|
||||
struct N_PVoice_s *pvoice;
|
||||
} N_ALFreeParam;
|
||||
|
||||
typedef struct N_PVoice_s {
|
||||
ALLink node;
|
||||
struct N_ALVoice_s *vvoice;
|
||||
/** ALLoadFilter *********************************/
|
||||
ADPCM_STATE *dc_state;
|
||||
ADPCM_STATE *dc_lstate;
|
||||
ALRawLoop dc_loop;
|
||||
struct ALWaveTable_s *dc_table;
|
||||
s32 dc_bookSize;
|
||||
ALDMAproc dc_dma;
|
||||
void *dc_dmaState;
|
||||
s32 dc_sample;
|
||||
s32 dc_lastsam;
|
||||
s32 dc_first;
|
||||
s32 dc_memin;
|
||||
/** ALResampler *********************************/
|
||||
RESAMPLE_STATE *rs_state;
|
||||
f32 rs_ratio;
|
||||
s32 rs_upitch;
|
||||
f32 rs_delta;
|
||||
s32 rs_first;
|
||||
/** ALEnvMixer *********************************/
|
||||
ENVMIX_STATE *em_state;
|
||||
s16 em_pan;
|
||||
s16 em_volume;
|
||||
s16 em_cvolL;
|
||||
s16 em_cvolR;
|
||||
s16 em_dryamt;
|
||||
s16 em_wetamt;
|
||||
u16 em_lratl;
|
||||
s16 em_lratm;
|
||||
s16 em_ltgt;
|
||||
u16 em_rratl;
|
||||
s16 em_rratm;
|
||||
s16 em_rtgt;
|
||||
s32 em_delta;
|
||||
s32 em_segEnd;
|
||||
s32 em_first;
|
||||
ALParam *em_ctrlList;
|
||||
ALParam *em_ctrlTail;
|
||||
s32 em_motion;
|
||||
s32 offset;
|
||||
} N_PVoice;
|
||||
|
||||
|
||||
typedef Acmd *(*N_ALCmdHandler)(s32, Acmd *);
|
||||
|
||||
typedef struct N_ALFilter_s {
|
||||
struct N_ALFilter_s *source;
|
||||
N_ALCmdHandler handler;
|
||||
ALSetParam setParam;
|
||||
s16 inp;
|
||||
s16 outp;
|
||||
s32 type;
|
||||
} N_ALFilter;
|
||||
|
||||
typedef struct N_ALMainBus_s {
|
||||
N_ALFilter filter;
|
||||
} N_ALMainBus;
|
||||
|
||||
|
||||
|
||||
typedef struct N_ALAuxBus_s {
|
||||
ALFilter filter;
|
||||
s32 sourceCount;
|
||||
s32 maxSources;
|
||||
N_PVoice **sources;
|
||||
ALFx *fx;
|
||||
ALFx *fx_array[AL_MAX_AUX_BUS_SOURCES];
|
||||
} N_ALAuxBus;
|
||||
|
||||
void alN_PVoiceNew(N_PVoice *mv, ALDMANew dmaNew, ALHeap *hp);
|
||||
|
||||
ALParam *__n_allocParam(void);
|
||||
void _n_freeParam(ALParam *param);
|
||||
void _n_freePVoice(N_PVoice *pvoice);
|
||||
void _n_collectPVoices(void);
|
||||
s32 _n_timeToSamples(s32 micros);
|
||||
ALMicroTime _n_samplesToTime(s32 samples);
|
||||
|
||||
|
||||
Acmd *n_alAdpcmPull(N_PVoice *f,s16 *outp, s32 byteCount, Acmd *p);
|
||||
s32 n_alLoadParam(N_PVoice *filter, s32 paramID, void *param);
|
||||
|
||||
Acmd *n_alResamplePull(N_PVoice *f, s16 *outp,Acmd *p);
|
||||
s32 n_alResampleParam(N_PVoice *f, s32 paramID, void *param);
|
||||
|
||||
Acmd *n_alEnvmixerPull(N_PVoice *f, s32 sampleOffset, Acmd *p);
|
||||
s32 n_alEnvmixerParam(N_PVoice *p, s32 paramID, void *param);
|
||||
|
||||
Acmd *n_alAuxBusPull(s32 sampleOffset, Acmd *p);
|
||||
|
||||
Acmd *n_alFxPull(s32 sampleOffset, Acmd *p);
|
||||
s32 n_alFxParamHdl(void *filter, s32 paramID, void *param);
|
||||
void n_alFxNew(ALFx **r, ALSynConfig *c, ALHeap *hp);
|
||||
|
||||
Acmd *n_alMainBusPull(s32 sampleOffset, Acmd *p);
|
||||
|
||||
Acmd *n_alSavePull(s32 sampleOffset, Acmd *p);
|
||||
|
||||
#ifdef _OLD_AUDIO_LIBRARY
|
||||
void init_lpfilter(ALLowPass *lp);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
340
src/libnaudio/synthInternals.h
Normal file
340
src/libnaudio/synthInternals.h
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
/*====================================================================
|
||||
* audioInternals.h
|
||||
*
|
||||
* Synopsis:
|
||||
*
|
||||
* Copyright 1993, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
#ifndef __audioInternals__
|
||||
#define __audioInternals__
|
||||
|
||||
#include <libaudio.h>
|
||||
|
||||
/*
|
||||
* filter message ids
|
||||
*/
|
||||
enum {
|
||||
AL_FILTER_FREE_VOICE,
|
||||
AL_FILTER_SET_SOURCE,
|
||||
AL_FILTER_ADD_SOURCE,
|
||||
AL_FILTER_ADD_UPDATE,
|
||||
AL_FILTER_RESET,
|
||||
AL_FILTER_SET_WAVETABLE,
|
||||
/* AL_FILTER_SET_DMA_PROC,*/
|
||||
/* AL_FILTER_SKIP_LOOP,*/
|
||||
AL_FILTER_SET_DRAM,
|
||||
AL_FILTER_SET_PITCH,
|
||||
AL_FILTER_SET_UNITY_PITCH,
|
||||
AL_FILTER_START,
|
||||
/* AL_FILTER_SET_DECAY,*/
|
||||
/* AL_FILTER_SET_FC,*/
|
||||
AL_FILTER_SET_STATE,
|
||||
AL_FILTER_SET_VOLUME,
|
||||
AL_FILTER_SET_PAN,
|
||||
AL_FILTER_START_VOICE_ALT,
|
||||
AL_FILTER_START_VOICE,
|
||||
AL_FILTER_STOP_VOICE,
|
||||
AL_FILTER_SET_FXAMT
|
||||
};
|
||||
|
||||
#define AL_MAX_RSP_SAMPLES 160
|
||||
|
||||
/*
|
||||
* buffer locations based on AL_MAX_RSP_SAMPLES
|
||||
*/
|
||||
#define AL_DECODER_IN 0
|
||||
#define AL_RESAMPLER_OUT 0
|
||||
#define AL_TEMP_0 0
|
||||
#define AL_DECODER_OUT 320
|
||||
#define AL_TEMP_1 320
|
||||
#define AL_TEMP_2 640
|
||||
#define AL_MAIN_L_OUT 1088
|
||||
#define AL_MAIN_R_OUT 1408
|
||||
#define AL_AUX_L_OUT 1728
|
||||
#define AL_AUX_R_OUT 2048
|
||||
|
||||
/*
|
||||
* filter types
|
||||
*/
|
||||
enum {
|
||||
AL_ADPCM,
|
||||
AL_RESAMPLE,
|
||||
AL_BUFFER,
|
||||
AL_SAVE,
|
||||
AL_ENVMIX,
|
||||
AL_FX,
|
||||
AL_AUXBUS,
|
||||
AL_MAINBUS
|
||||
};
|
||||
|
||||
typedef struct ALParam_s {
|
||||
struct ALParam_s *next;
|
||||
s32 delta;
|
||||
s16 type;
|
||||
union {
|
||||
f32 f;
|
||||
s32 i;
|
||||
} data;
|
||||
union {
|
||||
f32 f;
|
||||
s32 i;
|
||||
} moredata;
|
||||
union {
|
||||
f32 f;
|
||||
s32 i;
|
||||
} stillmoredata;
|
||||
union {
|
||||
f32 f;
|
||||
s32 i;
|
||||
} yetstillmoredata;
|
||||
} ALParam;
|
||||
|
||||
typedef struct {
|
||||
struct ALParam_s *next;
|
||||
s32 delta;
|
||||
s16 type;
|
||||
s16 unity; /* disable resampler */
|
||||
f32 pitch;
|
||||
s16 volume;
|
||||
ALPan pan;
|
||||
u8 fxMix;
|
||||
s32 samples;
|
||||
struct ALWaveTable_s *wave;
|
||||
} ALStartParamAlt;
|
||||
|
||||
typedef struct {
|
||||
struct ALParam_s *next;
|
||||
s32 delta;
|
||||
s16 type;
|
||||
s16 unity; /* disable resampler */
|
||||
struct ALWaveTable_s *wave;
|
||||
} ALStartParam;
|
||||
|
||||
typedef struct {
|
||||
struct ALParam_s *next;
|
||||
s32 delta;
|
||||
s16 type;
|
||||
struct PVoice_s *pvoice;
|
||||
} ALFreeParam;
|
||||
|
||||
typedef Acmd *(*ALCmdHandler)(void *, s16 *, s32, s32, Acmd *);
|
||||
typedef s32 (*ALSetParam)(void *, s32, void *);
|
||||
|
||||
typedef struct ALFilter_s {
|
||||
struct ALFilter_s *source;
|
||||
ALCmdHandler handler;
|
||||
ALSetParam setParam;
|
||||
s16 inp;
|
||||
s16 outp;
|
||||
s32 type;
|
||||
} ALFilter;
|
||||
|
||||
void alFilterNew(ALFilter *f, ALCmdHandler h, ALSetParam s, s32 type);
|
||||
|
||||
#define AL_MAX_ADPCM_STATES 3 /* Depends on number of subframes
|
||||
* per frame and loop length
|
||||
*/
|
||||
typedef struct {
|
||||
ALFilter filter;
|
||||
ADPCM_STATE *state;
|
||||
ADPCM_STATE *lstate;
|
||||
ALRawLoop loop;
|
||||
struct ALWaveTable_s *table;
|
||||
s32 bookSize;
|
||||
ALDMAproc dma;
|
||||
void *dmaState;
|
||||
s32 sample;
|
||||
s32 lastsam;
|
||||
s32 first;
|
||||
s32 memin;
|
||||
} ALLoadFilter;
|
||||
|
||||
void alLoadNew(ALLoadFilter *f, ALDMANew dma, ALHeap *hp);
|
||||
Acmd *alAdpcmPull(void *f, s16 *outp, s32 byteCount, s32 sampleOffset, Acmd *p);
|
||||
Acmd *alRaw16Pull(void *f, s16 *outp, s32 byteCount, s32 sampleOffset, Acmd *p);
|
||||
s32 alLoadParam(void *filter, s32 paramID, void *param);
|
||||
|
||||
typedef struct ALResampler_s {
|
||||
ALFilter filter;
|
||||
RESAMPLE_STATE *state;
|
||||
f32 ratio;
|
||||
s32 upitch;
|
||||
f32 delta;
|
||||
s32 first;
|
||||
ALParam *ctrlList;
|
||||
ALParam *ctrlTail;
|
||||
s32 motion;
|
||||
} ALResampler;
|
||||
|
||||
typedef struct {
|
||||
s16 fc;
|
||||
s16 fgain;
|
||||
union {
|
||||
s16 fccoef[16];
|
||||
s64 force_aligned;
|
||||
} fcvec;
|
||||
POLEF_STATE *fstate;
|
||||
s32 first;
|
||||
} ALLowPass;
|
||||
|
||||
typedef struct {
|
||||
u32 input;
|
||||
u32 output;
|
||||
s16 ffcoef;
|
||||
s16 fbcoef;
|
||||
s16 gain;
|
||||
f32 rsinc;
|
||||
f32 rsval;
|
||||
s32 rsdelta;
|
||||
f32 rsgain;
|
||||
ALLowPass *lp;
|
||||
ALResampler *rs;
|
||||
} ALDelay;
|
||||
|
||||
typedef s32 (*ALSetFXParam)(void *, s32, void *);
|
||||
typedef struct {
|
||||
struct ALFilter_s filter;
|
||||
s16 *base;
|
||||
s16 *input;
|
||||
u32 length;
|
||||
ALDelay *delay;
|
||||
u8 section_count;
|
||||
ALSetFXParam paramHdl;
|
||||
} ALFx;
|
||||
|
||||
void alFxNew(ALFx *r, ALSynConfig *c, ALHeap *hp);
|
||||
Acmd *alFxPull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
|
||||
s32 alFxParam(void *filter, s32 paramID, void *param);
|
||||
s32 alFxParamHdl(void *filter, s32 paramID, void *param);
|
||||
|
||||
#define AL_MAX_MAIN_BUS_SOURCES 1
|
||||
typedef struct ALMainBus_s {
|
||||
ALFilter filter;
|
||||
s32 sourceCount;
|
||||
s32 maxSources;
|
||||
ALFilter **sources;
|
||||
} ALMainBus;
|
||||
|
||||
void alMainBusNew(ALMainBus *m, void *ptr, s32 len);
|
||||
Acmd *alMainBusPull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
|
||||
s32 alMainBusParam(void *filter, s32 paramID, void *param);
|
||||
|
||||
#define AL_MAX_AUX_BUS_SOURCES 8
|
||||
#define AL_MAX_AUX_BUS_FX 1
|
||||
typedef struct ALAuxBus_s {
|
||||
ALFilter filter;
|
||||
s32 sourceCount;
|
||||
s32 maxSources;
|
||||
ALFilter **sources;
|
||||
ALFx fx[AL_MAX_AUX_BUS_FX];
|
||||
} ALAuxBus;
|
||||
|
||||
void alAuxBusNew(ALAuxBus *m, void *ptr, s32 len);
|
||||
Acmd *alAuxBusPull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
|
||||
s32 alAuxBusParam(void *filter, s32 paramID, void *param);
|
||||
|
||||
void alResampleNew(ALResampler *r, ALHeap *hp);
|
||||
Acmd *alResamplePull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
|
||||
s32 alResampleParam(void *f, s32 paramID, void *param);
|
||||
|
||||
typedef struct ALSave_s {
|
||||
ALFilter filter;
|
||||
s32 dramout;
|
||||
s32 first;
|
||||
} ALSave;
|
||||
|
||||
void alSaveNew(ALSave *r);
|
||||
Acmd *alSavePull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
|
||||
s32 alSaveParam(void *f, s32 paramID, void *param);
|
||||
|
||||
typedef struct ALEnvMixer_s {
|
||||
ALFilter filter;
|
||||
ENVMIX_STATE *state;
|
||||
s16 pan;
|
||||
s16 volume;
|
||||
s16 cvolL;
|
||||
s16 cvolR;
|
||||
s16 dryamt;
|
||||
s16 wetamt;
|
||||
u16 lratl;
|
||||
s16 lratm;
|
||||
s16 ltgt;
|
||||
u16 rratl;
|
||||
s16 rratm;
|
||||
s16 rtgt;
|
||||
s32 delta;
|
||||
s32 segEnd;
|
||||
s32 first;
|
||||
ALParam *ctrlList;
|
||||
ALParam *ctrlTail;
|
||||
ALFilter **sources;
|
||||
s32 motion;
|
||||
} ALEnvMixer;
|
||||
|
||||
void alEnvmixerNew(ALEnvMixer *e, ALHeap *hp);
|
||||
Acmd *alEnvmixerPull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
|
||||
s32 alEnvmixerParam(void *filter, s32 paramID, void *param);
|
||||
|
||||
|
||||
/*
|
||||
* heap stuff
|
||||
*/
|
||||
typedef struct {
|
||||
s32 magic; /* check structure integrety */
|
||||
s32 size; /* size of this allocated block */
|
||||
u8 *file; /* file that this alloc was called from */
|
||||
s32 line; /* line that it was called from */
|
||||
s32 count; /* heap call number */
|
||||
s32 pad0;
|
||||
s32 pad1;
|
||||
s32 pad2; /* Make it 32 bytes */
|
||||
} HeapInfo;
|
||||
|
||||
#define AL_CACHE_ALIGN 15
|
||||
|
||||
/*
|
||||
* synth stuff
|
||||
*/
|
||||
|
||||
typedef struct PVoice_s {
|
||||
ALLink node;
|
||||
struct ALVoice_s *vvoice;
|
||||
ALFilter *channelKnob;
|
||||
ALLoadFilter decoder;
|
||||
ALResampler resampler;
|
||||
ALEnvMixer envmixer;
|
||||
s32 offset;
|
||||
} PVoice;
|
||||
|
||||
/*
|
||||
* prototypes for private driver functions
|
||||
*/
|
||||
ALParam *__allocParam(void);
|
||||
void __freeParam(ALParam *param);
|
||||
void _freePVoice(ALSynth *drvr, PVoice *pvoice);
|
||||
void _collectPVoices(ALSynth *drvr);
|
||||
|
||||
s32 _timeToSamples(ALSynth *ALSynth, s32 micros);
|
||||
ALMicroTime _samplesToTime(ALSynth *synth, s32 samples);
|
||||
|
||||
#ifndef _OLD_AUDIO_LIBRARY
|
||||
void _init_lpfilter(ALLowPass *lp);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
- [0x373A0, c] # battle code
|
||||
- [0x38BB0, c] #
|
||||
- [0x3D140, c] # music code
|
||||
- [0x43520, c] #
|
||||
- [0x43520, c, libnaudio/n_sl]
|
||||
- [0x435B0, c] #
|
||||
- [0x435D0, c] # pkm lab cries code
|
||||
- [0x45720, c] # music code
|
||||
|
|
@ -337,6 +337,8 @@
|
|||
- [0x76280, data, rom_data_76280]
|
||||
- [0x78570, .data, 373A0]
|
||||
- [0x78890, data, rom_data_78890]
|
||||
- [0x79180, .data, libnaudio/n_sl]
|
||||
- [0x79190, data, rom_data_79190]
|
||||
- [0x79630, .data, 49790]
|
||||
- [0x79660, data, rom_data_79660]
|
||||
- [0x79AE0, .data, 4CBC0]
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user