refresh 6

This commit is contained in:
n64
2020-02-03 00:51:26 -05:00
parent 9273f38df1
commit 9a801cb96d
236 changed files with 17101 additions and 4820 deletions

View File

@@ -4,6 +4,40 @@
#include "data.h"
#include "effects.h"
extern struct OSMesgQueue *OSMesgQueue0;
extern struct OSMesgQueue *OSMesgQueue1;
extern struct OSMesgQueue *OSMesgQueue2;
extern struct OSMesgQueue *OSMesgQueue3;
#ifdef VERSION_EU
struct ReverbSettingsEU sReverbSettings[] = {
{ 0x04, 0x0c, 0x2fff },
{ 0x04, 0x0a, 0x47ff },
{ 0x04, 0x10, 0x2fff },
{ 0x04, 0x0e, 0x3fff },
{ 0x04, 0x0c, 0x4fff },
{ 0x04, 0x0a, 0x37ff }
};
struct AudioSessionSettingsEU gAudioSessionPresets[] = {
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[2], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[3], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[4], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00004000, 0x00006e00,
0x00003f00, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00004100, 0x00006e00,
0x00004400, 0x00002a80 },
{ 0x00007d00, 0x01, 0x14, 0x01, 0x00, &sReverbSettings[5], 0x7fff, 0x0000, 0x00003500, 0x00006280,
0x00004000, 0x00001b00 }
};
#endif
// Format:
// - frequency
// - max number of simultaneous notes
@@ -15,6 +49,7 @@
// - memory used for persistent banks
// - memory used for temporary sequences
// - memory used for temporary banks
#ifndef VERSION_EU
struct AudioSessionSettings gAudioSessionPresets[18] = {
#ifdef VERSION_JP
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
@@ -46,8 +81,9 @@ struct AudioSessionSettings gAudioSessionPresets[18] = {
{ 32000, 8, 1, 0x0800, 0x2FFF, 0x7FFF, 0x2500, 0x5500, 0x7400, 0x2400 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
#endif
// gAudioCosineTable[k] = round((2**15 - 1) * cos(pi/2 * k / 127)). Unused.
#ifndef VERSION_EU
u16 gAudioCosineTable[128] = {
0x7FFF, 32764, 32757, 32744, 32727, 32704, 32677, 32644, 32607, 32564, 32517, 32464, 32407,
32344, 32277, 32205, 32127, 32045, 31958, 31866, 31770, 31668, 31561, 31450, 31334, 31213,
@@ -60,11 +96,17 @@ u16 gAudioCosineTable[128] = {
9196, 8806, 8415, 8023, 7630, 7235, 6839, 6442, 6044, 5646, 5246, 4845, 4444,
4042, 3640, 3237, 2833, 2429, 2025, 1620, 1216, 810, 405, 0,
};
#endif
// Transforms a pitch scale factor in -127..127 into a frequency scale factor
// between -1 and +1 octave.
// gPitchBendFrequencyScale[k] = 0.5 * 2^(k/127)
#ifdef VERSION_EU
f32 gPitchBendFrequencyScale[256] = {
0.5f,
#else
f32 gPitchBendFrequencyScale[255] = {
#endif
0.5f, 0.502736f, 0.505488f, 0.508254f, 0.511036f, 0.513833f, 0.516645f, 0.519472f, 0.522315f,
0.525174f, 0.528048f, 0.530938f, 0.533843f, 0.536765f, 0.539702f, 0.542656f, 0.545626f, 0.548612f,
0.551614f, 0.554633f, 0.557669f, 0.560721f, 0.563789f, 0.566875f, 0.569977f, 0.573097f, 0.576233f,
@@ -127,15 +169,176 @@ u8 gDefaultShortNoteDurationTable[16] = {
229, 203, 177, 151, 139, 126, 113, 100, 87, 74, 61, 48, 36, 23, 10, 0,
};
#ifndef VERSION_EU
// gVibratoCurve[k] = k*8
s8 gVibratoCurve[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 };
#endif
struct AdsrEnvelope gDefaultEnvelope[] = {
{ BSWAP16(4), BSWAP16(32000) }, // go from 0 to 32000 over the course of 16ms
{ BSWAP16(1000), BSWAP16(32000) }, // stay there for 4.16 seconds
{ BSWAP16(ADSR_HANG), 0 } // then continue staying there
{ BSWAP16(ADSR_HANG), 0 } // then continue staying there
};
#ifdef VERSION_EU
struct NoteSubEu gZeroNoteSub = { 0 };
struct NoteSubEu gDefaultNoteSub = { 1, 1 };
s16 sSawtoothWaves[256] = {
0, 1023, 2047, 3071, 4095, 5119, 6143, 7167, 8191, 9215, 10239,
11263, 0x2FFF, 13311, 0x37FF, 15359, 0x3FFF, 17407, 0x47FF, 19455, 0x4FFF, 21503,
22527, 23551, 24575, 25599, 26623, 27647, 28671, 29695, 30719, 31743, -0x7FFF,
-31743, -30719, -29695, -28671, -27647, -26623, -25599, -24575, -23551, -22527, -21503,
-0x4FFF, -19455, -0x47FF, -17407, -0x3FFF, -15359, -0x37FF, -13311, -0x2FFF, -11263, -10239,
-9215, -8191, -7167, -6143, -5119, -4095, -3071, -2047, -1023,
0, 0x7FF, 0xFFF, 0x17FF, 0x1FFF, 0x27FF, 0x2FFF, 0x37FF, 0x3FFF, 0x47FF, 0x4FFF,
0x57FF, 0x5FFF, 0x67FF, 0x6FFF, 0x77FF, 0x8001, 0x8801, 0x9001, 0x9801, 0xa001, 0xa801,
0xb001, 0xb801, 0xc001, 0xc801, 0xd001, 0xd801, 0xe001, 0xe801, 0xf001, 0xf801, 0x0000,
0x07ff, 0x0fff, 0x17ff, 0x1fff, 0x27ff, 0x2fff, 0x37ff, 0x3fff, 0x47ff, 0x4fff, 0x57ff,
0x5fff, 0x67ff, 0x6fff, 0x77ff, 0x8001, 0x8801, 0x9001, 0x9801, 0xa001, 0xa801, 0xb001,
0xb801, 0xc001, 0xc801, 0xd001, 0xd801, 0xe001, 0xe801, 0xf001, 0xf801,
0x0000, 0x0fff, 0x1fff, 0x2fff, 0x3fff, 0x4fff, 0x5fff, 0x6fff,
0x8001, 0x9001, 0xa001, 0xb001, 0xc001, 0xd001, 0xe001, 0xf001,
0x0000, 0x0fff, 0x1fff, 0x2fff, 0x3fff, 0x4fff, 0x5fff, 0x6fff,
0x8001, 0x9001, 0xa001, 0xb001, 0xc001, 0xd001, 0xe001, 0xf001,
0x0000, 0x0fff, 0x1fff, 0x2fff, 0x3fff, 0x4fff, 0x5fff, 0x6fff,
0x8001, 0x9001, 0xa001, 0xb001, 0xc001, 0xd001, 0xe001, 0xf001,
0x0000, 0x0fff, 0x1fff, 0x2fff, 0x3fff, 0x4fff, 0x5fff, 0x6fff,
0x8001, 0x9001, 0xa001, 0xb001, 0xc001, 0xd001, 0xe001, 0xf001,
0x0000, 0x1fff, 0x3fff, 0x5fff, 0x8001, 0xa001, 0xc001, 0xe001,
0x0000, 0x1fff, 0x3fff, 0x5fff, 0x8001, 0xa001, 0xc001, 0xe001,
0x0000, 0x1fff, 0x3fff, 0x5fff, 0x8001, 0xa001, 0xc001, 0xe001,
0x0000, 0x1fff, 0x3fff, 0x5fff, 0x8001, 0xa001, 0xc001, 0xe001,
0x0000, 0x1fff, 0x3fff, 0x5fff, 0x8001, 0xa001, 0xc001, 0xe001,
0x0000, 0x1fff, 0x3fff, 0x5fff, 0x8001, 0xa001, 0xc001, 0xe001,
0x0000, 0x1fff, 0x3fff, 0x5fff, 0x8001, 0xa001, 0xc001, 0xe001,
0x0000, 0x1fff, 0x3fff, 0x5fff, 0x8001, 0xa001, 0xc001, 0xe001
};
s16 sTriangleWaves[256] = {
0x0000, 0x07ff, 0x0fff, 0x17ff, 0x1fff, 0x27ff, 0x2fff, 0x37ff, 0x3fff, 0x47ff, 0x4fff, 0x57ff,
0x5fff, 0x67ff, 0x6fff, 0x77ff, 0x7fff, 0x77ff, 0x6fff, 0x67ff, 0x5fff, 0x57ff, 0x4fff, 0x47ff,
0x3fff, 0x37ff, 0x2fff, 0x27ff, 0x1fff, 0x17ff, 0x0fff, 0x07ff, 0x0000, 0xf801, 0xf001, 0xe801,
0xe001, 0xd801, 0xd001, 0xc801, 0xc001, 0xb801, 0xb001, 0xa801, 0xa001, 0x9801, 0x9001, 0x8801,
0x8001, 0x8801, 0x9001, 0x9801, 0xa001, 0xa801, 0xb001, 0xb801, 0xc001, 0xc801, 0xd001, 0xd801,
0xe001, 0xe801, 0xf001, 0xf801, 0x0000, 0x0fff, 0x1fff, 0x2fff, 0x3fff, 0x4fff, 0x5fff, 0x6fff,
0x7fff, 0x6fff, 0x5fff, 0x4fff, 0x3fff, 0x2fff, 0x1fff, 0x0fff, 0x0000, 0xf001, 0xe001, 0xd001,
0xc001, 0xb001, 0xa001, 0x9001, 0x8001, 0x9001, 0xa001, 0xb001, 0xc001, 0xd001, 0xe001, 0xf001,
0x0000, 0x0fff, 0x1fff, 0x2fff, 0x3fff, 0x4fff, 0x5fff, 0x6fff, 0x7fff, 0x6fff, 0x5fff, 0x4fff,
0x3fff, 0x2fff, 0x1fff, 0x0fff, 0x0000, 0xf001, 0xe001, 0xd001, 0xc001, 0xb001, 0xa001, 0x9001,
0x8001, 0x9001, 0xa001, 0xb001, 0xc001, 0xd001, 0xe001, 0xf001, 0x0000, 0x1fff, 0x3fff, 0x5fff,
0x7fff, 0x5fff, 0x3fff, 0x1fff, 0x0000, 0xe001, 0xc001, 0xa001, 0x8001, 0xa001, 0xc001, 0xe001,
0x0000, 0x1fff, 0x3fff, 0x5fff, 0x7fff, 0x5fff, 0x3fff, 0x1fff, 0x0000, 0xe001, 0xc001, 0xa001,
0x8001, 0xa001, 0xc001, 0xe001, 0x0000, 0x1fff, 0x3fff, 0x5fff, 0x7fff, 0x5fff, 0x3fff, 0x1fff,
0x0000, 0xe001, 0xc001, 0xa001, 0x8001, 0xa001, 0xc001, 0xe001, 0x0000, 0x1fff, 0x3fff, 0x5fff,
0x7fff, 0x5fff, 0x3fff, 0x1fff, 0x0000, 0xe001, 0xc001, 0xa001, 0x8001, 0xa001, 0xc001, 0xe001,
0x0000, 0x3fff, 0x7fff, 0x3fff, 0x0000, 0xc001, 0x8001, 0xc001, 0x0000, 0x3fff, 0x7fff, 0x3fff,
0x0000, 0xc001, 0x8001, 0xc001, 0x0000, 0x3fff, 0x7fff, 0x3fff, 0x0000, 0xc001, 0x8001, 0xc001,
0x0000, 0x3fff, 0x7fff, 0x3fff, 0x0000, 0xc001, 0x8001, 0xc001, 0x0000, 0x3fff, 0x7fff, 0x3fff,
0x0000, 0xc001, 0x8001, 0xc001, 0x0000, 0x3fff, 0x7fff, 0x3fff, 0x0000, 0xc001, 0x8001, 0xc001,
0x0000, 0x3fff, 0x7fff, 0x3fff, 0x0000, 0xc001, 0x8001, 0xc001, 0x0000, 0x3fff, 0x7fff, 0x3fff,
0x0000, 0xc001, 0x8001, 0xc001,
};
s16 sSineWaves[256] = {
0x0000, 0x0c8b, 0x18f8, 0x2527, 0x30fb, 0x3c56, 0x471c, 0x5133, 0x5a81, 0x62f1, 0x6a6c, 0x70e1,
0x7640, 0x7a7c, 0x7d89, 0x7f61, 0x7fff, 0x7f61, 0x7d89, 0x7a7c, 0x7640, 0x70e1, 0x6a6c, 0x62f1,
0x5a81, 0x5133, 0x471c, 0x3c56, 0x30fb, 0x2527, 0x18f8, 0x0c8b, 0x0000, 0xf375, 0xe708, 0xdad9,
0xcf05, 0xc3aa, 0xb8e4, 0xaecd, 0xa57f, 0x9d0f, 0x9594, 0x8f1f, 0x89c0, 0x8584, 0x8277, 0x809f,
0x8001, 0x809f, 0x8277, 0x8584, 0x89c0, 0x8f1f, 0x9594, 0x9d0f, 0xa57f, 0xaecd, 0xb8e4, 0xc3aa,
0xcf05, 0xdad9, 0xe708, 0xf375, 0x0000, 0x18f8, 0x30fb, 0x471c, 0x5a81, 0x6a6c, 0x7640, 0x7d89,
0x7fff, 0x7d89, 0x7640, 0x6a6c, 0x5a81, 0x471c, 0x30fb, 0x18f8, 0x0000, 0xe708, 0xcf05, 0xb8e4,
0xa57f, 0x9594, 0x89c0, 0x8277, 0x8001, 0x8277, 0x89c0, 0x9594, 0xa57f, 0xb8e4, 0xcf05, 0xe708,
0x0000, 0x18f8, 0x30fb, 0x471c, 0x5a81, 0x6a6c, 0x7640, 0x7d89, 0x7fff, 0x7d89, 0x7640, 0x6a6c,
0x5a81, 0x471c, 0x30fb, 0x18f8, 0x0000, 0xe708, 0xcf05, 0xb8e4, 0xa57f, 0x9594, 0x89c0, 0x8277,
0x8001, 0x8277, 0x89c0, 0x9594, 0xa57f, 0xb8e4, 0xcf05, 0xe708, 0x0000, 0x30fb, 0x5a81, 0x7640,
0x7fff, 0x7640, 0x5a81, 0x30fb, 0x0000, 0xcf05, 0xa57f, 0x89c0, 0x8001, 0x89c0, 0xa57f, 0xcf05,
0x0000, 0x30fb, 0x5a81, 0x7640, 0x7fff, 0x7640, 0x5a81, 0x30fb, 0x0000, 0xcf05, 0xa57f, 0x89c0,
0x8001, 0x89c0, 0xa57f, 0xcf05, 0x0000, 0x30fb, 0x5a81, 0x7640, 0x7fff, 0x7640, 0x5a81, 0x30fb,
0x0000, 0xcf05, 0xa57f, 0x89c0, 0x8001, 0x89c0, 0xa57f, 0xcf05, 0x0000, 0x30fb, 0x5a81, 0x7640,
0x7fff, 0x7640, 0x5a81, 0x30fb, 0x0000, 0xcf05, 0xa57f, 0x89c0, 0x8001, 0x89c0, 0xa57f, 0xcf05,
0x0000, 0x5a81, 0x7fff, 0x5a81, 0x0000, 0xa57f, 0x8001, 0xa57f, 0x0000, 0x5a81, 0x7fff, 0x5a81,
0x0000, 0xa57f, 0x8001, 0xa57f, 0x0000, 0x5a81, 0x7fff, 0x5a81, 0x0000, 0xa57f, 0x8001, 0xa57f,
0x0000, 0x5a81, 0x7fff, 0x5a81, 0x0000, 0xa57f, 0x8001, 0xa57f, 0x0000, 0x5a81, 0x7fff, 0x5a81,
0x0000, 0xa57f, 0x8001, 0xa57f, 0x0000, 0x5a81, 0x7fff, 0x5a81, 0x0000, 0xa57f, 0x8001, 0xa57f,
0x0000, 0x5a81, 0x7fff, 0x5a81, 0x0000, 0xa57f, 0x8001, 0xa57f, 0x0000, 0x5a81, 0x7fff, 0x5a81,
0x0000, 0xa57f, 0x8001, 0xa57f,
};
s16 sSquareWaves[256] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff,
0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001,
0x8001, 0x8001, 0x8001, 0x8001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7fff, 0x7fff, 0x7fff, 0x7fff,
0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x8001, 0x0000, 0x0000, 0x0000, 0x0000,
0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x8001, 0x8001, 0x8001, 0x8001,
0x0000, 0x0000, 0x0000, 0x0000, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000,
0x8001, 0x8001, 0x8001, 0x8001, 0x0000, 0x0000, 0x0000, 0x0000, 0x7fff, 0x7fff, 0x7fff, 0x7fff,
0x0000, 0x0000, 0x0000, 0x0000, 0x8001, 0x8001, 0x8001, 0x8001, 0x0000, 0x0000, 0x0000, 0x0000,
0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x8001, 0x8001, 0x8001, 0x8001,
0x0000, 0x0000, 0x7fff, 0x7fff, 0x0000, 0x0000, 0x8001, 0x8001, 0x0000, 0x0000, 0x7fff, 0x7fff,
0x0000, 0x0000, 0x8001, 0x8001, 0x0000, 0x0000, 0x7fff, 0x7fff, 0x0000, 0x0000, 0x8001, 0x8001,
0x0000, 0x0000, 0x7fff, 0x7fff, 0x0000, 0x0000, 0x8001, 0x8001, 0x0000, 0x0000, 0x7fff, 0x7fff,
0x0000, 0x0000, 0x8001, 0x8001, 0x0000, 0x0000, 0x7fff, 0x7fff, 0x0000, 0x0000, 0x8001, 0x8001,
0x0000, 0x0000, 0x7fff, 0x7fff, 0x0000, 0x0000, 0x8001, 0x8001, 0x0000, 0x0000, 0x7fff, 0x7fff,
0x0000, 0x0000, 0x8001, 0x8001,
};
s16 sEuUnknownWave6[256] = {
0x0000, 0x9ba7, 0x9b41, 0x6c9b, 0x9450, 0xadda, 0x569e, 0x189a, 0x69bf, 0xb79d, 0x6fe9, 0x08ec,
0x0d34, 0x1aea, 0xce76, 0xad86, 0x2710, 0xa038, 0x7e28, 0x2fd8, 0x3af8, 0x3bfa, 0xd10b, 0x84c7,
0xcd7f, 0x18f4, 0xd4c8, 0x76f8, 0x8994, 0xaa11, 0x73fb, 0x6c01, 0x0000, 0x93ff, 0x8c05, 0x55ef,
0x766c, 0x8907, 0x2b38, 0xe70d, 0x3281, 0x7b38, 0x2ef5, 0xc407, 0xc508, 0xd027, 0x81d8, 0x5fc9,
0xd8f0, 0x5279, 0x318a, 0xe517, 0xf2cc, 0xf713, 0x9017, 0x4864, 0x9641, 0xe765, 0xa962, 0x5227,
0x6bb0, 0x9364, 0x64bf, 0x645a, 0x0000, 0x9b41, 0x9450, 0x569e, 0x69bf, 0x6fe9, 0x0d34, 0xce76,
0x2710, 0x7e28, 0x3af8, 0xd10b, 0xcd7f, 0xd4c8, 0x8994, 0x73fb, 0x0000, 0x8c05, 0x766c, 0x2b38,
0x3281, 0x2ef5, 0xc508, 0x81d8, 0xd8f0, 0x318a, 0xf2cc, 0x9017, 0x9641, 0xa962, 0x6bb0, 0x64bf,
0x0000, 0x9b41, 0x9450, 0x569e, 0x69bf, 0x6fe9, 0x0d34, 0xce76, 0x2710, 0x7e28, 0x3af8, 0xd10b,
0xcd7f, 0xd4c8, 0x8994, 0x73fb, 0x0000, 0x8c05, 0x766c, 0x2b38, 0x3281, 0x2ef5, 0xc508, 0x81d8,
0xd8f0, 0x318a, 0xf2cc, 0x9017, 0x9641, 0xa962, 0x6bb0, 0x64bf, 0x0000, 0x9450, 0x69bf, 0x0d34,
0x2710, 0x3af8, 0xcd7f, 0x8994, 0x0000, 0x766c, 0x3281, 0xc508, 0xd8f0, 0xf2cc, 0x9641, 0x6bb0,
0x0000, 0x9450, 0x69bf, 0x0d34, 0x2710, 0x3af8, 0xcd7f, 0x8994, 0x0000, 0x766c, 0x3281, 0xc508,
0xd8f0, 0xf2cc, 0x9641, 0x6bb0, 0x0000, 0x9450, 0x69bf, 0x0d34, 0x2710, 0x3af8, 0xcd7f, 0x8994,
0x0000, 0x766c, 0x3281, 0xc508, 0xd8f0, 0xf2cc, 0x9641, 0x6bb0, 0x0000, 0x9450, 0x69bf, 0x0d34,
0x2710, 0x3af8, 0xcd7f, 0x8994, 0x0000, 0x766c, 0x3281, 0xc508, 0xd8f0, 0xf2cc, 0x9641, 0x6bb0,
0x0000, 0x69bf, 0x2710, 0xcd7f, 0x0000, 0x3281, 0xd8f0, 0x9641, 0x0000, 0x69bf, 0x2710, 0xcd7f,
0x0000, 0x3281, 0xd8f0, 0x9641, 0x0000, 0x69bf, 0x2710, 0xcd7f, 0x0000, 0x3281, 0xd8f0, 0x9641,
0x0000, 0x69bf, 0x2710, 0xcd7f, 0x0000, 0x3281, 0xd8f0, 0x9641, 0x0000, 0x69bf, 0x2710, 0xcd7f,
0x0000, 0x3281, 0xd8f0, 0x9641, 0x0000, 0x69bf, 0x2710, 0xcd7f, 0x0000, 0x3281, 0xd8f0, 0x9641,
0x0000, 0x69bf, 0x2710, 0xcd7f, 0x0000, 0x3281, 0xd8f0, 0x9641, 0x0000, 0x69bf, 0x2710, 0xcd7f,
0x0000, 0x3281, 0xd8f0, 0x9641,
};
s16 gEuUnknownWave7[256] = {
0x0000, 0x3fbc, 0x4eb4, 0x4f21, 0x6a49, 0x806f, 0x7250, 0x6a7b, 0x8d2e, 0xac0a, 0x98d6, 0x7832,
0x7551, 0x71ca, 0x4eee, 0x3731, 0x4e20, 0x644d, 0x4a50, 0x23ba, 0x1b09, 0x119a, 0xe914, 0xccbe,
0xe14e, 0xf8a3, 0xe47e, 0xc937, 0xd181, 0xde39, 0xcfc6, 0xcf94, 0x0000, 0x306c, 0x303a, 0x21c7,
0x2e7f, 0x36c8, 0x1b82, 0x075e, 0x1eb2, 0x3341, 0x16ec, 0xee67, 0xe4f7, 0xdc45, 0xb5b0, 0x9bb4,
0xb1e0, 0xc8ce, 0xb112, 0x8e37, 0x8aaf, 0x87cd, 0x672a, 0x53f7, 0x72d2, 0x9584, 0x8db0, 0x7f92,
0x95b7, 0xb0de, 0xb14c, 0xc045, 0x0000, 0x4eb4, 0x6a49, 0x7250, 0x8d2e, 0x98d6, 0x7551, 0x4eee,
0x4e20, 0x4a50, 0x1b09, 0xe914, 0xe14e, 0xe47e, 0xd181, 0xcfc6, 0x0000, 0x303a, 0x2e7f, 0x1b82,
0x1eb2, 0x16ec, 0xe4f7, 0xb5b0, 0xb1e0, 0xb112, 0x8aaf, 0x672a, 0x72d2, 0x8db0, 0x95b7, 0xb14c,
0x0000, 0x4eb4, 0x6a49, 0x7250, 0x8d2e, 0x98d6, 0x7551, 0x4eee, 0x4e20, 0x4a50, 0x1b09, 0xe914,
0xe14e, 0xe47e, 0xd181, 0xcfc6, 0x0000, 0x303a, 0x2e7f, 0x1b82, 0x1eb2, 0x16ec, 0xe4f7, 0xb5b0,
0xb1e0, 0xb112, 0x8aaf, 0x672a, 0x72d2, 0x8db0, 0x95b7, 0xb14c, 0x0000, 0x6a49, 0x8d2e, 0x7551,
0x4e20, 0x1b09, 0xe14e, 0xd181, 0x0000, 0x2e7f, 0x1eb2, 0xe4f7, 0xb1e0, 0x8aaf, 0x72d2, 0x95b7,
0x0000, 0x6a49, 0x8d2e, 0x7551, 0x4e20, 0x1b09, 0xe14e, 0xd181, 0x0000, 0x2e7f, 0x1eb2, 0xe4f7,
0xb1e0, 0x8aaf, 0x72d2, 0x95b7, 0x0000, 0x6a49, 0x8d2e, 0x7551, 0x4e20, 0x1b09, 0xe14e, 0xd181,
0x0000, 0x2e7f, 0x1eb2, 0xe4f7, 0xb1e0, 0x8aaf, 0x72d2, 0x95b7, 0x0000, 0x6a49, 0x8d2e, 0x7551,
0x4e20, 0x1b09, 0xe14e, 0xd181, 0x0000, 0x2e7f, 0x1eb2, 0xe4f7, 0xb1e0, 0x8aaf, 0x72d2, 0x95b7,
0x0000, 0x8d2e, 0x4e20, 0xe14e, 0x0000, 0x1eb2, 0xb1e0, 0x72d2, 0x0000, 0x8d2e, 0x4e20, 0xe14e,
0x0000, 0x1eb2, 0xb1e0, 0x72d2, 0x0000, 0x8d2e, 0x4e20, 0xe14e, 0x0000, 0x1eb2, 0xb1e0, 0x72d2,
0x0000, 0x8d2e, 0x4e20, 0xe14e, 0x0000, 0x1eb2, 0xb1e0, 0x72d2, 0x0000, 0x8d2e, 0x4e20, 0xe14e,
0x0000, 0x1eb2, 0xb1e0, 0x72d2, 0x0000, 0x8d2e, 0x4e20, 0xe14e, 0x0000, 0x1eb2, 0xb1e0, 0x72d2,
0x0000, 0x8d2e, 0x4e20, 0xe14e, 0x0000, 0x1eb2, 0xb1e0, 0x72d2, 0x0000, 0x8d2e, 0x4e20, 0xe14e,
0x0000, 0x1eb2, 0xb1e0, 0x72d2,
};
// u8 buffer_remove2[764] = { 0 };
s16 *gWaveSamples[6] = { sSawtoothWaves, sTriangleWaves, sSineWaves, sSquareWaves, sEuUnknownWave6, gEuUnknownWave7 };
#endif
#ifndef VERSION_EU
s16 sSineWave[0x40] = {
0, 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, 25329, 27244,
28897, 30272, 31356, 32137, 32609, 0x7FFF, 32609, 32137, 31356, 30272, 28897,
@@ -144,6 +347,7 @@ s16 sSineWave[0x40] = {
-30272, -31356, -32137, -32609, -0x7FFF, -32609, -32137, -31356, -30272, -28897, -27244,
-25329, -23169, -20787, -18204, -15446, -12539, -9511, -6392, -3211,
};
s16 sSquareWave[0x40] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF,
@@ -160,6 +364,7 @@ s16 sTriangleWave[0x40] = {
-24575, -26623, -28671, -30719, -0x7FFF, -30719, -28671, -26623, -24575, -22527, -0x4FFF,
-0x47FF, -0x3FFF, -0x37FF, -0x2FFF, -0x27FF, -0x1FFF, -0x17FF, -0xFFF, -0x7FF,
};
s16 sSawtoothWave[0x40] = {
0, 1023, 2047, 3071, 4095, 5119, 6143, 7167, 8191, 9215, 10239,
11263, 0x2FFF, 13311, 0x37FF, 15359, 0x3FFF, 17407, 0x47FF, 19455, 0x4FFF, 21503,
@@ -168,10 +373,21 @@ s16 sSawtoothWave[0x40] = {
-0x4FFF, -19455, -0x47FF, -17407, -0x3FFF, -15359, -0x37FF, -13311, -0x2FFF, -11263, -10239,
-9215, -8191, -7167, -6143, -5119, -4095, -3071, -2047, -1023,
};
s16 *gWaveSamples[4] = { sSawtoothWave, sTriangleWave, sSineWave, sSquareWave };
#endif
#ifdef VERSION_EU
u8 euUnknownData_8030194c[4] = { 0x40, 0x20, 0x10, 0x08 };
u16 gHeadsetPanQuantization[0x10] = {
0x40, 0x40, 0x30, 0x30, 0x20, 0x20, 0x10, 0, 0, 0,
};
s32 euUnknownData_80301950[32] = { //maybe envelope of some kind?
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 500, 0, 0, 0, 500, 0, 0, 0, 500, 0, 0, 0, 500, 0, 0,
};
#else
u16 gHeadsetPanQuantization[10] = { 0x40, 0x30, 0x20, 0x10, 0, 0, 0, 0, 0, 0 };
#endif
// Linearly interpolated between
// f(0/2 * 127) = 1
@@ -238,6 +454,7 @@ f32 gDefaultPanVolume[128] = {
0.012368f, 0.0f
};
#ifndef VERSION_EU
// gVolRampingLhs136[k] = 2^16 * max(1, (256*k)^(1/17)
f32 gVolRampingLhs136[128] = {
65536.0f, 90811.555f, 94590.766f, 96873.96f, 98527.26f, 99829.06f, 100905.47f,
@@ -363,29 +580,31 @@ f32 gVolRampingRhs128[128] = {
0.525077f, 0.524798f, 0.524522f, 0.524247f, 0.523975f, 0.523706f, 0.523439f, 0.523174f, 0.522911f,
0.522651f, 0.522393f
};
#endif
s16 gTatumsPerBeat = TATUMS_PER_BEAT;
s8 gUnusedCount80333EE8 = 16;
s32 gAudioHeapSize = DOUBLE_SIZE_ON_64_BIT(0x31150);
s32 D_80333EF0 = DOUBLE_SIZE_ON_64_BIT(0x2500);
s8 gUnusedCount80333EE8 = UNUSED_COUNT_80333EE8;
s32 gAudioHeapSize = DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE);
s32 D_80333EF0 = DOUBLE_SIZE_ON_64_BIT(D_80333EF0_VAL);
volatile s32 gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
#ifdef VERSION_EU
u8 bufferDelete2[12] = { 0 };
u8 D_EU_80302010 = 0;
u8 D_EU_80302014 = 0;
struct OSMesgQueue *OSMesgQueues[4] = { &OSMesgQueue0, &OSMesgQueue1, &OSMesgQueue2, &OSMesgQueue3 }; // { 0x80332e40, 0x80332e58, 0x80332e70, 0x80332e88 };
#else
s8 sUnused8033EF8 = 24;
#endif
// .bss
struct CtlEntry *gCtlEntries;
s32 gAiFrequency;
u32 D_80226D68;
s32 gMaxAudioCmds;
s32 gMaxSimultaneousNotes;
s32 gSamplesPerFrameTarget;
s32 gMinAiBufferLength;
s16 gTempoInternalToExternal;
s8 gAudioUpdatesPerFrame;
s8 gSoundMode;
volatile s32 gAudioFrameCount;
#ifdef VERSION_EU
s32 gCurrAudioFrameDmaCount;
#else
volatile s32 gCurrAudioFrameDmaCount;
#endif
s32 gAudioTaskIndex;
s32 gCurrAiBufferIndex;
@@ -396,10 +615,23 @@ u64 *gAudioCmd;
struct SPTask *gAudioTask;
struct SPTask gAudioTasks[2];
#ifdef VERSION_EU
f32 D_EU_802298D0;
s32 gRefreshRate;
#endif
u16 *gAiBuffers[NUMAIBUFFERS];
s16 gAiBufferLengths[NUMAIBUFFERS];
#ifdef VERSION_EU
u32 gAudioRandom;
s32 gAudioErrorFlags;
u64 gAudioGlobalsEndMarker;
#endif
#ifndef VERSION_EU
u32 gUnused80226E58[0x10];
u16 gUnused80226E98[0x10];
u32 gAudioRandom;
#endif

View File

@@ -10,10 +10,18 @@
#define NUMAIBUFFERS 3
// constant .data
#ifdef VERSION_EU
extern struct AudioSessionSettingsEU gAudioSessionPresets[];
#else
extern struct AudioSessionSettings gAudioSessionPresets[18];
#endif
extern u16 D_80332388[128]; // unused
#ifdef VERSION_EU
extern f32 gPitchBendFrequencyScale[256];
#else
extern f32 gPitchBendFrequencyScale[255];
#endif
extern f32 gNoteFrequencies[128];
extern u8 gDefaultShortNoteVelocityTable[16];
@@ -21,9 +29,22 @@ extern u8 gDefaultShortNoteDurationTable[16];
extern s8 gVibratoCurve[16];
extern struct AdsrEnvelope gDefaultEnvelope[3];
#ifdef VERSION_EU
extern s16 gEuUnknownWave7[256];
extern s16 *gWaveSamples[6];
#else
extern s16 *gWaveSamples[4];
#endif
#ifdef VERSION_EU
extern u8 euUnknownData_8030194c[4];
extern u16 gHeadsetPanQuantization[0x10];
extern s32 euUnknownData_80301950[32];
extern struct NoteSubEu gZeroNoteSub;
extern struct NoteSubEu gDefaultNoteSub;
#else
extern u16 gHeadsetPanQuantization[10];
#endif
extern f32 gHeadsetPanVolume[128];
extern f32 gStereoPanVolume[128];
extern f32 gDefaultPanVolume[128];
@@ -43,20 +64,14 @@ extern s32 D_80333EF0; // amount of heap designated to gAudioInitPool, 0x2500
extern volatile s32 gAudioLoadLock;
// .bss
extern struct CtlEntry *gCtlEntries;
extern s32 gAiFrequency;
extern u32 D_80226D68;
extern s32 gMaxAudioCmds;
extern s32 gMaxSimultaneousNotes;
extern s32 gSamplesPerFrameTarget;
extern s32 gMinAiBufferLength;
extern s16 gTempoInternalToExternal;
extern s8 gAudioUpdatesPerFrame; // = 4
extern s8 gSoundMode;
extern volatile s32 gAudioFrameCount;
extern volatile s32 gCurrAudioFrameDmaCount; // number of DMAs performed during this frame
// number of DMAs performed during this frame
#ifdef VERSION_EU
extern s32 gCurrAudioFrameDmaCount;
#else
extern volatile s32 gCurrAudioFrameDmaCount;
#endif
extern s32 gAudioTaskIndex;
extern s32 gCurrAiBufferIndex;
@@ -67,12 +82,34 @@ extern u64 *gAudioCmd;
extern struct SPTask *gAudioTask;
extern struct SPTask gAudioTasks[2];
#ifdef VERSION_EU
extern f32 D_EU_802298D0;
extern s32 gRefreshRate;
#endif
extern u16 *gAiBuffers[NUMAIBUFFERS];
extern s16 gAiBufferLengths[NUMAIBUFFERS];
#ifdef VERSION_EU
#define AIBUFFER_LEN (0xa0 * 17)
#else
#define AIBUFFER_LEN (0xa0 * 16)
#endif
extern u32 gUnused80226E58[0x10];
extern u16 gUnused80226E98[0x10];
extern u32 gAudioRandom;
//make my life easier
#ifdef VERSION_EU
#define UNUSED_COUNT_80333EE8 24
#define AUDIO_HEAP_SIZE 0x2c500
#define D_80333EF0_VAL 0x2c00
#else
#define UNUSED_COUNT_80333EE8 16
#define AUDIO_HEAP_SIZE 0x31150
#define D_80333EF0_VAL 0x2500
#endif
#endif /* AUDIO_DATA_H */

View File

@@ -12,14 +12,59 @@
#define US_FLOAT2(x) x
#endif
#ifdef VERSION_EU
void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 arg1) {
f32 weight;
s32 i;
if (seqChannel->unk1.as_bitfields.unk0b40 || arg1) {
weight = seqChannel->volume * seqChannel->volumeScale * seqChannel->seqPlayer->unkEu2C;
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0) {
weight = seqChannel->seqPlayer->muteVolumeScale * weight;
}
seqChannel->panChannelWeight = weight;
}
if (seqChannel->unk1.as_bitfields.unk0b20) {
seqChannel->pan = seqChannel->unk9 * seqChannel->unkA;
}
for (i = 0; i < 4; ++i) {
struct SequenceChannelLayer *layer = seqChannel->layers[i];
if (layer && layer->enabled && layer->note) {
if (layer->unkEu0b4) {
layer->noteFreqScale = layer->freqScale * seqChannel->freqScale;
layer->noteVelocity = layer->velocitySquare * seqChannel->panChannelWeight;
layer->notePan = (seqChannel->pan + layer->euUnk5 * (0x80 - seqChannel->unkA)) >> 7;
layer->unkEu0b4 = 0;
} else {
if (seqChannel->unk1.as_bitfields.unk0b80) {
layer->noteFreqScale = layer->freqScale * seqChannel->freqScale;
}
if (seqChannel->unk1.as_bitfields.unk0b40 || arg1) {
layer->noteVelocity = layer->velocitySquare * seqChannel->panChannelWeight;
}
if (seqChannel->unk1.as_bitfields.unk0b20) {
layer->notePan = (seqChannel->pan + layer->euUnk5 * (0x80 - seqChannel->unkA)) >> 7;
}
}
}
}
seqChannel->unk1.as_u8 = 0;
}
#else
void func_80319E70(void) {
}
#endif
void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
s32 i;
if (seqPlayer->fadeTimer != 0) {
seqPlayer->fadeVolume += seqPlayer->fadeVelocity;
#ifdef VERSION_EU
seqPlayer->unk_eu = TRUE;
#endif
if (seqPlayer->fadeVolume > US_FLOAT2(1)) {
seqPlayer->fadeVolume = US_FLOAT2(1);
@@ -29,6 +74,12 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
}
if (--seqPlayer->fadeTimer == 0) {
#ifdef VERSION_EU
if (seqPlayer->state == 2) {
sequence_player_disable(seqPlayer);
return;
}
#else
switch (seqPlayer->state) {
case SEQUENCE_PLAYER_STATE_FADE_OUT:
sequence_player_disable(seqPlayer);
@@ -42,13 +93,23 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
case SEQUENCE_PLAYER_STATE_4:
break;
}
#endif
}
}
#ifdef VERSION_EU
if (seqPlayer->unk_eu) {
seqPlayer->unkEu2C = seqPlayer->fadeVolume * seqPlayer->unkEu28;
}
#endif
// Process channels
for (i = 0; i < CHANNELS_MAX; i++) {
if (IS_SEQUENCE_CHANNEL_VALID(seqPlayer->channels[i]) == TRUE
&& seqPlayer->channels[i]->enabled == TRUE) {
#ifdef VERSION_EU
sequence_channel_process_sound(seqPlayer->channels[i], seqPlayer->unk_eu);
#else
f32 channelVolume;
f32 panLayerWeight;
f32 panFromChannel;
@@ -72,28 +133,52 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
seqLayer->notePan = (seqLayer->pan * panLayerWeight) + panFromChannel;
}
}
#endif
}
}
#ifdef VERSION_EU
seqPlayer->unk_eu = FALSE;
#endif
}
f32 get_portamento_freq_scale(struct Portamento *p) {
u32 v0;
f32 result;
#ifndef VERSION_EU
if (p->mode == 0) {
return 1.0f;
}
#endif
p->cur += p->speed;
v0 = (u32) p->cur;
if (v0 >= 127) {
#ifdef VERSION_EU
if (v0 > 127)
#else
if (v0 >= 127)
#endif
{
v0 = 127;
}
#ifdef VERSION_EU
result = US_FLOAT(1.0) + p->extent * (gPitchBendFrequencyScale[v0 + 128] - US_FLOAT(1.0));
#else
result = US_FLOAT(1.0) + p->extent * (gPitchBendFrequencyScale[v0 + 127] - US_FLOAT(1.0));
#endif
return result;
}
#ifdef VERSION_EU
s16 get_vibrato_pitch_change(struct VibratoState *vib) {
s32 index;
vib->time += (s32) vib->rate;
index = (vib->time >> 10) & 0x3F;
return vib->curve[index] >> 8;
}
#else
s8 get_vibrato_pitch_change(struct VibratoState *vib) {
s32 index;
vib->time += vib->rate;
@@ -118,9 +203,10 @@ s8 get_vibrato_pitch_change(struct VibratoState *vib) {
return -vib->curve[index];
}
#endif
f32 get_vibrato_freq_scale(struct VibratoState *vib) {
s8 pitchChange;
s32 pitchChange;
f32 extent;
f32 result;
@@ -131,37 +217,47 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) {
if (vib->extentChangeTimer) {
if (vib->extentChangeTimer == 1) {
vib->extent = vib->seqChannel->vibratoExtentTarget;
vib->extent = (s32) vib->seqChannel->vibratoExtentTarget;
} else {
vib->extent +=
(vib->seqChannel->vibratoExtentTarget - vib->extent) / vib->extentChangeTimer;
((s32) vib->seqChannel->vibratoExtentTarget - vib->extent) / (s32) vib->extentChangeTimer;
}
vib->extentChangeTimer--;
} else {
if (vib->extent != vib->seqChannel->vibratoExtentTarget) {
vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay;
if (vib->extentChangeTimer == 0) {
vib->extent = vib->seqChannel->vibratoExtentTarget;
}
#ifdef VERSION_EU
} else if ((s32) vib->extent != (*vib).seqChannel->vibratoExtentTarget) {
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0) {
vib->extent = (s32) vib->seqChannel->vibratoExtentTarget;
}
#else
} else if ((s32) vib->extent != vib->seqChannel->vibratoExtentTarget) {
vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay;
if (vib->extentChangeTimer == 0) {
vib->extent = (s32) vib->seqChannel->vibratoExtentTarget;
}
#endif
}
if (vib->rateChangeTimer) {
if (vib->rateChangeTimer == 1) {
vib->rate = vib->seqChannel->vibratoRateTarget;
vib->rate = (s32) vib->seqChannel->vibratoRateTarget;
} else {
vib->rate += (vib->seqChannel->vibratoRateTarget - vib->rate) / vib->rateChangeTimer;
vib->rate += ((s32) vib->seqChannel->vibratoRateTarget - vib->rate) / (s32) vib->rateChangeTimer;
}
vib->rateChangeTimer--;
} else {
if (vib->rate != vib->seqChannel->vibratoRateTarget) {
vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay;
if (vib->rateChangeTimer == 0) {
vib->rate = vib->seqChannel->vibratoRateTarget;
}
#ifdef VERSION_EU
} else if ((s32) vib->rate != (*vib).seqChannel->vibratoRateTarget) {
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0) {
vib->rate = (s32) vib->seqChannel->vibratoRateTarget;
}
#else
} else if ((s32) vib->rate != vib->seqChannel->vibratoRateTarget) {
vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay;
if (vib->rateChangeTimer == 0) {
vib->rate = (s32) vib->seqChannel->vibratoRateTarget;
}
#endif
}
if (vib->extent == 0) {
@@ -171,39 +267,76 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) {
pitchChange = get_vibrato_pitch_change(vib);
extent = (f32) vib->extent / US_FLOAT(4096.0);
#ifdef VERSION_EU
result = US_FLOAT(1.0) + extent * (gPitchBendFrequencyScale[pitchChange + 128] - US_FLOAT(1.0));
#else
result = US_FLOAT(1.0) + extent * (gPitchBendFrequencyScale[pitchChange + 127] - US_FLOAT(1.0));
#endif
return result;
}
void note_vibrato_update(struct Note *note) {
#ifdef VERSION_EU
if (note->portamento.mode != 0) {
note->portamentoFreqScale = get_portamento_freq_scale(&note->portamento);
}
if (note->vibratoState.active && note->parentLayer != NO_LAYER) {
note->vibratoFreqScale = get_vibrato_freq_scale(&note->vibratoState);
}
#else
if (note->vibratoState.active) {
note->portamentoFreqScale = get_portamento_freq_scale(&note->portamento);
if (note->parentLayer != NO_LAYER) {
note->vibratoFreqScale = get_vibrato_freq_scale(&note->vibratoState);
}
}
#endif
}
void note_vibrato_init(struct Note *note) {
struct VibratoState *vib;
struct SequenceChannel *seqChannel;
UNUSED struct SequenceChannel *seqChannel;
#ifdef VERSION_EU
struct NotePlaybackState *seqPlayerState = (struct NotePlaybackState *) &note->priority;
#endif
note->vibratoFreqScale = 1.0f;
note->portamentoFreqScale = 1.0f;
vib = &note->vibratoState;
#ifndef VERSION_EU
if (note->parentLayer->seqChannel->vibratoExtentStart == 0
&& note->parentLayer->seqChannel->vibratoExtentTarget == 0
&& note->parentLayer->portamento.mode == 0) {
vib->active = FALSE;
return;
}
#endif
vib->active = TRUE;
vib->time = 0;
#ifdef VERSION_EU
vib->curve = gWaveSamples[2];
vib->seqChannel = note->parentLayer->seqChannel;
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0) {
vib->extent = FLOAT_CAST(vib->seqChannel->vibratoExtentTarget);
} else {
vib->extent = FLOAT_CAST(vib->seqChannel->vibratoExtentStart);
}
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0) {
vib->rate = FLOAT_CAST(vib->seqChannel->vibratoRateTarget);
} else {
vib->rate = FLOAT_CAST(vib->seqChannel->vibratoRateStart);
}
vib->delay = vib->seqChannel->vibratoDelay;
seqPlayerState->portamento = seqPlayerState->parentLayer->portamento;
#else
vib->curve = gVibratoCurve;
vib->seqChannel = note->parentLayer->seqChannel;
seqChannel = vib->seqChannel;
vib->extentChangeTimer = seqChannel->vibratoExtentChangeDelay;
@@ -219,40 +352,64 @@ void note_vibrato_init(struct Note *note) {
} else {
vib->rate = seqChannel->vibratoRateStart;
}
vib->delay = seqChannel->vibratoDelay;
note->portamento = note->parentLayer->portamento;
#endif
}
void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, s16 *volOut) {
void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, UNUSED s16 *volOut) {
adsr->action = 0;
adsr->state = ADSR_STATE_DISABLED;
#ifdef VERSION_EU
adsr->delay = 0;
adsr->envelope = envelope;
adsr->current = 0.0f;
#else
adsr->initial = 0;
adsr->delay = 0;
adsr->velocity = 0;
adsr->envelope = envelope;
adsr->volOut = volOut;
#endif
}
#ifdef VERSION_EU
f32 adsr_update(struct AdsrState *adsr) {
#else
s32 adsr_update(struct AdsrState *adsr) {
#endif
u8 action = adsr->action;
#ifdef VERSION_EU
u8 state = adsr->state;
switch (state) {
#else
switch (adsr->state) {
#endif
case ADSR_STATE_DISABLED:
return 0;
case ADSR_STATE_INITIAL: {
#ifndef VERSION_EU
adsr->current = adsr->initial;
adsr->target = adsr->initial;
#endif
if (action & ADSR_ACTION_HANG) {
adsr->state = ADSR_STATE_HANG;
#ifdef VERSION_EU
break;
#else
goto CONT;
#endif
}
// fallthrough
}
case ADSR_STATE_START_LOOP:
adsr->envIndex = 0;
#ifndef VERSION_EU
adsr->currentHiRes = adsr->current << 0x10;
#endif
adsr->state = ADSR_STATE_LOOP;
// fallthrough
@@ -273,45 +430,89 @@ s32 adsr_update(struct AdsrState *adsr) {
break;
default:
#ifdef VERSION_EU
if (adsr->delay >= 4) {
adsr->delay = adsr->delay * gAudioBufferParameters.updatesPerFrame / 4;
}
adsr->target = (f32) BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0;
adsr->target = adsr->target * adsr->target;
adsr->velocity = (adsr->target - adsr->current) / adsr->delay;
#else
adsr->target = BSWAP16(adsr->envelope[adsr->envIndex].arg);
adsr->velocity = ((adsr->target - adsr->current) << 0x10) / adsr->delay;
#endif
adsr->state = ADSR_STATE_FADE;
adsr->envIndex++;
break;
}
if (adsr->state != ADSR_STATE_FADE) {
#ifdef VERSION_EU
break;
#else
goto CONT;
#endif
}
// fallthrough
case ADSR_STATE_FADE:
#ifdef VERSION_EU
adsr->current += adsr->velocity;
#else
adsr->currentHiRes += adsr->velocity;
adsr->current = adsr->currentHiRes >> 0x10;
#endif
if (--adsr->delay <= 0) {
adsr->state = ADSR_STATE_LOOP;
}
// fallthrough
case ADSR_STATE_HANG:
#ifdef VERSION_EU
break;
#else
goto CONT;
#endif
case ADSR_STATE_DECAY:
case ADSR_STATE_RELEASE: {
adsr->current -= adsr->fadeOutVel;
#ifdef VERSION_EU
if (adsr->sustain != 0.0f && state == ADSR_STATE_DECAY) {
#else
if (adsr->sustain != 0 && adsr->state == ADSR_STATE_DECAY) {
#endif
if (adsr->current < adsr->sustain) {
adsr->current = adsr->sustain;
#ifdef VERSION_EU
adsr->delay = 128;
#else
adsr->delay = adsr->sustain / 16;
#endif
adsr->state = ADSR_STATE_SUSTAIN;
}
#ifdef VERSION_EU
break;
#else
goto CONT;
#endif
}
#ifdef VERSION_EU
if (adsr->current < 0) {
adsr->current = 0.0f;
adsr->state = ADSR_STATE_DISABLED;
}
#else
if (adsr->current < 100) {
adsr->current = 0;
adsr->state = ADSR_STATE_DISABLED;
}
#endif
#ifdef VERSION_EU
break;
#else
goto CONT;
#endif
}
case ADSR_STATE_SUSTAIN:
@@ -319,10 +520,16 @@ s32 adsr_update(struct AdsrState *adsr) {
if (adsr->delay == 0) {
adsr->state = ADSR_STATE_RELEASE;
}
#ifdef VERSION_EU
break;
#else
goto CONT;
#endif
}
#ifndef VERSION_EU
CONT:
#endif
if ((action & ADSR_ACTION_DECAY)) {
adsr->state = ADSR_STATE_DECAY;
@@ -331,9 +538,23 @@ CONT:
if ((action & ADSR_ACTION_RELEASE)) {
adsr->state = ADSR_STATE_RELEASE;
#ifdef VERSION_EU
adsr->action = action & ~ADSR_ACTION_RELEASE;
#else
adsr->action = action & ~(ADSR_ACTION_RELEASE | ADSR_ACTION_DECAY);
#endif
}
#ifdef VERSION_EU
if (adsr->current < 0.0f) {
return 0.0f;
}
if (adsr->current > 1.0f) {
return 1.0f;
}
return adsr->current;
#else
*adsr->volOut = adsr->current;
return 0;
#endif
}

View File

@@ -35,6 +35,10 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer);
void note_vibrato_update(struct Note *note);
void note_vibrato_init(struct Note *note);
void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, s16 *volOut);
#ifdef VERSION_EU
f32 adsr_update(struct AdsrState *adsr);
#else
s32 adsr_update(struct AdsrState *adsr);
#endif
#endif /* AUDIO_EFFECTS_H */

File diff suppressed because it is too large Load Diff

View File

@@ -33,7 +33,7 @@ void sound_banks_disable(u8 player, u16 bankMask);
void sound_banks_enable(u8 player, u16 bankMask);
void func_80320A4C(u8 bankIndex, u8 arg1);
void play_dialog_sound(u8 dialogID);
void play_music(u8 player, u16 seqArgs, s16 fadeTimer);
void play_music(u8 player, u16 seqArgs, u16 fadeTimer);
void stop_background_music(u16 seqId);
void fadeout_background_music(u16 arg0, u16 fadeOut);
void drop_queued_background_music(void);
@@ -53,4 +53,8 @@ void audio_set_sound_mode(u8 arg0);
void audio_init(void); // in load.c
#ifdef VERSION_EU
struct SPTask *unused_80321460();
#endif
#endif /* AUDIO_EXTERNAL_H */

View File

@@ -1,3 +1,5 @@
#include <ultra64.h>
#ifndef VERSION_EU
u64 gAudioGlobalsEndMarker;
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -18,13 +18,8 @@ extern struct Note *gNotes;
// gSequencePlayers[2] is sound
extern struct SequencePlayer gSequencePlayers[SEQUENCE_PLAYERS];
extern struct SequenceChannel gSequenceChannels[32];
#ifdef VERSION_JP
extern struct SequenceChannelLayer gSequenceLayers[48];
#else
extern struct SequenceChannelLayer gSequenceLayers[52];
#endif
extern struct SequenceChannel gSequenceChannels[SEQUENCE_CHANNELS];
extern struct SequenceChannelLayer gSequenceLayers[SEQUENCE_LAYERS];
extern struct SequenceChannel gSequenceChannelNone;
@@ -36,6 +31,21 @@ extern u32 gSampleDmaNumListItems;
extern ALSeqFile *gAlTbl;
extern u8 *gAlBankSets;
extern struct CtlEntry *gCtlEntries;
#ifdef VERSION_EU
extern struct AudioBufferParametersEU gAudioBufferParameters;
#endif
extern s32 gAiFrequency;
extern u32 D_80226D68;
extern s32 gMaxAudioCmds;
extern s32 gMaxSimultaneousNotes;
extern s32 gSamplesPerFrameTarget;
extern s32 gMinAiBufferLength;
extern s16 gTempoInternalToExternal;
extern s8 gAudioUpdatesPerFrame; // = 4
extern s8 gSoundMode;
void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg);
void decrease_sample_dma_ttls(void);
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3);

File diff suppressed because it is too large Load Diff

View File

@@ -55,11 +55,17 @@ extern struct SoundMultiPool gSeqLoadedPool;
extern struct SoundMultiPool gBankLoadedPool;
extern u8 gBankLoadStatus[64];
extern u8 gSeqLoadStatus[256];
extern volatile u8 gAudioResetStatus;
extern u8 gAudioResetPresetIdToLoad;
void *soundAlloc(struct SoundAllocPool *pool, u32 size);
void sound_init_main_pools(s32 sizeForAudioInitPool);
void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id);
void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 arg2);
#ifdef VERSION_EU
void audio_reset_session(void);
#else
void audio_reset_session(struct AudioSessionSettings *preset);
#endif
#endif /* AUDIO_MEMORY_H */

File diff suppressed because it is too large Load Diff

View File

@@ -28,5 +28,15 @@ struct Note *alloc_note(struct SequenceChannelLayer *seqLayer);
void reclaim_notes(void);
void note_init_all(void);
#ifdef VERSION_EU
struct AudioBankSound *func_eu_802e4e5c(struct Instrument *instrument, s32 semitone);
struct Drum *func_eu_802e4fb8(s32 bankId, s32 drumId);
void note_init_volume(struct Note *note);
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb);
void note_set_frequency(struct Note *note, f32 frequency);
void note_enable(struct Note *note);
void note_disable(struct Note *note);
#endif
#endif /* _AUDIO_PLAYBACK_H */

