jaudio_NES/driver.c 74%

This commit is contained in:
Cuyler36
2025-10-21 21:32:58 -04:00
parent 566b830e51
commit 33cfd1e2e8
7 changed files with 773 additions and 222 deletions
+13 -1
View File
@@ -38,6 +38,8 @@ extern "C" {
#define ADSR_RESTART -3
#define ADSR_SPECIAL4 -4 // TODO: figure this out
#define A_ADPCM_SHORT 0x04
// Audio ABI commands
#define A_CMD_SPNOOP 0
#define A_CMD_ADPCM 1
@@ -98,6 +100,14 @@ extern "C" {
_a->words.w1 = (u32)(dst); \
}
#define aInterleave2(pkt, o, l, r, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_INTERLEAVE, 24, 8) | _SHIFTL(c >> 4, 16, 8) | _SHIFTL(o, 0, 16)); \
_a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
}
#define aSetEnvParam2(pkt, volL, volR) \
{ \
Acmd *_a = (Acmd *)pkt; \
@@ -233,7 +243,9 @@ typedef enum SampleCodec {
/* 2 */ CODEC_S16_INMEMORY,
/* 3 */ CODEC_SMALL_ADPCM, // 16 2-byte samples (32 bytes) compressed into 2-bit samples (4 bytes) + 1 header byte
/* 4 */ CODEC_REVERB,
/* 5 */ CODEC_S16
/* 5 */ CODEC_S16,
/* 6 */ CODEC_UNK6,
/* 7 */ CODEC_UNK7,
} SampleCodec;
typedef enum LpsCacheState {
+2
View File
@@ -22,4 +22,6 @@ extern f32 PhoneLeft[];
extern f32 WideLeft[];
extern f32 StereoLeft[];
extern u8 VELOCONV_TABLE[][256];
#endif
+17
View File
@@ -1,10 +1,27 @@
#ifndef DRIVER_H
#define DRIVER_H
#include "PR/abi.h"
#include "types.h"
#include "jaudio_NES/audiowork.h"
// size of a single sample point
#define SAMPLE_SIZE (s32)sizeof(s16)
// Samples are processed in groups of 16 called a "frame"
#define SAMPLES_PER_FRAME ADPCMFSIZE
// The length of one left/right channel is 13 frames
#define DMEM_1CH_SIZE (13 * SAMPLES_PER_FRAME * SAMPLE_SIZE) // 0x1A0
// Both left and right channels
#define DMEM_2CH_SIZE (2 * DMEM_1CH_SIZE) // 0x340
extern Acmd* Nas_smzAudioFrame(Acmd* cmds, s32* processed_cmds, s16* pSamples, s32 nSamples);
extern Acmd* Nas_DriveRsp(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updateIndex);
extern Acmd* Nas_SynthMain(s32 chan_id, commonch* common, driverch* driver, s16* samples, s32 samples_per_update, Acmd* cmd, s32 update_idx);
extern Acmd* Nas_Synth_Resample(Acmd* cmd, driverch* driver, s32 size, u16 frequencyFixedPoint, u16 sampleDmemBeforeResampling, s32 flags);
extern Acmd* Nas_DolbySurround(Acmd* cmd, commonch* common, driverch* driver, s32 samples_per_update, s32 dmem, s32 flags);
extern Acmd* Nas_Synth_Envelope(Acmd* cmd, commonch* common, driverch* driver, s32 samples_per_update, u16 dmem, s32 haasEffectDelaySide, s32 flags);
extern Acmd* Nas_Synth_Delay(Acmd* cmd, commonch* common, driverch* driver, s32 size, s32 flags, s32 haasEffectDelaySide);
#endif
+1
View File
@@ -17,6 +17,7 @@ typedef enum SET_EXT_POINTER_TYPE {
typedef s32 (*Na_DmaProc)(OSPiHandle* handle, OSIoMesg* mb, s32 direction);
typedef s32 (*Na_SyncProc)(u8* param0, s32 param1);
extern void* Nas_WaveDmaCallBack(u32 device_addr, u32 size, s32 arg2, u8* waveload_idx, s32 medium);
extern void Nas_InitAudio(u64* acmdBuf, s32 acmdBufSize);
extern void Nas_FastCopy(u8* SrcAddr, u8* DestAdd, size_t Length, s32 medium);
extern void Nas_FastDiskCopy(u8* SrcAddr, u8* DestAdd, size_t Length, s32 medium);