diff options
-rw-r--r-- | arm7/lib/include/SND_lfo.h | 2 | ||||
-rw-r--r-- | arm9/lib/NitroSDK/include/SND_bank.h | 50 | ||||
-rw-r--r-- | arm9/lib/NitroSDK/include/SND_main.h | 14 | ||||
-rw-r--r-- | include/nitro/SND_bank_shared.h | 53 | ||||
-rw-r--r-- | include/nitro/SND_exChannel_shared.h | 79 | ||||
-rw-r--r-- | include/nitro/SND_main_shared.h | 176 | ||||
-rw-r--r-- | include/nitro/SND_seq_shared.h | 84 | ||||
-rw-r--r-- | include/nitro/SND_work_shared.h | 4 |
8 files changed, 236 insertions, 226 deletions
diff --git a/arm7/lib/include/SND_lfo.h b/arm7/lib/include/SND_lfo.h index 065e0ed6..05d4647e 100644 --- a/arm7/lib/include/SND_lfo.h +++ b/arm7/lib/include/SND_lfo.h @@ -3,7 +3,7 @@ #include "nitro/types.h" -#include "nitro/SND_main_shared.h" +#include "nitro/SND_exChannel_shared.h" void SND_InitLfoParam(struct SNDLfoParam *lfoParam); void SND_StartLfo(struct SNDLfo *lfo); diff --git a/arm9/lib/NitroSDK/include/SND_bank.h b/arm9/lib/NitroSDK/include/SND_bank.h index 335dae01..58fd8307 100644 --- a/arm9/lib/NitroSDK/include/SND_bank.h +++ b/arm9/lib/NitroSDK/include/SND_bank.h @@ -6,56 +6,6 @@ #include "SND_main.h" #include "nitro/SND_bank_shared.h" -#define SND_INST_ILLEGAL 0 -#define SND_INST_PCM 1 -#define SND_INST_PSG 2 -#define SND_INST_NOISE 3 -#define SND_INST_DIRECTPCM 4 -#define SND_INST_DUMMY 5 -#define SND_INST_DRUM_TABLE 16 -#define SND_INST_KEY_SPLIT 17 - -#define SND_BANK_MAX_WAVEARC 4 - -#define SND_INST_OFFSET_TYPE(off) ((u8)off) -#define SND_INST_OFFSET_NORMAL(bank, off) ((struct SNDInstParam *)((u8 *)bank + (u32)(off >> 8))) -#define SND_INST_OFFSET_DRUMS(bank, off) ((struct SNDDrumSet *)((u8 *)bank + (u32)(off >> 8))) -#define SND_INST_OFFSET_KEYSPL(bank, off) ((struct SNDKeySplit *)((u8 *)bank + (u32)(off >> 8))) - -struct SNDWaveArc; - -struct SNDWaveArcLink { - struct SNDWaveArc *waveArc; // 0x0 - struct SNDWaveArcLink *waveArcLLnext; // 0x4 -}; // size = 0x8 - -struct SNDBankData { - struct SNDBinaryFileHeader fileHeader; // 0x00 - struct SNDBinaryBlockHeader blockHeader; // 0x10 - struct SNDWaveArcLink waveArcLinks[SND_BANK_MAX_WAVEARC]; // 0x18 - u32 instCount; // 0x38 - u32 instOffsets[]; // 0x3C -}; // size = 0x40 - -struct SNDWaveArc { - struct SNDBinaryFileHeader fileHeader; // 0x00 - struct SNDBinaryBlockHeader blockHeader; // 0x10 - struct SNDWaveArcLink *waveArcLLHead; // 0x18 - u8 unk_1C[28]; // 0x1C - u32 waveCount; // 0x38 - u32 waveOffsets[]; // 0x3C -}; // size = 0x3C - -struct SNDInstPos { - u32 program; // 0x0 - u32 index; // 0x4 -}; // size = 0x8 - -struct SNDWaveData { - struct SNDWaveParam param; // 0x0 - u8 sampleData[]; // 0xC -}; // size = 0xC - void SND_AssignWaveArc(struct SNDBankData *bankData, s32 index, struct SNDWaveArc *waveArc); void SND_DestroyBank(struct SNDBankData *bankData); void SND_DestroyWaveArc(struct SNDWaveArc *waveArc); diff --git a/arm9/lib/NitroSDK/include/SND_main.h b/arm9/lib/NitroSDK/include/SND_main.h index 8fa9364e..aa476bae 100644 --- a/arm9/lib/NitroSDK/include/SND_main.h +++ b/arm9/lib/NitroSDK/include/SND_main.h @@ -9,18 +9,4 @@ void SNDi_UnlockMutex(void); void SNDi_LockMutex(void); void SND_Init(void); -struct SNDBinaryFileHeader { - s8 signature[4]; // 0x0 - u16 byteOrder; // 0x4 - u16 version; // 0x6 - u32 fileSize; // 0x8 - u16 headerSize; // 0xC - u16 dataBlocks; // 0xE -}; // size = 0x10 - -typedef struct SNDBinaryBlockHeader { - u32 type; // 0x0 - u32 size; // 0x4 -} SNDBinaryBlockHeader; // size = 0x8 - #endif // GUARD_SND_MAIN_H diff --git a/include/nitro/SND_bank_shared.h b/include/nitro/SND_bank_shared.h index 58b1fd8f..f5292bcc 100644 --- a/include/nitro/SND_bank_shared.h +++ b/include/nitro/SND_bank_shared.h @@ -3,8 +3,27 @@ #include "nitro/types.h" +#include "nitro/SND_exChannel_shared.h" +#include "nitro/SND_main_shared.h" + #define SND_INST_MAX_KEYSPLIT 8 +#define SND_INST_ILLEGAL 0 +#define SND_INST_PCM 1 +#define SND_INST_PSG 2 +#define SND_INST_NOISE 3 +#define SND_INST_DIRECTPCM 4 +#define SND_INST_DUMMY 5 +#define SND_INST_DRUM_TABLE 16 +#define SND_INST_KEY_SPLIT 17 + +#define SND_BANK_MAX_WAVEARC 4 + +#define SND_INST_OFFSET_TYPE(off) ((u8)off) +#define SND_INST_OFFSET_NORMAL(bank, off) ((struct SNDInstParam *)((u8 *)bank + (u32)(off >> 8))) +#define SND_INST_OFFSET_DRUMS(bank, off) ((struct SNDDrumSet *)((u8 *)bank + (u32)(off >> 8))) +#define SND_INST_OFFSET_KEYSPL(bank, off) ((struct SNDKeySplit *)((u8 *)bank + (u32)(off >> 8))) + struct SNDInstParam { u16 wave[2]; // 0x0 u8 rootKey; // 0x4 @@ -32,4 +51,38 @@ struct SNDDrumSet { struct SNDInstData instruments[]; }; // size = 0x2 +struct SNDWaveArc; + +struct SNDWaveArcLink { + struct SNDWaveArc *waveArc; // 0x0 + struct SNDWaveArcLink *waveArcLLnext; // 0x4 +}; // size = 0x8 + +struct SNDBankData { + struct SNDBinaryFileHeader fileHeader; // 0x00 + struct SNDBinaryBlockHeader blockHeader; // 0x10 + struct SNDWaveArcLink waveArcLinks[SND_BANK_MAX_WAVEARC]; // 0x18 + u32 instCount; // 0x38 + u32 instOffsets[]; // 0x3C +}; // size = 0x40 + +struct SNDWaveArc { + struct SNDBinaryFileHeader fileHeader; // 0x00 + struct SNDBinaryBlockHeader blockHeader; // 0x10 + struct SNDWaveArcLink *waveArcLLHead; // 0x18 + u8 unk_1C[28]; // 0x1C + u32 waveCount; // 0x38 + u32 waveOffsets[]; // 0x3C +}; // size = 0x3C + +struct SNDInstPos { + u32 program; // 0x0 + u32 index; // 0x4 +}; // size = 0x8 + +struct SNDWaveData { + struct SNDWaveParam param; // 0x0 + u8 sampleData[]; // 0xC +}; // size = 0xC + #endif //GUARD_SND_BANK_SHARED_H diff --git a/include/nitro/SND_exChannel_shared.h b/include/nitro/SND_exChannel_shared.h index eb702f16..386e6ac8 100644 --- a/include/nitro/SND_exChannel_shared.h +++ b/include/nitro/SND_exChannel_shared.h @@ -22,4 +22,83 @@ #define SND_LFO_VOLUME 1 #define SND_LFO_PAN 2 +struct SNDWaveParam { + u8 format; // 0x0 + u8 loopEnabled; // 0x1 + u16 samplerate; // 0x2 + u16 timer; // 0x4 + u16 loopStart; // 0x6 + u32 loopLength; // 0x8 +}; // size = 0xC + +struct SNDLfoParam { + u8 target; // 0x0 + u8 speed; // 0x1 + u8 depth; // 0x2 + u8 range; // 0x3 + u16 delay; // 0x4 +}; // size = 0x6 + +struct SNDLfo { + struct SNDLfoParam param; // 0x0 + u16 delayCounter; // 0x6 + u16 counter; // 0x8 +}; // size = 0xA + +struct SNDExChannel { + u8 id; // 0x00 + u8 type; // 0x01 + u8 envStatus; // 0x02 + + struct { + u8 active : 1; + u8 start : 1; + u8 autoSweep : 1; + u8 syncFlag : 5; + } flags; // 0x03 + + u8 panRange; // 0x04 + u8 rootMidiKey; // 0x05 + s16 userDecay2; // 0x06 + + u8 midiKey; // 0x08 + u8 velocity; // 0x09 + s8 initPan; // 0x0A + s8 userPan; // 0x0B + + s16 userDecay; // 0x0C + s16 userPitch; // 0x0E + + s32 envAttenuation; // 0x10 + s32 sweepCounter; // 0x14 + s32 sweepLength; // 0x18 + + u8 envAttack; // 0x1C + u8 envSustain; // 0x1D + u16 envDecay; // 0x1E + u16 envRelease; // 0x20 + u8 priority; // 0x22 + u8 pan; // 0x23 + u16 volume; // 0x24 + u16 timer; // 0x26 + + struct SNDLfo lfo; // 0x28 + + s16 sweepPitch; // 0x32 + + s32 length; // 0x34 + + struct SNDWaveParam waveParam; // 0x38 + + union { + const void *waveDataPtr; + s32 dutyCycle; + }; // 0x44 + + void (*callback)(struct SNDExChannel *chn, u32 status, void *userData); // 0x48 + void *callbackUserData; // 0x4C + + struct SNDExChannel *channelLLNext; // 0x50 +}; // size = 0x54 + #endif //GUARD_SND_EXCHANNEL_SHARED_H diff --git a/include/nitro/SND_main_shared.h b/include/nitro/SND_main_shared.h index 154d93b6..9b238245 100644 --- a/include/nitro/SND_main_shared.h +++ b/include/nitro/SND_main_shared.h @@ -13,164 +13,20 @@ #ifndef POKEDIAMOND_SND_MAIN_SHARED_H #define POKEDIAMOND_SND_MAIN_SHARED_H -struct SNDWaveParam { - u8 format; // 0x0 - u8 loopEnabled; // 0x1 - u16 samplerate; // 0x2 - u16 timer; // 0x4 - u16 loopStart; // 0x6 - u32 loopLength; // 0x8 -}; // size = 0xC - -struct SNDLfoParam { - u8 target; // 0x0 - u8 speed; // 0x1 - u8 depth; // 0x2 - u8 range; // 0x3 - u16 delay; // 0x4 -}; // size = 0x6 - -struct SNDLfo { - struct SNDLfoParam param; // 0x0 - u16 delayCounter; // 0x6 - u16 counter; // 0x8 -}; // size = 0xA - -struct SNDExChannel { - u8 id; // 0x00 - u8 type; // 0x01 - u8 envStatus; // 0x02 - - struct { - u8 active : 1; - u8 start : 1; - u8 autoSweep : 1; - u8 syncFlag : 5; - } flags; // 0x03 - - u8 panRange; // 0x04 - u8 rootMidiKey; // 0x05 - s16 userDecay2; // 0x06 - - u8 midiKey; // 0x08 - u8 velocity; // 0x09 - s8 initPan; // 0x0A - s8 userPan; // 0x0B - - s16 userDecay; // 0x0C - s16 userPitch; // 0x0E - - s32 envAttenuation; // 0x10 - s32 sweepCounter; // 0x14 - s32 sweepLength; // 0x18 - - u8 envAttack; // 0x1C - u8 envSustain; // 0x1D - u16 envDecay; // 0x1E - u16 envRelease; // 0x20 - u8 priority; // 0x22 - u8 pan; // 0x23 - u16 volume; // 0x24 - u16 timer; // 0x26 - - struct SNDLfo lfo; // 0x28 - - s16 sweepPitch; // 0x32 - - s32 length; // 0x34 - - struct SNDWaveParam waveParam; // 0x38 - - union { - const void *waveDataPtr; - s32 dutyCycle; - }; // 0x44 - - void (*callback)(struct SNDExChannel *chn, u32 status, void *userData); // 0x48 - void *callbackUserData; // 0x4C - - struct SNDExChannel *channelLLNext; // 0x50 -}; // size = 0x54 - -#define SND_TRACK_COUNT_PER_PLAYER 16 -#define SND_INVALID_TRACK_INDEX 0xFF - -struct SNDBankData; - -struct SNDPlayer { - struct { - u8 active : 1; - u8 prepared : 1; - u8 paused : 1; - } flags; // 0x0 - - u8 playerId; // 0x1 - u8 unk_2[2]; // 0x2 - - u8 prio; // 0x4 - u8 volume; // 0x5 - s16 extFader; // 0x6 - - u8 tracks[SND_TRACK_COUNT_PER_PLAYER]; // 0x8 - - u16 tempo; // 0x18 - u16 tempoRatio; // 0x1A - u16 tempoCounter; // 0x1C - u8 unk_1E[2]; // 0x1E - - struct SNDBankData *bank; // 0x20 -}; // size = 0x24 - -#define SND_TRACK_MAX_CALL 3 - -struct SNDTrack { - struct { - u8 active : 1; - u8 noteWait : 1; - u8 muted : 1; - u8 tie : 1; - u8 noteFinishWait : 1; - u8 portamento : 1; - u8 cmp : 1; // ??? - u8 channelMask : 1; - } flags; // 0x00 - - u8 panRange; // 0x01 - u16 program; // 0x02 - - u8 volume; // 0x04 - u8 expression; // 0x05 - s8 pitchBend; // 0x06 - u8 bendRange; // 0x07 - - s8 pan; // 0x08 - s8 extPan; // 0x09 - s16 extFader; // 0x0A - s16 extPitch; // 0x0C - u8 envAttack; // 0x0E - u8 envDecay; // 0x0F - u8 envSustain; // 0x10 - u8 envRelease; // 0x11 - u8 priority; // 0x12 - s8 transpose; // 0x13 - - u8 portamentoKey; // 0x14 - u8 portamentoTime; // 0x15 - s16 sweepPitch; // 0x16 - - struct SNDLfoParam mod; // 0x18 - u16 channelMask; // 0x1E - - s32 wait; // 0x20 - - const u8 *trackDataStart; // 0x24 - const u8 *trackDataPos; // 0x28 - const u8 *posCallStack[SND_TRACK_MAX_CALL]; // 0x34 - u8 loopCount[SND_TRACK_MAX_CALL]; // 0x38 - u8 callStackDepth; // 0x3B - - struct SNDExChannel *channelLLHead; // 0x3C -}; // size = 0x40 - - #endif //POKEDIAMOND_SND_MAIN_SHARED_H +#include "nitro/types.h" + +struct SNDBinaryFileHeader { + s8 signature[4]; // 0x0 + u16 byteOrder; // 0x4 + u16 version; // 0x6 + u32 fileSize; // 0x8 + u16 headerSize; // 0xC + u16 dataBlocks; // 0xE +}; // size = 0x10 + +typedef struct SNDBinaryBlockHeader { + u32 type; // 0x0 + u32 size; // 0x4 +} SNDBinaryBlockHeader; // size = 0x8 +#endif //POKEDIAMOND_SND_MAIN_SHARED_H diff --git a/include/nitro/SND_seq_shared.h b/include/nitro/SND_seq_shared.h new file mode 100644 index 00000000..6ff6189c --- /dev/null +++ b/include/nitro/SND_seq_shared.h @@ -0,0 +1,84 @@ +#ifndef GUARD_SND_SEQ_SHARED_H +#define GUARD_SND_SEQ_SHARED_H + +#define SND_TRACK_COUNT_PER_PLAYER 16 +#define SND_INVALID_TRACK_INDEX 0xFF + +struct SNDBankData; + +struct SNDPlayer { + struct { + u8 active : 1; + u8 prepared : 1; + u8 paused : 1; + } flags; // 0x0 + + u8 playerId; // 0x1 + u8 unk_2[2]; // 0x2 + + u8 prio; // 0x4 + u8 volume; // 0x5 + s16 extFader; // 0x6 + + u8 tracks[SND_TRACK_COUNT_PER_PLAYER]; // 0x8 + + u16 tempo; // 0x18 + u16 tempoRatio; // 0x1A + u16 tempoCounter; // 0x1C + u8 unk_1E[2]; // 0x1E + + struct SNDBankData *bank; // 0x20 +}; // size = 0x24 + +#define SND_TRACK_MAX_CALL 3 + +struct SNDTrack { + struct { + u8 active : 1; + u8 noteWait : 1; + u8 muted : 1; + u8 tie : 1; + u8 noteFinishWait : 1; + u8 portamento : 1; + u8 cmp : 1; // ??? + u8 channelMask : 1; + } flags; // 0x00 + + u8 panRange; // 0x01 + u16 program; // 0x02 + + u8 volume; // 0x04 + u8 expression; // 0x05 + s8 pitchBend; // 0x06 + u8 bendRange; // 0x07 + + s8 pan; // 0x08 + s8 extPan; // 0x09 + s16 extFader; // 0x0A + s16 extPitch; // 0x0C + u8 envAttack; // 0x0E + u8 envDecay; // 0x0F + u8 envSustain; // 0x10 + u8 envRelease; // 0x11 + u8 priority; // 0x12 + s8 transpose; // 0x13 + + u8 portamentoKey; // 0x14 + u8 portamentoTime; // 0x15 + s16 sweepPitch; // 0x16 + + struct SNDLfoParam mod; // 0x18 + u16 channelMask; // 0x1E + + s32 wait; // 0x20 + + const u8 *trackDataStart; // 0x24 + const u8 *trackDataPos; // 0x28 + const u8 *posCallStack[SND_TRACK_MAX_CALL]; // 0x34 + u8 loopCount[SND_TRACK_MAX_CALL]; // 0x38 + u8 callStackDepth; // 0x3B + + struct SNDExChannel *channelLLHead; // 0x3C +}; // size = 0x40 + +#endif //GUARD_SND_SEQ_SHARED_H diff --git a/include/nitro/SND_work_shared.h b/include/nitro/SND_work_shared.h index 0de3981e..08eda013 100644 --- a/include/nitro/SND_work_shared.h +++ b/include/nitro/SND_work_shared.h @@ -13,8 +13,10 @@ #ifndef POKEDIAMOND_SND_WORK_SHARED_H #define POKEDIAMOND_SND_WORK_SHARED_H -#include "nitro/SND_alarm_shared.h" #include "nitro/SND_main_shared.h" +#include "nitro/SND_alarm_shared.h" +#include "nitro/SND_bank_shared.h" +#include "nitro/SND_seq_shared.h" #define SND_PLAYER_COUNT 16 #define SND_CHANNEL_COUNT 16 |