326
src/audio/port_eu.c Normal file
View File

@@ -0,0 +1,326 @@
#include <ultra64.h>
#include "internal.h"
#include "load.h"
#include "data.h"
#include "seqplayer.h"
#include "synthesis.h"
#ifdef VERSION_EU
#ifdef __sgi
#define stubbed_printf
#else
#define stubbed_printf(...)
#endif
#define SAMPLES_TO_OVERPRODUCE 0x10
#define EXTRA_BUFFERED_AI_SAMPLES_TARGET 0x40
#ifdef VERSION_JP
typedef u16 FadeT;
#else
typedef s32 FadeT;
#endif
extern volatile u8 gAudioResetStatus;
extern u8 gAudioResetPresetIdToLoad;
extern OSMesgQueue *OSMesgQueues[];
extern struct EuAudioCmd sAudioCmd[0x100];
void func_8031D690(s32 player, FadeT fadeInTime);
void sequence_player_fade_out_internal(s32 player, FadeT fadeOutTime);
void func_802ad668(void);
void decrease_sample_dma_ttls(void);
s32 func_eu_802E2AA0(void);
void func_802ad7ec(u32);
struct SPTask *create_next_audio_frame_task(void) {
u32 samplesRemainingInAI;
s32 writtenCmds;
s32 index;
OSTask_t *task;
s32 flags;
u16 *currAiBuffer;
s32 oldDmaCount;
OSMesg sp30;
OSMesg sp2C;
gAudioFrameCount++;
if (gAudioFrameCount % gAudioBufferParameters.presetUnk4 != 0) {
stubbed_printf("DAC:Lost 1 Frame.\n");
return NULL;
}
osSendMesg(OSMesgQueues[0], (OSMesg) gAudioFrameCount, 0);
gAudioTaskIndex ^= 1;
gCurrAiBufferIndex++;
gCurrAiBufferIndex %= NUMAIBUFFERS;
index = (gCurrAiBufferIndex - 2 + NUMAIBUFFERS) % NUMAIBUFFERS;
samplesRemainingInAI = osAiGetLength() / 4;
if (gAiBufferLengths[index] != 0) {
osAiSetNextBuffer(gAiBuffers[index], gAiBufferLengths[index] * 4);
}
oldDmaCount = gCurrAudioFrameDmaCount;
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE) {
stubbed_printf("DMA: Request queue over.( %d )\n", oldDmaCount);
}
gCurrAudioFrameDmaCount = 0;
decrease_sample_dma_ttls();
if (osRecvMesg(OSMesgQueues[2], &sp30, 0) != -1) {
gAudioResetPresetIdToLoad = (u8) (s32) sp30;
gAudioResetStatus = 5;
}
if (gAudioResetStatus != 0) {
if (func_eu_802E2AA0() == 0) {
if (gAudioResetStatus == 0) {
osSendMesg(OSMesgQueues[3], (OSMesg) (s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
}
return NULL;
}
}
gAudioTask = &gAudioTasks[gAudioTaskIndex];
gAudioCmd = gAudioCmdBuffers[gAudioTaskIndex];
index = gCurrAiBufferIndex;
currAiBuffer = gAiBuffers[index];
gAiBufferLengths[index] = ((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI +
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE;
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
gAiBufferLengths[index] = gAudioBufferParameters.minAiBufferLength;
}
if (gAiBufferLengths[index] > gAudioBufferParameters.maxAiBufferLength) {
gAiBufferLengths[index] = gAudioBufferParameters.maxAiBufferLength;
}
if (osRecvMesg(OSMesgQueues[1], &sp2C, OS_MESG_NOBLOCK) != -1) {
func_802ad7ec((u32) sp2C);
}
flags = 0;
gAudioCmd = synthesis_execute(gAudioCmd, &writtenCmds, currAiBuffer, gAiBufferLengths[index]);
gAudioRandom = ((gAudioRandom + gAudioFrameCount) * gAudioFrameCount);
gAudioRandom = gAudioRandom + writtenCmds / 8;
index = gAudioTaskIndex;
gAudioTask->msgqueue = NULL;
gAudioTask->msg = NULL;
task = &gAudioTask->task.t;
task->type = M_AUDTASK;
task->flags = flags;
task->ucode_boot = rspF3DBootStart;
task->ucode_boot_size = (u8 *) rspF3DBootEnd - (u8 *) rspF3DBootStart;
task->ucode = rspAspMainStart;
task->ucode_data = rspAspMainDataStart;
task->ucode_size = 0x800; // (this size is ignored)
task->ucode_data_size = (rspAspMainDataEnd - rspAspMainDataStart) * sizeof(u64);
task->dram_stack = NULL;
task->dram_stack_size = 0;
task->output_buff = NULL;
task->output_buff_size = NULL;
task->data_ptr = gAudioCmdBuffers[index];
task->data_size = writtenCmds * sizeof(u64);
task->yield_data_ptr = NULL;
task->yield_data_size = 0;
return gAudioTask;
}
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
s32 i;
switch (cmd->u.s.op) {
case 0x81:
preload_sequence(cmd->u.s.arg2, 3);
break;
case 0x82:
case 0x88:
// load_sequence(arg1, arg2, 0);
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
break;
case 0x83:
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
if (cmd->u2.as_s32 == 0) {
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
}
else {
sequence_player_fade_out_internal(cmd->u.s.arg1, cmd->u2.as_s32);
}
}
break;
case 0xf0:
gSoundMode = cmd->u2.as_s32;
break;
case 0xf1:
for (i = 0; i < 4; i++) {
gSequencePlayers[i].muted = TRUE;
gSequencePlayers[i].unk_eu = TRUE;
}
break;
case 0xf2:
for (i = 0; i < 4; i++) {
gSequencePlayers[i].muted = FALSE;
gSequencePlayers[i].unk_eu = TRUE;
}
break;
}
}
const char undefportcmd[] = "Undefined Port Command %d\n";
extern OSMesgQueue *OSMesgQueues[];
extern u8 D_EU_80302010;
extern u8 D_EU_80302014;
extern OSMesg OSMesg0;
extern OSMesg OSMesg1;
extern OSMesg OSMesg2;
extern OSMesg OSMesg3;
void sequence_player_fade_out_internal(s32 player, FadeT fadeOutTime) {
if (fadeOutTime == 0) {
fadeOutTime = 1;
}
gSequencePlayers[player].fadeVelocity = -(gSequencePlayers[player].fadeVolume / fadeOutTime);
gSequencePlayers[player].state = 2;
gSequencePlayers[player].fadeTimer = fadeOutTime;
}
void func_8031D690(s32 player, FadeT fadeInTime) {
if (fadeInTime != 0) {
gSequencePlayers[player].state = 1;
gSequencePlayers[player].fadeTimerUnkEu = fadeInTime;
gSequencePlayers[player].fadeTimer = fadeInTime;
gSequencePlayers[player].fadeVolume = 0.0f;
gSequencePlayers[player].fadeVelocity = 0.0f;
}
}
void func_802ad668(void) {
D_EU_80302010 = 0;
D_EU_80302014 = 0;
osCreateMesgQueue(OSMesgQueues[0], &OSMesg0, 1);
osCreateMesgQueue(OSMesgQueues[1], &OSMesg1, 4);
osCreateMesgQueue(OSMesgQueues[2], &OSMesg2, 1);
osCreateMesgQueue(OSMesgQueues[3], &OSMesg3, 1);
}
void func_802ad6f0(s32 arg0, s32 *arg1) {
struct EuAudioCmd *cmd = &sAudioCmd[D_EU_80302010 & 0xff];
cmd->u.first = arg0;
cmd->u2.as_u32 = *arg1;
D_EU_80302010++;
}
void func_802ad728(u32 arg0, f32 arg1) {
func_802ad6f0(arg0, (s32*) &arg1);
}
void func_802ad74c(u32 arg0, u32 arg1) {
func_802ad6f0(arg0, (s32*) &arg1);
}
void func_802ad770(u32 arg0, s8 arg1) {
s32 sp1C = arg1 << 24;
func_802ad6f0(arg0, &sp1C);
}
void func_802ad7a0(void) {
osSendMesg(OSMesgQueues[1],
(OSMesg)(u32)((D_EU_80302014 & 0xff) << 8 | (D_EU_80302010 & 0xff)),
OS_MESG_NOBLOCK);
D_EU_80302014 = D_EU_80302010;
}
void func_802ad7ec(u32 arg0) {
struct EuAudioCmd *cmd;
struct SequencePlayer *seqPlayer;
struct SequenceChannel *chan;
u8 end = arg0 & 0xff;
u8 i = (arg0 >> 8) & 0xff;
for (;;) {
if (i == end) break;
cmd = &sAudioCmd[i++ & 0xff];
if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) {
seqPlayer = &gSequencePlayers[cmd->u.s.arg1];
if ((cmd->u.s.op & 0x80) != 0) {
eu_process_audio_cmd(cmd);
}
else if ((cmd->u.s.op & 0x40) != 0) {
switch (cmd->u.s.op) {
case 0x41:
seqPlayer->unkEu28 = cmd->u2.as_f32;
seqPlayer->unk_eu = TRUE;
break;
case 0x47:
seqPlayer->tempo = cmd->u2.as_s32 * TATUMS_PER_BEAT;
break;
case 0x48:
seqPlayer->transposition = cmd->u2.as_s8;
break;
case 0x46:
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
break;
}
}
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
chan = seqPlayer->channels[cmd->u.s.arg2];
if (IS_SEQUENCE_CHANNEL_VALID(chan))
{
switch (cmd->u.s.op) {
case 1:
chan->volumeScale = cmd->u2.as_f32;
chan->unk1.as_bitfields.unk0b40 = TRUE;
break;
case 2:
chan->volume = cmd->u2.as_f32;
chan->unk1.as_bitfields.unk0b40 = TRUE;
break;
case 3:
chan->unk9 = cmd->u2.as_s8;
chan->unk1.as_bitfields.unk0b20 = TRUE;
break;
case 4:
chan->freqScale = cmd->u2.as_f32;
chan->unk1.as_bitfields.unk0b80 = TRUE;
break;
case 5:
chan->reverb = cmd->u2.as_s8;
break;
case 6:
if (cmd->u.s.arg3 < 8) {
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
}
break;
case 8:
chan->stopSomething2 = cmd->u2.as_s8;
}
}
}
}
cmd->u.s.op = 0;
}
}
void func_802ada64(void) {
func_802ad668();
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,11 @@
#define DEFAULT_LEN_1CH 0x140
#define DEFAULT_LEN_2CH 0x280
#ifdef VERSION_EU
#define MAX_UPDATES_PER_FRAME 5
#else
#define MAX_UPDATES_PER_FRAME 4
#endif
struct ReverbRingBufferItem
{
@@ -20,33 +24,52 @@ struct ReverbRingBufferItem
struct SynthesisReverb
{
u8 resampleFlags;
u8 useReverb;
u8 framesLeftToIgnore;
u8 curFrame;
u16 reverbGain;
u16 resampleRate;
s32 nextRingBufferPos;
s32 unkC; // never read
s32 bufSizePerChannel;
/*0x00, 0x00*/ u8 resampleFlags;
/*0x01, 0x01*/ u8 useReverb;
/*0x02, 0x02*/ u8 framesLeftToIgnore;
/*0x03, 0x03*/ u8 curFrame;
#ifdef VERSION_EU
/* 0x04*/ u8 downsampleRate;
/* 0x06*/ u16 windowSize; // same as bufSizePerChannel
#endif
/*0x04, 0x08*/ u16 reverbGain;
/*0x06, 0x0A*/ u16 resampleRate;
/*0x08, 0x0C*/ s32 nextRingBufferPos;
/*0x0C, 0x10*/ s32 unkC; // never read
/*0x10, 0x14*/ s32 bufSizePerChannel;
struct
{
s16 *left;
s16 *right;
} ringBuffer;
s16 *resampleStateLeft;
s16 *resampleStateRight;
s16 *unk24; // never read
s16 *unk28; // never read
struct ReverbRingBufferItem items[2][MAX_UPDATES_PER_FRAME];
/*0x1C, 0x20*/ s16 *resampleStateLeft;
/*0x20, 0x24*/ s16 *resampleStateRight;
/*0x24, 0x28*/ s16 *unk24; // never read
/*0x28, 0x2C*/ s16 *unk28; // never read
/*0x2C, 0x30*/ struct ReverbRingBufferItem items[2][MAX_UPDATES_PER_FRAME];
#ifdef VERSION_EU
u8 pad[16];
#endif
}; // 0xCC <= size <= 0x100
#if defined(VERSION_EU)
extern struct SynthesisReverb gSynthesisReverbs[4];
extern s8 gNumSynthesisReverbs;
extern struct NoteSubEu *gNoteSubsEu;
extern f32 gLeftVolRampings[3][1024];
extern f32 gRightVolRampings[3][1024];
extern f32 *gCurrentLeftVolRamping; // Points to any of the three left buffers above
extern f32 *gCurrentRightVolRamping; // Points to any of the three right buffers above
#else
extern struct SynthesisReverb gSynthesisReverb;
#endif
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen);
#ifndef VERSION_EU
void note_init_volume(struct Note *note);
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverb);
void note_set_frequency(struct Note *note, f32 frequency);
void note_enable(struct Note *note);
void note_disable(struct Note *note);
#endif
#endif /* AUDIO_SYNTHESIS_H */

