mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
More audio fixes
by djoslin0 and theclashingfritz
This commit is contained in:
parent
bd247372ef
commit
25fe547113
5 changed files with 42 additions and 46 deletions
|
@ -4,12 +4,14 @@ Developers:
|
|||
FluffaLuigi
|
||||
kebabstorm
|
||||
MegaMech
|
||||
theclashingfritz
|
||||
|
||||
Contributors:
|
||||
AloXado320
|
||||
anzz1
|
||||
Avery
|
||||
Cameron Hall
|
||||
camthesaxman
|
||||
charity
|
||||
Cjes
|
||||
DorfDork
|
||||
|
@ -18,7 +20,7 @@ Contributors:
|
|||
eros71
|
||||
Filipianosol
|
||||
GammaTendonNine
|
||||
kebabstorm
|
||||
gunvalk
|
||||
Llennpie
|
||||
LuigiNoodle
|
||||
PeachyPeach
|
||||
|
@ -28,7 +30,6 @@ Contributors:
|
|||
steven.
|
||||
SunlitSpace542
|
||||
Super Keeberghrh
|
||||
theclashingfritz
|
||||
TheGag96
|
||||
Victor Diego Alejandro Diaz Urbaneja
|
||||
|
||||
|
|
|
@ -58,33 +58,33 @@ struct AudioSessionSettingsEU gAudioSessionPresets[] = {
|
|||
#ifndef VERSION_EU
|
||||
struct AudioSessionSettings gAudioSessionPresets[18] = {
|
||||
#ifdef VERSION_JP
|
||||
{ 32000, 32, 1, 0x0800, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x1000, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x0800, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 40, 1, 0x0800, 0x37FF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
|
||||
{ 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
|
||||
{ 32000, 16, 1, 0x1000, 0x2FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
|
||||
{ 32000, 16, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
|
||||
{ 32000, 16, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
|
||||
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x3E00, 0x6200, 0x3F00, 0x2A00 },
|
||||
{ 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x3F00, 0x6200, 0x4400, 0x2A80 },
|
||||
{ 32000, 20, 1, 0x0800, 0x37FF, 0x7FFF, 0x3300, 0x5500, 0x4000, 0x1B00 },
|
||||
#else
|
||||
{ 32000, 32, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x1000, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 32, 1, 0x0A00, 0x47FF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 40, 1, 0x0800, 0x37FF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 16, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x7400, 0xCC00, 0x7400, 0x7400 },
|
||||
{ 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7400, 0xCC00, 0x7400, 0x7400 },
|
||||
{ 32000, 16, 1, 0x1000, 0x2FFF, 0x7FFF, 0x7400, 0xCC00, 0x7400, 0x7400 },
|
||||
{ 32000, 16, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x7400, 0xCC00, 0x7400, 0x7400 },
|
||||
{ 32000, 16, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x7400, 0xCC00, 0x7400, 0x7400 },
|
||||
{ 32000, 16, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x7400, 0xCC00, 0x7400, 0x7400 },
|
||||
{ 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x7400, 0xCC00, 0x7400, 0x7400 },
|
||||
{ 32000, 20, 1, 0x0800, 0x37FF, 0x7FFF, 0x7400, 0xCC00, 0x7400, 0x7400 },
|
||||
#endif
|
||||
{ 27000, 32, 1, 0x0800, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 27000, 32, 1, 0x0800, 0x3FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 27000, 32, 1, 0x1000, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 27000, 32, 1, 0x1000, 0x3FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 27000, 32, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 28, 1, 0x0800, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 24, 1, 0x0800, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 20, 1, 0x0800, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x0000E800, 0x0000E800, 0x0000E800, 0x0000E800 },
|
||||
{ 27000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 },
|
||||
{ 27000, 16, 1, 0x0800, 0x3FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 },
|
||||
{ 27000, 16, 1, 0x1000, 0x2FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 },
|
||||
{ 27000, 16, 1, 0x1000, 0x3FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 },
|
||||
{ 27000, 16, 1, 0x0C00, 0x4FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 },
|
||||
{ 32000, 14, 1, 0x0800, 0x2FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 },
|
||||
{ 32000, 12, 1, 0x0800, 0x2FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 },
|
||||
{ 32000, 10, 1, 0x0800, 0x2FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 },
|
||||
{ 32000, 8, 1, 0x0800, 0x2FFF, 0x7FFF, 0x7400, 0x7400, 0x7400, 0x7400 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -110,11 +110,11 @@ extern u32 gAudioRandom;
|
|||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
#define UNUSED_COUNT_80333EE8 24
|
||||
#define AUDIO_HEAP_BASE 0x36B00
|
||||
#define AUDIO_HEAP_BASE 0x96B00
|
||||
#define AUDIO_INIT_POOL_SIZE (0x2c00 + EXT_AUDIO_INIT_POOL_SIZE)
|
||||
#else
|
||||
#define UNUSED_COUNT_80333EE8 16
|
||||
#define AUDIO_HEAP_BASE 0x31150
|
||||
#define AUDIO_HEAP_BASE 0x8AED0
|
||||
#define AUDIO_INIT_POOL_SIZE (0x2500 + EXT_AUDIO_INIT_POOL_SIZE)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size) {
|
|||
bzero(start, alignedSize);
|
||||
pool->cur += alignedSize;
|
||||
} else {
|
||||
fprintf(stderr, "soundAlloc failed: tried to alloc %u bytes (%i free)\n", ALIGN16(size), pool->start + pool->size - pool->cur);
|
||||
fprintf(stderr, "soundAlloc failed: tried to alloc %u bytes at %p (%i free)\n", ALIGN16(size), (void*)pool, pool->start + pool->size - pool->cur);
|
||||
return NULL;
|
||||
}
|
||||
pool->numAllocatedEntries++;
|
||||
|
@ -221,7 +221,7 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size) {
|
|||
bzero(start, alignedSize);
|
||||
pool->cur += alignedSize;
|
||||
} else {
|
||||
fprintf(stderr, "soundAlloc failed: tried to alloc %u bytes (%i free)\n", (unsigned int)ALIGN16(size), (int)(pool->start + pool->size - pool->cur));
|
||||
fprintf(stderr, "soundAlloc failed: tried to alloc %u bytes at %p (%i free)\n", (unsigned int)ALIGN16(size), (void*)pool, (int)(pool->start + pool->size - pool->cur));
|
||||
return NULL;
|
||||
}
|
||||
return start;
|
||||
|
|
|
@ -46,7 +46,9 @@ OSMesgQueue gAudioDmaMesgQueue;
|
|||
OSMesg gAudioDmaMesg;
|
||||
OSIoMesg gAudioDmaIoMesg;
|
||||
|
||||
struct SharedDma sSampleDmas[0x60];
|
||||
#define SAMPLE_DMA_COUNT 0x90
|
||||
|
||||
struct SharedDma sSampleDmas[SAMPLE_DMA_COUNT];
|
||||
u32 gSampleDmaNumListItems;
|
||||
u32 sSampleDmaListSize1;
|
||||
u32 sUnused80226B40; // set to 0, never read
|
||||
|
@ -291,19 +293,12 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3) {
|
|||
}
|
||||
|
||||
void init_sample_dma_buffers(UNUSED s32 arg0) {
|
||||
s32 i;
|
||||
#ifdef VERSION_EU
|
||||
#define j i
|
||||
#else
|
||||
s32 j;
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
sDmaBufSize = 0x400 * 4;
|
||||
for (i = 0; i < gMaxSimultaneousNotes * 3 * gAudioBufferParameters.presetUnk4; i++) {
|
||||
for (s32 i = 0; i < gMaxSimultaneousNotes * 3 * gAudioBufferParameters.presetUnk4; i++) {
|
||||
#else
|
||||
sDmaBufSize = (144 * 9) * 4;
|
||||
for (i = 0; i < gMaxSimultaneousNotes * 3; i++) {
|
||||
for (s32 i = 0; i < gMaxSimultaneousNotes * 3; i++) {
|
||||
#endif
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, sDmaBufSize);
|
||||
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
|
||||
|
@ -324,12 +319,12 @@ void init_sample_dma_buffers(UNUSED s32 arg0) {
|
|||
out1:
|
||||
#endif
|
||||
|
||||
for (i = 0; (u32) i < gSampleDmaNumListItems; i++) {
|
||||
for (s32 i = 0; (u32) i < gSampleDmaNumListItems; i++) {
|
||||
sSampleDmaReuseQueue1[i] = (u8) i;
|
||||
sSampleDmas[i].reuseIndex = (u8) i;
|
||||
}
|
||||
|
||||
for (j = gSampleDmaNumListItems; j < 0x100; j++) {
|
||||
for (s32 j = gSampleDmaNumListItems; j < 0x100; j++) {
|
||||
sSampleDmaReuseQueue1[j] = 0;
|
||||
}
|
||||
|
||||
|
@ -342,7 +337,7 @@ out1:
|
|||
#else
|
||||
sDmaBufSize = (160 * 9) * 4;
|
||||
#endif
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
for (s32 i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, sDmaBufSize);
|
||||
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
|
||||
#ifdef VERSION_EU
|
||||
|
@ -362,14 +357,14 @@ out1:
|
|||
out2:
|
||||
#endif
|
||||
|
||||
for (i = sSampleDmaListSize1; (u32) i < gSampleDmaNumListItems; i++) {
|
||||
for (s32 i = sSampleDmaListSize1; (u32) i < gSampleDmaNumListItems; i++) {
|
||||
sSampleDmaReuseQueue2[i - sSampleDmaListSize1] = (u8) i;
|
||||
sSampleDmas[i].reuseIndex = (u8)(i - sSampleDmaListSize1);
|
||||
}
|
||||
|
||||
// This probably meant to touch the range size1..size2 as well... but it
|
||||
// doesn't matter, since these values are never read anyway.
|
||||
for (j = gSampleDmaNumListItems; j < 0x100; j++) {
|
||||
for (s32 j = gSampleDmaNumListItems; j < 0x100; j++) {
|
||||
sSampleDmaReuseQueue2[j] = sSampleDmaListSize1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue