Skip to content

Commit c9ed25a

Browse files
committed
Finish matching libnaudio
1 parent 8a8e420 commit c9ed25a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2691
-445
lines changed

include/PR/libaudio.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ typedef struct {
301301
void *dmaproc;
302302
ALHeap *heap;
303303
s32 outputRate; /* output sample rate */
304-
ALFxId fxType;
305-
s32 *params;
304+
ALFxId fxTypes[4];
305+
s32 *params[2];
306306
} ALSynConfig;
307307

308308
typedef struct ALPlayer_s {
@@ -404,6 +404,10 @@ Acmd *alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen);
404404
#define AL_STOPPED 0
405405
#define AL_PLAYING 1
406406
#define AL_STOPPING 2
407+
#define AL_STATE3 3
408+
#define AL_STATE4 4
409+
#define AL_STATE5 5
410+
#define AL_STARTING 6
407411

408412
#define AL_DEFAULT_PRIORITY 5
409413
#define AL_DEFAULT_VOICE 0
@@ -931,9 +935,11 @@ void alCSPSendMidi(ALCSPlayer *seqp, s32 ticks, u8 status,
931935
***********************************************************************/
932936

933937
typedef struct {
934-
s32 maxSounds;
938+
s32 maxStates;
935939
s32 maxEvents;
940+
s32 maxSounds;
936941
ALHeap *heap;
942+
u16 unk10;
937943
} ALSndpConfig;
938944

939945
typedef struct {

include/libnaudio/n_libaudio.h

+18-17
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@ extern "C" {
2929
#include <PR/ultratypes.h>
3030
#include <PR/mbi.h>
3131

32-
struct var8009c340 {
33-
u8 surround;
34-
u8 mono;
35-
u8 headphone;
36-
u8 unk03;
37-
};
38-
39-
extern struct var8009c340 D_800BFE82;
40-
41-
extern u8 D_800BFE86[2];
42-
extern u8 D_800BFE88[2];
43-
44-
4532
/*
4633
* Synthesis driver stuff
4734
*/
@@ -163,6 +150,17 @@ typedef struct {
163150
u8 param;
164151
} N_AL19Event;
165152

153+
typedef struct {
154+
u8 unk00;
155+
f32 unk01;
156+
} N_AL1AEvent;
157+
158+
typedef struct {
159+
struct sndstate *sndstate;
160+
s32 data;
161+
ALBank *data2;
162+
} N_ALGenericEvent;
163+
166164
typedef struct {
167165
s16 type;
168166
union {
@@ -179,6 +177,8 @@ typedef struct {
179177
N_ALOscEvent osc;
180178
N_AL18Event evt18;
181179
N_AL19Event evt19;
180+
N_AL1AEvent evt1a;
181+
N_ALGenericEvent generic;
182182
} msg;
183183
} N_ALEvent;
184184

@@ -335,13 +335,13 @@ void n_alSeqpLoop(N_ALSeqPlayer *seqp, ALSeqMarker *start, ALSeqMarker *end,
335335
*/
336336
void n_alCSPNew(N_ALCSPlayer *seqp, ALSeqpConfig *config);
337337
void n_alCSPDelete(N_ALCSPlayer *seqp);
338-
u8 n_alCSPGetChlVol(N_ALCSPlayer *seqp, u8 chan);
338+
u8 n_alCSPGetChlVol(N_ALCSPlayer *seqp, u8 chan);
339339
u8 n_alCSPGetChlFXMix(N_ALCSPlayer *seqp, u8 chan);
340340
ALPan n_alCSPGetChlPan(N_ALCSPlayer *seqp, u8 chan);
341341
u8 n_alCSPGetChlPriority(N_ALCSPlayer *seqp, u8 chan);
342342
s32 n_alCSPGetChlProgram(N_ALCSPlayer *seqp, u8 chan);
343-
ALCSeq *n_alCSPGetSeq(N_ALCSPlayer *seqp);
344-
s32 n_alCSPGetState(N_ALCSPlayer *seqp);
343+
ALCSeq *n_alCSPGetSeq(N_ALCSPlayer *seqp);
344+
s32 n_alCSPGetState(N_ALCSPlayer *seqp);
345345
s32 n_alCSPGetTempo(N_ALCSPlayer *seqp);
346346
s16 n_alCSPGetVol(N_ALCSPlayer *seqp);
347347
void n_alCSPPlay(N_ALCSPlayer *seqp);
@@ -356,6 +356,7 @@ void n_alCSPSetSeq(N_ALCSPlayer *seqp, ALCSeq *seq);
356356
void n_alCSPSetTempo(N_ALCSPlayer *seqp, s32 tempo);
357357
void n_alCSPSetVol(N_ALCSPlayer *seqp, s16 vol);
358358
void n_alCSPStop(N_ALCSPlayer *seqp);
359+
void func_8006721C(N_ALCSPlayer *seqp, u8 arg1, f32 arg2);
359360

360361

361362
/*
@@ -374,7 +375,7 @@ typedef struct {
374375
ALMicroTime curTime;
375376
} N_ALSndPlayer;
376377

377-
void n_alSndpNew(N_ALSndPlayer *sndp, ALSndpConfig *c);
378+
void n_alSndpNew(ALSndpConfig *c);
378379
void n_alSndpDelete(void);
379380
ALSndId n_alSndpAllocate(ALSound *sound);
380381
void n_alSndpDeallocate(ALSndId id);

include/libnaudio/n_sndp.h

+21-14
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,21 @@
3434
#define MIN_RATIO 0.0001
3535

3636
typedef enum {
37-
AL_SNDP_PLAY_EVT,
38-
AL_SNDP_STOP_EVT,
39-
AL_SNDP_PAN_EVT,
40-
AL_SNDP_VOL_EVT,
41-
AL_SNDP_PITCH_EVT,
42-
AL_SNDP_API_EVT,
43-
AL_SNDP_DECAY_EVT,
44-
AL_SNDP_END_EVT,
45-
AL_SNDP_FX_EVT
37+
AL_SNDP_PLAY_EVT = 0x0001,
38+
AL_SNDP_STOP_EVT = 0x0002,
39+
AL_SNDP_PAN_EVT = 0x0004,
40+
AL_SNDP_VOL_EVT = 0x0008,
41+
AL_SNDP_PITCH_EVT = 0x0010,
42+
AL_SNDP_API_EVT = 0x0020,
43+
AL_SNDP_DECAY_EVT = 0x0040,
44+
AL_SNDP_END_EVT = 0x0080,
45+
AL_SNDP_FX_EVT = 0x0100,
46+
AL_SNDP_0200_EVT = 0x0200,
47+
AL_SNDP_0400_EVT = 0x0400,
48+
AL_SNDP_0800_EVT = 0x0800,
49+
AL_SNDP_1000_EVT = 0x1000,
50+
AL_SNDP_FXBUS_EVT = 0x2000,
51+
AL_SNDP_4000_EVT = 0x4000
4652
} ALSndpMsgType;
4753

4854
typedef struct {
@@ -61,8 +67,9 @@ typedef union {
6167
N_ALEvent msg;
6268

6369
struct {
64-
s16 type;
70+
u16 type;
6571
N_ALSoundState *state;
72+
u32 unk08;
6673
} common;
6774

6875
struct {
@@ -91,9 +98,9 @@ typedef union {
9198

9299
} N_ALSndpEvent;
93100

94-
static ALMicroTime _n_sndpVoiceHandler(void *node);
95-
static void _n_handleEvent(N_ALSndpEvent *event);
96-
static void _removeEvents(ALEventQueue *evtq, N_ALSoundState *state);
97-
static s32 _DivS32ByF32 (s32 i, f32 f);
101+
ALMicroTime _n_sndpVoiceHandler(void *node);
102+
void _n_handleEvent(N_ALSndpEvent *event);
103+
void _removeEvents(ALEventQueue *evtq, N_ALSoundState *state, u16 typemask);
104+
s32 _DivS32ByF32 (s32 i, f32 f);
98105

99106
#endif /* __N_SNDP__ */

include/libnaudio/n_synthInternals.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ s32 n_alEnvmixerParam(N_PVoice *p, s32 paramID, void *param);
163163
s32 n_alAuxBusParam( s32 paramID, void *param);
164164
Acmd *n_alAuxBusPull( s32 sampleOffset, Acmd *p, s32 fxBus, s32 *numpulls);
165165

166-
Acmd *n_alFxPull( s32 sampleOffset, Acmd *p);
166+
Acmd *n_alFxPull( s32 sampleOffset, Acmd *p, s32 arg2);
167167
s32 n_alFxParamHdl(void *filter, s32 paramID, void *param);
168-
void n_alFxNew(ALFx **r, ALSynConfig *c, ALHeap *hp);
168+
void n_alFxNew(ALFx **r, ALSynConfig *c, s16 bus, ALHeap *hp);
169169

170170
Acmd *n_alMainBusPull( s32 sampleOffset, Acmd *p);
171171
s32 n_alMainBusParam( s32 paramID, void *param);

include/libultra/audio/synthInternals.h

+8-6
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ typedef struct ALParam_s {
105105
f32 f;
106106
s32 i;
107107
} yetstillmoredata;
108+
s32 unk1c;
109+
s32 unk20;
108110
} ALParam;
109111

110112
typedef struct {
@@ -177,7 +179,7 @@ s32 alLoadParam(void *filter, s32 paramID, void *param);
177179

178180
typedef struct ALResampler_s {
179181
ALFilter filter;
180-
RESAMPLE_STATE *state;
182+
RESAMPLE_STATE *state[2];
181183
f32 ratio;
182184
s32 upitch;
183185
f32 delta;
@@ -190,12 +192,13 @@ typedef struct ALResampler_s {
190192
typedef struct {
191193
s16 fc;
192194
s16 fgain;
195+
s32 unk04;
193196
union {
194197
s16 fccoef[16];
195198
s64 force_aligned;
196199
} fcvec;
197-
POLEF_STATE *fstate;
198200
s32 first;
201+
POLEF_STATE *fstate[2];
199202
} ALLowPass;
200203

201204
typedef struct {
@@ -214,13 +217,12 @@ typedef struct {
214217

215218
typedef s32 (*ALSetFXParam)(void *, s32, void *);
216219
typedef struct {
217-
struct ALFilter_s filter;
218-
s16 *base;
219-
s16 *input;
220220
u32 length;
221221
ALDelay *delay;
222222
u8 section_count;
223-
ALSetFXParam paramHdl;
223+
struct ALFilter_s filter;
224+
s16 *base[2];
225+
s16 *input[2];
224226
} ALFx;
225227

226228
void alFxNew(ALFx *r, ALSynConfig *c, ALHeap *hp);

include/sys/audio/speaker.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef _SYS_AUDIO_SPEAKER_H
2+
#define _SYS_AUDIO_SPEAKER_H
3+
4+
#include <PR/ultratypes.h>
5+
6+
#define SPEAKERMODE_MONO 1
7+
#define SPEAKERMODE_STEREO 2
8+
#define SPEAKERMODE_HEADPHONE 3
9+
#define SPEAKERMODE_SURROUND 4
10+
11+
struct var800BFE82 {
12+
u8 surround;
13+
u8 mono;
14+
u8 headphone;
15+
u8 unk03;
16+
};
17+
18+
extern struct var800BFE82 D_800BFE82;
19+
20+
extern u8 D_800BFE86[2];
21+
extern u8 D_800BFE88[2];
22+
23+
void speaker_set_mode(u8 mode);
24+
void speaker_func_80063bb4(s32 index, s32 arg1);
25+
26+
#endif //_SYS_AUDIO_SPEAKER_H

splat.yaml

+10-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ segments:
9292
- [0x64320, c, segment_64320]
9393
- [0x645A0, c, libnaudio/n_sl]
9494
- [0x64660, c, libultra/audio/sl]
95-
- [0x646E0, c, speaker]
95+
- [0x646E0, c, audio/speaker]
9696
- [0x648F0, c, libnaudio/n_synthesizer]
9797
- [0x65380, c, libnaudio/n_sndplayer]
9898
- [0x67660, c, libultra/audio/bnkf]
@@ -111,7 +111,7 @@ segments:
111111
- [0x67EB0, c, libnaudio/n_cspsetchlvol]
112112
- [0x67F20, c, libnaudio/n_cspgetfxmix]
113113
- [0x67F50, c, libnaudio/mp3/segment_67F50]
114-
- [0x68FE0, c, amAudio]
114+
- [0x68FE0, c, audio/amAudio]
115115
- [0x6A0C0, c, libnaudio/n_syndelete]
116116
- [0x6A0E0, c, libnaudio/n_synallocfx]
117117
- [0x6A170, c, libnaudio/n_reverb]
@@ -289,6 +289,9 @@ segments:
289289
- [0x93C08, bin]
290290
- [0x93CB8, .data, libultra/io/vimgr]
291291
- [0x93CD0, bin]
292+
- [0x944B0, .data, libnaudio/n_sl]
293+
- [0x944C0, .data, libnaudio/n_sndplayer]
294+
- [0x944E0, .data, libnaudio/n_drvrNew]
292295
- [0x94570, .data, libnaudio/n_env]
293296
- [0x94670, bin]
294297
- [0x973A0, .data, libnaudio/n_csplayer]
@@ -329,6 +332,11 @@ segments:
329332
- [0x9B8D8, bin]
330333
- [0x9B980, .rodata, libultra/gu/perspective]
331334
- [0x9B988, bin]
335+
- [0x9C420, .rodata, libnaudio/n_synthesizer]
336+
- [0x9C430, .rodata, libnaudio/n_sndplayer]
337+
- [0x9C570, .rodata, audio/amAudio]
338+
- [0x9C640, .rodata, libnaudio/n_reverb]
339+
- [0x9C670, .rodata, libnaudio/n_drvrNew]
332340
- [0x9C690, .rodata, libultra/audio/cents2ratio]
333341
- [0x9C6A0, .rodata, libnaudio/n_env]
334342
- [0x9C6F0, bin]

src/amAudio.c

-84
This file was deleted.

0 commit comments

Comments
 (0)