View File

@@ -3,8 +3,25 @@
#include "buffers.h"
ALIGNED8 u8 gDecompressionHeap[0xD000];
#ifdef VERSION_EU
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200) - 0x3800];
#else
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200)];
#endif
ALIGNED8 u8 gIdleThreadStack[0x800];
ALIGNED8 u8 gThread3Stack[0x2000];
ALIGNED8 u8 gThread4Stack[0x2000];
ALIGNED8 u8 gThread5Stack[0x2000];
// 0x400 bytes
ALIGNED8 u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
// 0xc00 bytes for f3dex, 0x900 otherwise
ALIGNED8 u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
// 0x200 bytes
ALIGNED8 struct SaveBuffer gSaveBuffer;
// 0x190a0 bytes
struct GfxPool gGfxPools[2];
// Yield buffer for audio, 0x400 bytes. Stubbed out post-JP since the audio
// task never yields.
@@ -14,23 +31,11 @@ ALIGNED8 u8 gAudioSPTaskYieldBuffer[OS_YIELD_AUDIO_SIZE];
// Probably Thread 2 stack space. Unreferenced, and stubbed out with f3dex to
// avoid an overflowing .buffers segment.
#ifndef F3DEX_GBI_SHARED
#if !defined(F3DEX_GBI_SHARED) && !defined(VERSION_EU)
ALIGNED8 u8 gUnusedThread2Stack[0x1400];
#endif
ALIGNED8 u8 gIdleThreadStack[0x800];
ALIGNED8 u8 gThread3Stack[0x2000];
ALIGNED8 u8 gThread4Stack[0x2000];
ALIGNED8 u8 gThread5Stack[0x2000];
// 0xc00 bytes for f3dex, 0x900 otherwise
ALIGNED8 u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
// 0x200 bytes
ALIGNED8 struct SaveBuffer gSaveBuffer;
// 0x400 bytes
ALIGNED8 u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
// 0x190a0 bytes
struct GfxPool gGfxPools[2];

View File

@@ -44,6 +44,7 @@ GeoLayoutCommandProc GeoLayoutJumpTable[] = {
geo_layout_cmd_node_culling_radius,
};
struct GraphNode gObjParentGraphNode;
struct AllocOnlyPool *gGraphNodePool;
struct GraphNode *gCurRootGraphNode;
@@ -98,7 +99,6 @@ s16 gGeoLayoutStackIndex; // similar to SP register in MIPS
UNUSED s16 D_8038BD7C;
s16 gGeoLayoutReturnIndex; // similar to RA register in MIPS
u8 *gGeoLayoutCommand;
struct GraphNode gObjParentGraphNode;
u32 unused_8038B894[3] = { 0 };

Some files were not shown because too many files have changed in this diff Show More