From 1bd226dee13c6f831447de16a9328cb0d8e27e83 Mon Sep 17 00:00:00 2001 From: roeming Date: Thu, 3 Jul 2025 16:42:02 -0400 Subject: [PATCH] fix build --- include/jaudio_NES/audiostruct.h | 235 ++++++++++++++++--------------- 1 file changed, 125 insertions(+), 110 deletions(-) diff --git a/include/jaudio_NES/audiostruct.h b/include/jaudio_NES/audiostruct.h index 8dc8f80d..dd3b1bbb 100644 --- a/include/jaudio_NES/audiostruct.h +++ b/include/jaudio_NES/audiostruct.h @@ -450,11 +450,11 @@ typedef struct macro_ { typedef union subtrack_updates { struct { - /* 0x01 */ u8 frequency_scale : 1; - /* 0x01 */ u8 volume : 1; - /* 0x01 */ u8 pan : 1; - } flags; - /* 0x01 */ u8 as_byte; + /* 0x01 */ u8 frequency_scale : 1; + /* 0x01 */ u8 volume : 1; + /* 0x01 */ u8 pan : 1; + } flags; + /* 0x01 */ u8 as_byte; } subtrack_updates; /* SubTrack struct */ @@ -761,6 +761,7 @@ typedef struct SwHeap_ { /* TODO: this needs a better name, I don't see any functions which reference it */ /* sizeof(ALHeapEntry) == 0xC */ +#define HEAP_INVALID_INDEX (0xffffffff) typedef struct ALHeapEntry_ { /* 0x00 */ u8* addr; /* 0x04 */ size_t size; @@ -894,7 +895,7 @@ typedef struct AudioGlobals { /* 0x351C */ u8 wave_load_status[172]; /* 0x35C8 */ u8 bank_load_status[172]; /* 0x3674 */ u8 sequence_load_status[252]; - /* 0x3770 */ u8 reset_status; + /* 0x3770 */ volatile u8 reset_status; /* 0x3771 */ u8 spec_id; /* 0x3774 */ s32 audio_reset_fadeout_frames_left; /* 0x3778 */ f32* adsr_decay_table; @@ -972,10 +973,10 @@ typedef struct Ibnk_ InstBank; // C++ JAudio1 typedef enum JCSTATUS { - JCSTAT_Unk0 = 0, - JCSTAT_Unk1 = 1, - JCSTAT_Unk2 = 2, - JCSTAT_Unk6 = 6, + JCSTAT_Unk0 = 0, + JCSTAT_Unk1 = 1, + JCSTAT_Unk2 = 2, + JCSTAT_Unk6 = 6, } JCSTATUS; typedef struct dspch_ dspch_; // TODO: Figure out why there is another struct named `DSPChannel_` in syncstream.c. @@ -991,21 +992,21 @@ typedef BOOL (*DSPChannelCallback)(dspch_*, u32); * @brief TODO. */ struct dspch_ { - u8 buffer_idx; // _00 - u8 _01; // _01 - u8 _02; // _02 - u8 _03; // _03 - u16 _04; // _04 - u16 _06; // _06 - // u32 _08; // _08 - jc_* _08; // _08 - DSPChannelCallback _0C; // _0C + u8 buffer_idx; // _00 + u8 _01; // _01 + u8 _02; // _02 + u8 _03; // _03 + u16 _04; // _04 + u16 _06; // _06 + // u32 _08; // _08 + jc_* _08; // _08 + DSPChannelCallback _0C; // _0C - // DSPchannel_* _0C; // TODO: SMS says this exists, Pikmin 1 disagrees. + // DSPchannel_* _0C; // TODO: SMS says this exists, Pikmin 1 disagrees. }; typedef struct PanMatrix_ { - f32 values[3]; + f32 values[3]; } PanMatrix_; /** @@ -1014,41 +1015,41 @@ typedef struct PanMatrix_ { * @note Size: 0x74. */ struct jcs_ { - u32 chanCount; // _00, Number of channels in this system - u32 chanAllocCount; // _04, Total channel allocation counter - jc_* freeChannels; // _08, Linked list of free channels - jc_* activeChannels; // _0C, Linked list of active channels - jc_* releasingChannels; // _10, Linked list of releasing channels - jc_* waitingChannels; // _14, Linked list of channels waiting for DSP - f32 volume; // _18, Master volume (default 1.0) - f32 pitch; // _1C, Master pitch/cent adjustment (default 1.0) - f32 pan; // _20, Master pan position (default 0.5) - f32 fxmix; // _24, Effects mix level (default 0.0) - f32 dolby; // _28, Dolby surround level (default 0.0) + u32 chanCount; // _00, Number of channels in this system + u32 chanAllocCount; // _04, Total channel allocation counter + jc_* freeChannels; // _08, Linked list of free channels + jc_* activeChannels; // _0C, Linked list of active channels + jc_* releasingChannels; // _10, Linked list of releasing channels + jc_* waitingChannels; // _14, Linked list of channels waiting for DSP + f32 volume; // _18, Master volume (default 1.0) + f32 pitch; // _1C, Master pitch/cent adjustment (default 1.0) + f32 pan; // _20, Master pan position (default 0.5) + f32 fxmix; // _24, Effects mix level (default 0.0) + f32 dolby; // _28, Dolby surround level (default 0.0) - s16 firCoefficients[8]; // _2C, FIR filter coefficients (8 taps) - s16 iirCoefficients[4]; // _3C, IIR filter coefficients + s16 firCoefficients[8]; // _2C, FIR filter coefficients (8 taps) + s16 iirCoefficients[4]; // _3C, IIR filter coefficients - char _44[8]; // _44 - s16 distFilter; // _4C, Distance filter parameter (default 0) - u16 busConnect[6]; // _4E, Bus routing configuration for 6 outputs - u8 masterLevels[6]; // _5A - u8 maxDelay; // _60, Maximum delay setting (default 0) - u8 filterMode; // _61, Filter enable flags (bit 5=IIR, bits 0-4=FIR taps) - u8 panCalcTypes[3]; // _62, Pan calculation types (default [26,1,1]) - u32 channelPriority; // _68 - u16 releaseTime; // _6C, Release/fade time in samples (default 600) - int voiceStealingMode; // _70, Voice stealing enabled (0=off, 1=on) + char _44[8]; // _44 + s16 distFilter; // _4C, Distance filter parameter (default 0) + u16 busConnect[6]; // _4E, Bus routing configuration for 6 outputs + u8 masterLevels[6]; // _5A + u8 maxDelay; // _60, Maximum delay setting (default 0) + u8 filterMode; // _61, Filter enable flags (bit 5=IIR, bits 0-4=FIR taps) + u8 panCalcTypes[3]; // _62, Pan calculation types (default [26,1,1]) + u32 channelPriority; // _68 + u16 releaseTime; // _6C, Release/fade time in samples (default 600) + int voiceStealingMode; // _70, Voice stealing enabled (0=off, 1=on) }; // needed to match UpdateEffecterParam typedef union MixConfig { - u16 whole; - struct { - u8 upper; - u8 lower0 : 4; - u8 lower1 : 4; - } parts; + u16 whole; + struct { + u8 upper; + u8 lower0 : 4; + u8 lower1 : 4; + } parts; } MixConfig; typedef BOOL (*JCUpdateCallback)(jc_*, JCSTATUS); @@ -1057,71 +1058,85 @@ typedef BOOL (*JCUpdateCallback)(jc_*, JCSTATUS); * @brief TODO. */ struct jc_ { - u8 velocity; // _00 - u8 note; // _01 - u8 pauseFlag; // _02 - u8 toFlush; // _03 - jcs_* mMgr; // _04 - struct jc_** chanListHead; // _08 - u8 logicalChanType; // _0C, 0 = Wave, 1 = ??, 2 = Oscillator - Wave_* waveData; // _10 - u32 _14; // _14 - u32 _18; // _18 - u32 _1C; // _1C - dspch_* dspChannel; // _20 - void* mNext; // _24 - JCUpdateCallback updateCallback; // _28 - JCUpdateCallback pitchSweepUpdater; // _2C - s32 playId; // _30 - s32 savedPlayId; // _34 - struct Osc_* mOscillators[4]; // _38 - struct Oscbuf_ mOscBuffers[2]; // _48 - f32 _78; // _78 - char _7C[8]; // _7C - f32 _84; // _84 - char _88[4]; // _88 - f32 _8C; // _8C - f32 _90; // _90 - f32 _94; // _94 - u16 _98; // _98 - u16 _9A; // _9A - void* _9C; // _9C - char _A0[8]; // _A0 - f32 basePitch; // _A8 - f32 baseVolume; // _AC - f32 currentPitch; // _B0 - f32 currentVolume; // _B4 - u8 panCalcTypes[3]; // _B8 - PanMatrix_ panMatrices[4]; // _BC, 0 = Power distribution, 1 = Pan, 2 = Effects send (fxmix), 3 = Dolby surround - f32 pitchModifier; // _EC - f32 volumeModifier; // _F0 - f32 targetPitch; // _F4 - u16 finalPitch; // _F8 - u16 pitchSweepSteps; // _FA - jcs_* lastManager; // _FC - f32 managerPitch; // _100 - f32 managerVolume; // _104 - MixConfig busRouting[6]; // _108 - u16 mixerLevels[6]; // _114 - u32 channelPriority; // _120 - u16 releaseTime; // _124 - u16 channelId; // _126 - int soundId; // _128 - u8 polyphonyCounter; // _12C - char _12D[3]; // _12D - int _130; // _130 - int _134; // _134 - int _138; // _138 - int _13C; // _13C + u8 velocity; // _00 + u8 note; // _01 + u8 pauseFlag; // _02 + u8 toFlush; // _03 + jcs_* mMgr; // _04 + struct jc_** chanListHead; // _08 + u8 logicalChanType; // _0C, 0 = Wave, 1 = ??, 2 = Oscillator + Wave_* waveData; // _10 + u32 _14; // _14 + u32 _18; // _18 + u32 _1C; // _1C + dspch_* dspChannel; // _20 + void* mNext; // _24 + JCUpdateCallback updateCallback; // _28 + JCUpdateCallback pitchSweepUpdater; // _2C + s32 playId; // _30 + s32 savedPlayId; // _34 + struct Osc_* mOscillators[4]; // _38 + struct Oscbuf_ mOscBuffers[2]; // _48 + f32 _78; // _78 + char _7C[8]; // _7C + f32 _84; // _84 + char _88[4]; // _88 + f32 _8C; // _8C + f32 _90; // _90 + f32 _94; // _94 + u16 _98; // _98 + u16 _9A; // _9A + void* _9C; // _9C + char _A0[8]; // _A0 + f32 basePitch; // _A8 + f32 baseVolume; // _AC + f32 currentPitch; // _B0 + f32 currentVolume; // _B4 + u8 panCalcTypes[3]; // _B8 + PanMatrix_ panMatrices[4]; // _BC, 0 = Power distribution, 1 = Pan, 2 = Effects send (fxmix), 3 = Dolby surround + f32 pitchModifier; // _EC + f32 volumeModifier; // _F0 + f32 targetPitch; // _F4 + u16 finalPitch; // _F8 + u16 pitchSweepSteps; // _FA + jcs_* lastManager; // _FC + f32 managerPitch; // _100 + f32 managerVolume; // _104 + MixConfig busRouting[6]; // _108 + u16 mixerLevels[6]; // _114 + u32 channelPriority; // _120 + u16 releaseTime; // _124 + u16 channelId; // _126 + int soundId; // _128 + u8 polyphonyCounter; // _12C + char _12D[3]; // _12D + int _130; // _130 + int _134; // _134 + int _138; // _138 + int _13C; // _13C }; typedef struct Wavelookuptable_ { - // TODO + u8* sample; + u8* _04; + u32 _08; + u8 medium; } Wavelookuptable; -typedef struct fxconfig { - // TODO: members -} fxconfig_; +typedef struct fxconfig_ { + u8 downsample_rate; + u16 _02; + u16 decay_ratio; + u16 sub_delay; + u16 sub_volume; + u16 volume; + u16 leak_rtl; + u16 leak_ltl; + s8 mix_reverb_idx; + u16 mix_reverb_strength; + s16 _14; + s16 _16; +} fxconfig; #ifdef __cplusplus }