1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-10-16 19:51:23 +00:00

audio_playback, audio_effects OK (#313)

* audio_playback.c

* format.sh

* rename functions

* Audio_SequenceChannelProcessSound

* Audio_SequencePlayerProcessSound

* Audio_GetPortamentoFreqScale

* Audio_GetVibratoPitchChange

* Audio_GetVibratoFreqScale

* Audio_NoteVibratoInit, Audio_NoteVibratoUpdate

* Audio_NotePortamentoInit

* Audio_AdsrInit

* Audio_AdsrUpdate

* Common bitfield formatting

* format.sh

* review

Co-authored-by: zelda2774 <zelda2774@invalid>
This commit is contained in:
zelda2774 2020-08-15 20:06:26 +02:00 committed by GitHub
commit d68f9893fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
115 changed files with 1014 additions and 1825 deletions

View file

@ -5,6 +5,7 @@
* Structs in this repository have primarily been imported from the SM64 Decompilation.
* Many things likely still need shifted around and structs need adjusted.
* Take sizes and locations of structs as very volatile.
* The symbol '!' next to an offset means the member is confirmed.
*/
struct Note;
@ -20,21 +21,20 @@ typedef struct AudioListItem {
// to itself. 'count' contains the size of the list.
// If the list holds notes, 'pool' points back to the pool where it lives.
// Otherwise, that member is NULL.
/* 0x00 */ struct AudioListItem* prev;
/* 0x04 */ struct AudioListItem* next;
/* 0x08 */ union {
/*!0x00 */ struct AudioListItem* prev;
/*!0x04 */ struct AudioListItem* next;
/*!0x08 */ union {
void* value; // either Note* or SequenceChannelLayer*
s32 count;
} u;
/* 0x0C */struct NotePool* pool;
/*!0x0C */ struct NotePool* pool;
} AudioListItem; // size = 0x10
// UNCHANGED
typedef struct NotePool {
AudioListItem disabled;
AudioListItem decaying;
AudioListItem releasing;
AudioListItem active;
/*!0x00 */ AudioListItem disabled;
/*!0x10 */ AudioListItem decaying;
/*!0x20 */ AudioListItem releasing;
/*!0x30 */ AudioListItem active;
} NotePool;
// Pitch sliding by up to one octave in the positive direction. Negative
@ -42,12 +42,11 @@ typedef struct NotePool {
// exterpolates exponentially in the wrong direction in that case, but that
// doesn't prevent seqplayer from doing it, AFAICT.
typedef struct {
u8 mode; // bit 0x80 denotes something; the rest are an index 0-5
f32 cur;
f32 speed;
// f32 extent;
// struct Note *note; // Changed from extent to note? Shortened Struct maybe?
} Portamento; // size = 0x0C
/*!0x00 */ u8 mode; // bit 0x80 denotes something; the rest are an index 0-5
/*!0x02 */ u16 cur;
/*!0x04 */ u16 speed;
/*!0x08 */ f32 extent;
} Portamento; // size = 0xC
typedef struct {
s16 delay;
@ -82,6 +81,7 @@ typedef struct {
f32 tuning; // frequency scale factor
} AudioBankSound; // size = 0x8
// UNCHANGED
typedef struct {
/* 0x00 */ u8 loaded;
/* 0x01 */ u8 normalRangeLo;
@ -91,17 +91,15 @@ typedef struct {
/* 0x08 */ AudioBankSound lowNotesSound;
/* 0x10 */ AudioBankSound normalNotesSound;
/* 0x18 */ AudioBankSound highNotesSound;
} Instrument; // size = 0x20
} Instrument; // size >= 0x20
typedef struct {
u32 drum0;
u32 drum4;
// u8 releaseRate;
// u8 pan;
// u8 loaded;
// AudioBankSound sound;
// AdsrEnvelope *envelope;
} Drum; // OOT size = 0x8, TODO figure out what is still used.
u8 releaseRate;
u8 pan;
u8 loaded;
AudioBankSound sound;
AdsrEnvelope *envelope;
} Drum; // TODO figure out what is still used.
typedef struct {
u32 unk_0;
@ -128,10 +126,12 @@ typedef struct {
typedef struct {
/* 0x000 */ u8 enabled : 1;
/* 0x000 */ u8 finished : 1; // never read
/* 0x000 */ u8 muted : 1;
/*!0x000 */ u8 muted : 1;
/* 0x000 */ u8 seqDmaInProgress : 1;
/* 0x000 */ u8 bankDmaInProgress : 1;
/* 0x000 */ u8 recalculateVolume : 1;
/* 0x000 */ u8 pad_0b2 : 1;
/* 0x000 */ u8 unk_0b1 : 1;
/* 0x001 */ u8 state;
/* 0x002 */ u8 noteAllocPolicy;
/* 0x003 */ u8 muteBehavior;
@ -144,21 +144,23 @@ typedef struct {
/* 0x00A */ u16 tempoAcc;
/* 0x00C */ s16 transposition;
/* 0x00E */ u16 delay;
/* 0x010 */ u16 fadeTimer;
/* 0x012 */ u16 fadeTimerUnkEu;
/* 0x014 */ u8* seqData; // buffer of some sort
/* 0x018 */ f32 fadeVolume; // set to 1.0f
/* 0x01C */ f32 fadeVelocity; // set to 0.0f
/* 0x020 */ f32 volume; // set to 0.0f
/* 0x024 */ f32 muteVolumeScale; // set to 0.5f
/* 0x028 */ f32 fadeVolumeScale;
/* 0x02C */ f32 appliedFadeVolume;
/* 0x030 */ struct SequenceChannel* channels[16];
/* 0x070 */ M64ScriptState scriptState;
/* 0x08C */ u8* shortNoteVelocityTable;
/* 0x090 */ u8* shortNoteDurationTable;
/* 0x094 */ char unk_094[0x8]; // NotePool shifted down 0x8
/* 0x09C */ NotePool notePool;
/* 0x010 */ char pad_010[0x2];
/* 0x012 */ u16 fadeTimer;
/* 0x014 */ u16 fadeTimerUnkEu;
/* 0x016 */ char pad_016[0x2];
/* 0x018 */ u8* seqData;
/*!0x01C */ f32 fadeVolume;
/*!0x020 */ f32 fadeVelocity;
/* 0x024 */ f32 volume;
/*!0x028 */ f32 muteVolumeScale;
/*!0x02C */ f32 fadeVolumeScale;
/*!0x030 */ f32 appliedFadeVolume;
/* 0x034 */ f32 unk_34;
/*!0x038 */ struct SequenceChannel* channels[16];
/* 0x078 */ M64ScriptState scriptState;
/* 0x094 */ u8* shortNoteVelocityTable;
/* 0x098 */ u8* shortNoteDurationTable;
/*!0x09C */ NotePool notePool;
/* 0x0DC */ OSMesgQueue seqDmaMesgQueue;
/* 0x0F4 */ OSMesg seqDmaMesg;
/* 0x0F8 */ OSIoMesg seqDmaIoMesg;
@ -177,35 +179,54 @@ typedef struct {
} AdsrSettings; // size = 0x8
typedef struct {
union {
struct {
/* 0x00 */ u8 bits7 : 1; // pad
/* 0x00 */ u8 bits6 : 1; // pad
/* 0x00 */ u8 bits5 : 1; // pad
/* 0x00 */ u8 bits4 : 1;
/* 0x00 */ u8 bits0 : 4;
} adsrBits;
/* 0x00 */ u8 action; // Must be unionized to zero all bitfields at once.
} adsrAction;
u8 state; // Could be in the upper union in a struct with action.
s16 envIndex; // Could be in the upper union in a struct with action.
s16 delay;
f32 sustain;
f32 velocity;
f32 fadeOutVel;
f32 current;
f32 target;
AdsrEnvelope *envelope;
/*!0x00 */ union {
struct A {
/* 0x00 */ u8 unk_0b80 : 1;
/*!0x00 */ u8 hang : 1;
/*!0x00 */ u8 decay : 1;
/*!0x00 */ u8 release : 1;
/*!0x00 */ u8 state : 4;
} s;
/*!0x00 */ u8 asByte;
} action;
/*!0x01 */ u8 envIndex;
/*!0x02 */ s16 delay;
/*!0x04 */ f32 sustain;
/*!0x08 */ f32 velocity;
/*!0x0C */ f32 fadeOutVel;
/*!0x10 */ f32 current;
/*!0x14 */ f32 target;
/* */ char pad18[4];
/*!0x1C */ AdsrEnvelope *envelope;
} AdsrState;
typedef struct {
/* 0x00 */ s8 reverb;
/* 0x01 */ u8 pan;
/* 0x02 */ char unk_02[0x6];
/* 0x08 */ f32 freqScale;
/* 0x0C */ f32 velocity;
/* 0x10 */ char unk_10[0x8];
} NoteAttributes; // size = 0x1C
u8 bit0 : 1;
u8 bit1 : 1;
u8 bit2 : 2;
u8 strongRight : 1;
u8 strongLeft : 1;
u8 stereoHeadsetEffects : 1;
u8 usesHeadsetPanEffects : 1;
} ReverbBitsData;
typedef union {
/* 0x00 */ ReverbBitsData s;
/* 0x00 */ u8 asByte;
} ReverbBits;
typedef struct {
/*!0x00 */ u8 reverb;
/*!0x01 */ u8 unk_1;
/*!0x02 */ u8 pan;
/*!0x03 */ ReverbBits reverbBits;
/*!0x04 */ u8 unk_4;
/*!0x06 */ u16 unk_6;
/*!0x08 */ f32 freqScale;
/*!0x0C */ f32 velocity;
/*!0x10 */ s16* unk_10;
/*!0x14 */ s16 unk_14[8];
} NoteAttributes; // size = 0x24
typedef struct SequenceChannel {
/* 0x00 */ u8 enabled : 1;
@ -213,58 +234,61 @@ typedef struct SequenceChannel {
/* 0x00 */ u8 stopScript : 1;
/* 0x00 */ u8 stopSomething2 : 1; // sets SequenceChannelLayer.stopSomething
/* 0x00 */ u8 hasInstrument : 1;
/* 0x00 */ u8 stereoHeadsetEffects : 1;
/*!0x00 */ u8 stereoHeadsetEffects : 1;
/* 0x00 */ u8 largeNotes : 1; // notes specify duration and velocity
/* 0x00 */ u8 unused : 1; // never read, set to 0
/* 0x01 */ union {
struct {
u8 freqScale : 1;
u8 volume : 1;
u8 pan : 1;
} asBitfields;
u8 asByte;
} changes;
/* 0x02 */ u8 noteAllocPolicy;
/* 0x03 */ u8 muteBehavior;
/* 0x04 */ u8 reverb; // or dry/wet mix
/* 0x05 */ u8 notePriority; // 0-3
/* 0x06 */ char unk_06[0x1];
/* 0x07 */ u8 bankId;
/* 0x08 */ u8 reverbIndex;
/* 0x09 */ u8 bookOffset;
/* 0x0A */ u8 newPan;
/* 0x0B */ u8 panChannelWeight; // proportion of pan that comes from the channel (0..128)
/* 0x0C */ u16 vibratoRateStart; // initially 0x800
/* 0x0E */ u16 vibratoExtentStart;
/* 0x10 */ u16 vibratoRateTarget; // initially 0x800
/* 0x12 */ u16 vibratoExtentTarget;
/* 0x14 */ u16 vibratoRateChangeDelay;
/* 0x16 */ u16 vibratoExtentChangeDelay;
/* 0x18 */ u16 vibratoDelay;
/* 0x1A */ u16 delay;
/* 0x1C */ f32 volumeScale;
/* 0x20 */ f32 volume;
/* 0x24 */ s16 instOrWave; // either 0 (none), instrument index + 1, or
union {
struct {
/*!0x01 */ u8 freqScale : 1;
/*!0x01 */ u8 volume : 1;
/*!0x01 */ u8 pan : 1;
} s;
/*!0x01 */ u8 asByte;
} changes;
/*!0x02 */ u8 noteAllocPolicy;
/*!0x03 */ u8 muteBehavior;
/*!0x04 */ u8 reverb; // or dry/wet mix
/*!0x05 */ u8 notePriority; // 0-3
/* 0x06 */ u8 someOtherPriority;
/*!0x07 */ u8 bankId;
/*!0x08 */ u8 reverbIndex;
/*!0x09 */ u8 bookOffset;
/*!0x0A */ u8 newPan;
/*!0x0B */ u8 panChannelWeight; // proportion of pan that comes from the channel (0..128)
/* 0x0C */ u8 unk_0C;
/* 0x0D */ u8 padD[2];
/* 0x0F */ u8 unk_0F;
/*!0x10 */ u16 vibratoRateStart;
/*!0x12 */ u16 vibratoExtentStart;
/*!0x14 */ u16 vibratoRateTarget;
/*!0x16 */ u16 vibratoExtentTarget;
/*!0x18 */ u16 vibratoRateChangeDelay;
/*!0x1A */ u16 vibratoExtentChangeDelay;
/*!0x1C */ u16 vibratoDelay;
/* 0x1E */ u16 delay;
/* 0x20 */ u16 unk_20;
/* 0x22 */ u16 pad22;
/*!0x24 */ s16 instOrWave; // either 0 (none), instrument index + 1, or
// 0x80..0x83 for sawtooth/triangle/sine/square waves.
/* 0x26 */ s16 transposition;
/* 0x28 */ s32 pan;
/* 0x2C */ f32 appliedVolume;
/* 0x30 */ f32 freqScale;
/* 0x34 */ u8 (*dynTable)[][2];
/* 0x3C */ char unk_3C[0x8];
/* 0x44 */ struct Note* noteUnused; // never read
/* 0x48 */ struct SequenceChannelLayer* layerUnused; // never read
/* 0x4C */ Instrument* instrument;
/* 0x50 */ SequencePlayer* seqPlayer;
//! Changed this to shift the struct, likely incorrect. (Notice the above pad[2])
/* 0x54 */ struct SequenceChannelLayer* layers[2];
/* 0x5C */ s8 soundScriptIO[8]; // bridge between sound script and audio lib. For player 2,
// [0] contains enabled, [4] contains sound ID, [5] contains reverb adjustment
/*!0x28 */ f32 volumeScale;
/*!0x2C */ f32 volume;
/*!0x30 */ s32 pan;
/*!0x34 */ f32 appliedVolume;
/* 0x38 */ f32 freqScale;
/* 0x3C */ u8 (*dynTable)[][2];
/* 0x40 */ struct Note* noteUnused; // never read
/* 0x44 */ struct SequenceChannelLayer* layerUnused; // never read
/* 0x48 */ Instrument* instrument;
/*!0x4C */ SequencePlayer* seqPlayer;
/*!0x54 */ struct SequenceChannelLayer* layers[4];
/* 0x64 */ M64ScriptState scriptState;
/* */ AdsrSettings adsr;
/* */ NotePool notePool;
/* 0xCC */ struct Note* test;
/* 0xD0 */ char unk_D0[0x4];
/*!0x84 */ NotePool notePool;
/* 0xC4 */ s8 soundScriptIO[8]; // bridge between sound script and audio lib
/* 0xCC */ s16* unk_CC;
/* 0xD0 */ ReverbBits reverbBits;
/* 0xD1 */ char unk_D1[0x3];
} SequenceChannel;
// Maybe SequenceTrack?
@ -274,37 +298,37 @@ typedef struct SequenceChannelLayer {
/* 0x00 */ u8 stopSomething : 1; // ?
/* 0x00 */ u8 continuousNotes : 1; // keep the same note for consecutive notes with the same sound
/* 0x00 */ u8 unusedEu0b8 : 1;
/* 0x00 */ u8 bit2 : 1;
/* 0x00 */ u8 ignoreDrumPan : 1; // (wrong)
/* 0x00 */ u8 notePropertiesNeedInit : 1;
/* 0x00 */ u8 ignoreDrumPan : 1;
/* 0x00 */ u8 bit0 : 1;
/* 0x01 */ char unk_01[0x1];
/*!0x01 */ ReverbBits reverbBits;
/* 0x02 */ u8 instOrWave;
/* 0x03 */ u8 status;
/* 0x04 */ u8 noteDuration; // set to 0x80
/* 0x05 */ u8 portamentoTargetNote;
/* 0x06 */ u8 pan; // 0..128
/* 0x07 */ u8 notePan;
/*!0x06 */ u8 pan; // 0..128
/*!0x07 */ u8 notePan;
/* 0x08 */ u16 portamentoTime;
/* 0x0A */ s16 transposition; // #semitones added to play commands
// (m64 instruction encoding only allows referring to the limited range
// 0..0x3f; this makes 0x40..0x7f accessible as well)
/* 0x0C */ f32 freqScale;
/* 0x10 */ f32 velocitySquare;
/* 0x14 */ f32 noteVelocity;
/* 0x0C */ f32 unk0C;
/* 0x10 */ s16 delay; // (wrong)
/* 0x12 */ s16 duration; // (wrong)
/* 0x14 */ f32 unk14;
/* 0x18 */ AdsrSettings adsr;
/* 0x20 */ Portamento portamento;
/* 0x2C */ struct Note* note;
/* 0x30 */ f32 noteFreqScale;
/*!0x20 */ Portamento portamento;
/*!0x2C */ struct Note* note;
/*!0x30 */ f32 freqScale;
/* 0x34 */ s16 shortNoteDefaultPlayPercentage;
/* 0x36 */ s16 playPercentage; // it's not really a percentage...
/* 0x38 */ s16 delay;
/* 0x3A */ s16 duration;
/*!0x38 */ f32 velocitySquare;
/* 0x3C */ s16 delayUnused; // set to 'delay', never read
/* 0x40 */ f32 unk_40;
/* 0x44 */ char unk_44[0x4];
/*!0x40 */ f32 noteVelocity;
/*!0x44 */ f32 noteFreqScale;
/* 0x48 */ Instrument* instrument;
/* 0x4C */ AudioBankSound* sound;
/* 0x50 */ SequenceChannel* seqChannel;
/*!0x4C */ AudioBankSound* sound;
/*!0x50 */ SequenceChannel* seqChannel;
/* 0x54 */ M64ScriptState scriptState;
/* 0x70 */ AudioListItem listItem;
/* 0x80 */ char unk_80[0x10];
@ -332,97 +356,89 @@ typedef struct {
} NoteSynthesisState;
typedef struct {
/* 0x00 */ struct SequenceChannel* seqChannel;
/* 0x04 */ u32 time;
/* 0x08 */ s16* curve;
/* 0x0C */ f32 extent;
/* 0x10 */ f32 rate;
/* 0x14 */ u8 active;
/* 0x16 */ u16 rateChangeTimer;
/* 0x18 */ u16 extentChangeTimer;
/* 0x1A */ u16 delay;
/*!0x00 */ struct SequenceChannel* seqChannel; // unless this changed to a layer...?
/*!0x04 */ u32 time;
/*!0x08 */ s16* curve;
/*!0x0C */ f32 extent;
/*!0x10 */ f32 rate;
/*!0x14 */ u8 active;
/*!0x16 */ u16 rateChangeTimer;
/*!0x18 */ u16 extentChangeTimer;
/*!0x1A */ u16 delay;
} VibratoState; // size = 0x1C
typedef struct {
/* 0x00 */ u8 priority;
/* 0x01 */ u8 waveId;
/* 0x02 */ u8 sampleCountIndex;
/*!0x00 */ u8 priority;
/*!0x01 */ u8 waveId;
/*!0x02 */ u8 sampleCountIndex;
/* 0x03 */ u8 bankId;
/* 0x04 */ u8 unk_04;
/* 0x05 */ u8 stereoHeadsetEffects;
/* 0x06 */ s16 adsrVolScale;
/* 0x08 */ f32 portamentoFreqScale;
/* 0x0C */ f32 vibratoFreqScale;
/*!0x08 */ f32 portamentoFreqScale;
/*!0x0C */ f32 vibratoFreqScale;
/* 0x10 */ SequenceChannelLayer* prevParentLayer;
/* 0x14 */ SequenceChannelLayer* parentLayer;
/* 0x18 */ SequenceChannelLayer* wantedParentLayer;
/* 0x1C */ NoteAttributes attributes;
/* 0x38 */ char unk_38[0xC];
/* 0x44 */ AdsrState adsr;
// /* 0x4C */ Portamento portamento;
// /* 0x5C */ VibratoState vibratoState;
/*!0x14 */ SequenceChannelLayer* parentLayer;
/*!0x18 */ SequenceChannelLayer* wantedParentLayer;
/*!0x1C */ NoteAttributes attributes;
/*!0x40 */ AdsrState adsr;
// may contain portamento, vibratoState, if those are not part of Note itself
} NotePlaybackState;
typedef struct {
// (This might be a ReverbBits, and asByte might not exist)
union {
struct {
/* 0x00 */ volatile u8 enabled : 1;
/* 0x00 */ u8 needsInit : 1;
/* 0x00 */ u8 finished : 1;
/* 0x00 */ u8 envMixerNeedsInit : 1;
/* 0x00 */ u8 stereoStrongRight : 1;
/* 0x00 */ u8 stereoStrongLeft : 1;
/*!0x00 */ u8 stereoStrongRight : 1;
/*!0x00 */ u8 stereoStrongLeft : 1;
/* 0x00 */ u8 stereoHeadsetEffects : 1;
/* 0x00 */ u8 usesHeadsetPanEffects : 1;
} asBitfields;
u8 asByte;
} s;
/* 0x00 */ u8 asByte;
} bitField0;
union {
struct {
/* 0x01 */ u8 reverbIndex : 3;
/* 0x01 */ u8 bookOffset : 2;
/*!0x01 */ u8 bookOffset : 2;
/* 0x01 */ u8 bit2 : 1;
/* 0x01 */ u8 isSyntheticWave : 1;
/* 0x01 */ u8 hasTwoAdpcmParts : 1;
} asBitfields;
u8 asByte;
} s;
/* 0x01 */ u8 asByte;
} bitField1;
/* 0x02 */ u8 bankId;
/* 0x02 */ u8 unk_2;
/* 0x03 */ u8 headsetPanRight;
/* 0x04 */ u8 headsetPanLeft;
/* 0x05 */ u8 reverbVol;
/* 0x06 */ u8 unk_06; // sound shifted by 4.
/* 0x07 */ u8 unk_07; // sound shifted by 4.
/* 0x08 */ u16 targetVolLeft;
/* 0x0A */ u16 targetVolRight;
/*!0x08 */ u16 targetVolLeft;
/*!0x0A */ u16 targetVolRight;
/* 0x0C */ u16 resamplingRateFixedPoint; // stored as signed but loaded as u16
/* 0x0E */ s16 unk_10;
/* 0x10 */ union {
/*!0x10 */ union {
s16* samples;
AudioBankSound* audioBankSound;
} sound;
/* 0x14 */ u32 unk_14;
/* 0x18 */ char unk_18[0x8];
} NoteSubEu;
/* 0x14 */ s16* unk_14;
/* 0x18 */ char pad_18[0x8];
} NoteSubEu; // size = 0x20
typedef struct Note {
/* 0x00 */ AudioListItem listItem;
/*!0x00 */ AudioListItem listItem;
/* 0x10 */ NoteSynthesisState synthesisState;
/* 0x24 */ char unk_24[0xC];
/* 0x30 */ NotePlaybackState playbackState;
/* 0x90 */ char unk_90[0x2];
/* 0x92 */ u16 unk_92;
/* 0x94 */ u16 unk_94;
/* 0x96 */ char unk_96[0x1A];
/* 0xB0 */ u8 unk_B0;
/* 0xB4 */ char unk_B4[0xB];
/* 0x24 */ char pad_24[0xC];
/*!0x30 */ NotePlaybackState playbackState;
/*!0x90 */ Portamento portamento;
/*!0x9C */ VibratoState vibratoState; // size 0x1C
/* 0xB8 */ char pad_B8[0x4];
/* 0xBC */ u32 unk_BC;
/* 0xC0 */ NoteSubEu noteSubEu;
// Possibly removed? Changed? Likely needs fit within this all here.
// /* 0x74, 0x7C */ Portamento portamento;
// /* 0x84, 0x8C */ VibratoState vibratoState;
} Note;
/*!0xC0 */ NoteSubEu noteSubEu;
} Note; // size = 0xE0
typedef struct {
/* 0x00 */ s16 presetUnk4; // audio frames per vsync?
@ -448,7 +464,9 @@ typedef struct {
} SoundAllocPool;
typedef struct {
/* 0x0000 */ char unk_0000[0x2844];
/* 0x0000 */ char unk_0000[0x14];
/* 0x0014 */ NoteSubEu* gNoteSubsEu;
/* 0x0018 */ char unk_0014[0x282C];
/* 0x2844 */ CtlEntry* gCtlEntries;
/* 0x2848 */ char unk_2848[0x4];
/* 0x284C */ AudioBufferParametersEU gAudioBufferParameters;
@ -460,33 +478,39 @@ typedef struct {
/* 0x29C0 */ SoundAllocPool gNotesAndBuffersPool;
/* 0x29D0 */ char unk_29D0[0x0B5C];
/* 0x352C */ Note* gNotes;
/* 0x3530 */ char unk_3530[0x2654];
/* 0x5B84 */ s32 gNoteSubEuOffset;
} AudioContext;
// These two are similar to NoteSubEu. ReverbBits may be shared in both.
typedef struct {
u8 bit0 : 1;
u8 bit1 : 1;
u8 bit2 : 2;
u8 strongRight : 1;
u8 strongLeft : 1;
u8 stereoHeadsetEffects : 1;
u8 usesHeadsetPanEffects : 1;
} ReverbBits;
typedef struct {
/* 0x00 */ u8 reverb;
/* 0x01 */ u8 bankId;
/* 0x02 */ u8 pan;
/* 0x03 */ ReverbBits reverbBits;
/* 0x04 */ f32 velocity;
/* 0x08 */ f32 unk_8;
/*!0x00 */ u8 reverb; // volume
/* 0x01 */ u8 unk_1;
/*!0x02 */ u8 pan;
/*!0x03 */ ReverbBits reverbBits;
/*!0x04 */ f32 frequency;
/*!0x08 */ f32 velocity;
/* 0x0C */ char unk_0C[0x4];
/* 0x10 */ u32 unk_10;
/* 0x10 */ s16* unk_10;
/* 0x14 */ u8 unk_14;
/* 0x16 */ u16 unk_16;
} Reverb; // size = 0x1C (May be longer)
#define NO_LAYER ((SequenceChannelLayer*)(-1))
#define NO_CHANNEL ((SequenceChannel*)(-1))
#define ADSR_STATE_DISABLED 0
#define ADSR_STATE_INITIAL 1
#define ADSR_STATE_START_LOOP 2
#define ADSR_STATE_LOOP 3
#define ADSR_STATE_FADE 4
#define ADSR_STATE_HANG 5
#define ADSR_STATE_DECAY 6
#define ADSR_STATE_RELEASE 7
#define ADSR_STATE_SUSTAIN 8
#define ADSR_DISABLE 0
#define ADSR_HANG -1
#define ADSR_GOTO -2
#define ADSR_RESTART -3
#endif