mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-14 10:37:17 -07:00
Updated zapd_audio_support into zelda64
This commit is contained in:
commit
5b43e4652f
24 changed files with 1884 additions and 218 deletions
|
@ -1,7 +1,7 @@
|
|||
<Root>
|
||||
<File Name="code" OutName="audio" RangeStart="0x0" RangeEnd="0x12CBB0">
|
||||
<Audio Name="audio" Offset="0x00">
|
||||
<Sequences>
|
||||
<Audio Name="audio" Offset="0x00" SoundFontTableOffset="0x138290" SequenceTableOffset="0x1386C0" SampleBankTableOffset="0x138DB0" SequenceFontTableOffset="0x138500">
|
||||
<Sequences>
|
||||
<Sequence Name="000_Sound_Effects"/>
|
||||
<Sequence Name="001_Ambient_Effects"/>
|
||||
<Sequence Name="002_Hyrule_Field_Program"/>
|
||||
|
@ -113,8 +113,6 @@
|
|||
<Sequence Name="108_Timed_Minigame"/>
|
||||
<Sequence Name="109_Cutscene_Effects"/>
|
||||
</Sequences>
|
||||
|
||||
|
||||
<Samples Bank="0">
|
||||
<Sample Name="Bird Chirp 1">
|
||||
<Offset Version="MQDebug" At="0"/>
|
||||
|
@ -1171,7 +1169,7 @@
|
|||
</Sample>
|
||||
</Samples>
|
||||
<Samples Bank="1">
|
||||
<Sample Name="Ocarina">
|
||||
<Sample Name="Ocarina_Bank1">
|
||||
<Offset Version="MQDebug" At="0xFAD40"/>
|
||||
</Sample>
|
||||
<Sample Name="Accordion">
|
||||
|
@ -1433,7 +1431,7 @@
|
|||
<Offset Version="MQDebug" At="0"/>
|
||||
</Sample>
|
||||
</Samples>
|
||||
|
||||
|
||||
<Samples Bank="3">
|
||||
<Sample Name="Low Rumbling">
|
||||
<Offset Version="MQDebug" At="0"/>
|
||||
|
@ -1450,72 +1448,107 @@
|
|||
<Sample Name="Organic Gurgling">
|
||||
<Offset Version="MQDebug" At="0x16480"/>
|
||||
</Sample>
|
||||
</Samples>
|
||||
<Samples Bank="4">
|
||||
<Sample Name="Vocal Ohs">
|
||||
<Offset Version="MQDebug" At="0"/>
|
||||
</Sample>
|
||||
<Sample Name="Flute and Voice">
|
||||
<Offset Version="MQDebug" At="0x6410"/>
|
||||
</Sample>
|
||||
<Sample Name="Off-Kilter Flute">
|
||||
<Offset Version="MQDebug" At="0x72D0"/>
|
||||
</Sample>
|
||||
<Sample Name="Voice">
|
||||
<Offset Version="MQDebug" At="0x8230"/>
|
||||
</Sample>
|
||||
<Sample Name="Melodic Wooden Clacking">
|
||||
<Offset Version="MQDebug" At="0x9030"/>
|
||||
</Sample>
|
||||
</Samples>
|
||||
</Samples>
|
||||
<Samples Bank="4">
|
||||
<Sample Name="Vocal Ohs">
|
||||
<Offset Version="MQDebug" At="0"/>
|
||||
</Sample>
|
||||
<Sample Name="Flute and Voice">
|
||||
<Offset Version="MQDebug" At="0x6410"/>
|
||||
</Sample>
|
||||
<Sample Name="Off-Kilter Flute">
|
||||
<Offset Version="MQDebug" At="0x72D0"/>
|
||||
</Sample>
|
||||
<Sample Name="Voice">
|
||||
<Offset Version="MQDebug" At="0x8230"/>
|
||||
</Sample>
|
||||
<Sample Name="Melodic Wooden Clacking">
|
||||
<Offset Version="MQDebug" At="0x9030"/>
|
||||
</Sample>
|
||||
</Samples>
|
||||
|
||||
<Samples Bank="5">
|
||||
<Sample Name="Goron Drum">
|
||||
<Offset Version="MQDebug" At="0"/>
|
||||
</Sample>
|
||||
<Sample Name="Bass Slap">
|
||||
<Offset Version="MQDebug" At="0x2540"/>
|
||||
</Sample>
|
||||
<Sample Name="Goron Ooh">
|
||||
<Offset Version="MQDebug" At="0x4800"/>
|
||||
</Sample>
|
||||
<Sample Name="Goron Ooh (High)">
|
||||
<Offset Version="MQDebug" At="0x72D0"/>
|
||||
</Sample>
|
||||
<Sample Name="Tom Drum">
|
||||
<Offset Version="MQDebug" At="0x7B70"/>
|
||||
</Sample>
|
||||
<Sample Name="Resonant Bass Marimba">
|
||||
<Offset Version="MQDebug" At="0x8630"/>
|
||||
</Sample>
|
||||
</Samples>
|
||||
<Samples Bank="5">
|
||||
<Sample Name="Goron Drum">
|
||||
<Offset Version="MQDebug" At="0"/>
|
||||
</Sample>
|
||||
<Sample Name="Bass Slap">
|
||||
<Offset Version="MQDebug" At="0x2540"/>
|
||||
</Sample>
|
||||
<Sample Name="Goron Ooh">
|
||||
<Offset Version="MQDebug" At="0x4800"/>
|
||||
</Sample>
|
||||
<Sample Name="Goron Ooh (High)">
|
||||
<Offset Version="MQDebug" At="0x72D0"/>
|
||||
</Sample>
|
||||
<Sample Name="Tom Drum">
|
||||
<Offset Version="MQDebug" At="0x7B70"/>
|
||||
</Sample>
|
||||
<Sample Name="Resonant Bass Marimba">
|
||||
<Offset Version="MQDebug" At="0x8630"/>
|
||||
</Sample>
|
||||
</Samples>
|
||||
|
||||
<Samples Bank="6">
|
||||
<Sample Name="Warm Synth Pad">
|
||||
<Offset Version="MQDebug" At="0"/>
|
||||
</Sample>
|
||||
<Sample Name="Egyptian Flute">
|
||||
<Offset Version="MQDebug" At="0xB0D0"/>
|
||||
</Sample>
|
||||
<Sample Name="Tom Drum">
|
||||
<Offset Version="MQDebug" At="0xE120"/>
|
||||
</Sample>
|
||||
<Sample Name="Vocal Synth">
|
||||
<Offset Version="MQDebug" At="0x103E0"/>
|
||||
</Sample>
|
||||
<Sample Name="Gong">
|
||||
<Offset Version="MQDebug" At="0x12EB0"/>
|
||||
</Sample>
|
||||
<Sample Name="Bass Slap">
|
||||
<Offset Version="MQDebug" At="0x1D3E0"/>
|
||||
</Sample>
|
||||
<Sample Name="Windchimes">
|
||||
<Offset Version="MQDebug" At="0x22EE0"/>
|
||||
</Sample>
|
||||
</Samples>
|
||||
|
||||
|
||||
|
||||
<Samples Bank="6">
|
||||
<Sample Name="Warm Synth Pad">
|
||||
<Offset Version="MQDebug" At="0"/>
|
||||
</Sample>
|
||||
<Sample Name="Egyptian Flute">
|
||||
<Offset Version="MQDebug" At="0xB0D0"/>
|
||||
</Sample>
|
||||
<Sample Name="Tom Drum">
|
||||
<Offset Version="MQDebug" At="0xE120"/>
|
||||
</Sample>
|
||||
<Sample Name="Vocal Synth">
|
||||
<Offset Version="MQDebug" At="0x103E0"/>
|
||||
</Sample>
|
||||
<Sample Name="Gong">
|
||||
<Offset Version="MQDebug" At="0x12EB0"/>
|
||||
</Sample>
|
||||
<Sample Name="Bass Slap">
|
||||
<Offset Version="MQDebug" At="0x1D3E0"/>
|
||||
</Sample>
|
||||
<Sample Name="Windchimes">
|
||||
<Offset Version="MQDebug" At="0x22EE0"/>
|
||||
</Sample>
|
||||
</Samples>
|
||||
<Soundfont Name="02_Ambient_Sounds" Index="2"/>
|
||||
<Soundfont Name="37_Unused_Deku_Tree" Index="37" OverrideSampleBank="2"/>
|
||||
<Soundfont Name="04_Deku_Tree" Index="4"/>
|
||||
<Soundfont Name="11_Dodongos_Cavern" Index="11"/>
|
||||
<Soundfont Name="33_Ending_1" Index="33"/>
|
||||
<Soundfont Name="34_Ending_2" Index="34"/>
|
||||
<Soundfont Name="09_Fairy_Fountain" Index="9"/>
|
||||
<Soundfont Name="10_Fire_Temple" Index="10"/>
|
||||
<Soundfont Name="12_Forest_Temple" Index="12"/>
|
||||
<Soundfont Name="35_Game_Over" Index="35"/>
|
||||
<Soundfont Name="30_Ganons_Castle_Organ" Index="30"/>
|
||||
<Soundfont Name="31_Ganons_Castle" Index="31"/>
|
||||
<Soundfont Name="32_Ganondorfs_Battle" Index="32"/>
|
||||
<Soundfont Name="27_Gerudo_Valley" Index="27"/>
|
||||
<Soundfont Name="14_Goron_City" Index="14"/>
|
||||
<Soundfont Name="17_Horse_Race" Index="17"/>
|
||||
<Soundfont Name="23_Ice_Cavern" Index="23"/>
|
||||
<Soundfont Name="07_Jabu_Jabu" Index="7"/>
|
||||
<Soundfont Name="36_Kaepora_Gaeboras_Theme" Index="36"/>
|
||||
<Soundfont Name="08_Child_Kakariko_Village" Index="8"/>
|
||||
<Soundfont Name="15_Kokiri_Forest" Index="15"/>
|
||||
<Soundfont Name="29_Kotake_and_Koumes_Theme" Index="29"/>
|
||||
<Soundfont Name="28_Lakeside_Laboratory" Index="28"/>
|
||||
<Soundfont Name="19_Legends_of_Hyrule" Index="19"/>
|
||||
<Soundfont Name="13_Lon_Lon_Ranch" Index="13"/>
|
||||
<Soundfont Name="05_Market" Index="5"/>
|
||||
<Soundfont Name="20_Minigames" Index="20"/>
|
||||
<Soundfont Name="03_Orchestra" Index="3"/>
|
||||
<Soundfont Name="24_Shadow_Temple" Index="24"/>
|
||||
<Soundfont Name="22_Shops" Index="22"/>
|
||||
<Soundfont Name="00_Sound_Effects_1" Index="0" Symbol="gSoundEffectsFont1"/>
|
||||
<Soundfont Name="01_Sound_Effects_2" Index="1" Symbol="gSoundEffectsFont2"/>
|
||||
<Soundfont Name="16_Spirit_Temple" Index="16"/>
|
||||
<Soundfont Name="06_Title_Theme" Index="6"/>
|
||||
<Soundfont Name="26_Unused" Index="26"/>
|
||||
<Soundfont Name="18_Warp_Songs" Index="18"/>
|
||||
<Soundfont Name="25_Water_Temple" Index="25"/>
|
||||
<Soundfont Name="21_Zoras_Domain" Index="21"/>
|
||||
</Audio>
|
||||
</File>
|
||||
</Root>
|
||||
</Root>
|
File diff suppressed because it is too large
Load diff
|
@ -32,9 +32,9 @@
|
|||
|
||||
#if defined(_WIN64) || defined(__x86_64__) || defined(__arm64__)
|
||||
#define _SOH64
|
||||
#define AUDIO_HEAP_SIZE 0xF0000
|
||||
#define AUDIO_HEAP_SIZE 0x3800000
|
||||
#else
|
||||
#define AUDIO_HEAP_SIZE 0x38000
|
||||
#define AUDIO_HEAP_SIZE 0x3800000
|
||||
#endif
|
||||
|
||||
#define SYSTEM_HEAP_SIZE (1024 * 1024 * 4)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define CALC_RESAMPLE_FREQ(sampleRate) ((float)sampleRate / (s32)gAudioContext.audioBufferParameters.frequency)
|
||||
|
||||
extern bool gUseLegacySD;
|
||||
extern char* fontMap[256];
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ ADSR_STATE_DISABLED,
|
||||
|
@ -124,8 +125,7 @@ typedef struct {
|
|||
/* 0x08 */ s16 book[1]; // size 8 * order * npredictors. 8-byte aligned
|
||||
} AdpcmBook; // size >= 0x8
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
/* 0x00 */ u32 codec : 4;
|
||||
|
@ -233,6 +233,7 @@ typedef struct {
|
|||
/* 0x08 */ Instrument** instruments;
|
||||
/* 0x0C */ Drum** drums;
|
||||
/* 0x10 */ SoundFontSound* soundEffects;
|
||||
s32 fntIndex;
|
||||
} SoundFont; // size = 0x14
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -338,7 +338,6 @@ extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize)
|
|||
str[lst.get()[0][i].size()] = '\0';
|
||||
result[i] = str;
|
||||
}
|
||||
|
||||
*resultSize = lst->size();
|
||||
|
||||
return result;
|
||||
|
@ -567,20 +566,8 @@ extern "C" Vtx* ResourceMgr_LoadVtxByName(const char* path)
|
|||
return (Vtx*)res->vertices.data();
|
||||
}
|
||||
|
||||
extern "C" SequenceData ResourceMgr_LoadSeqByID(int seqID) {
|
||||
|
||||
if (seqID == 0xFF) {
|
||||
SequenceData sDat;
|
||||
sDat.numFonts = 0;
|
||||
|
||||
return sDat;
|
||||
}
|
||||
|
||||
std::string fmtStr = "audio/sequences/seq_%02X";
|
||||
return ResourceMgr_LoadSeqByName(StringHelper::Sprintf(fmtStr.c_str(), seqID).c_str());
|
||||
}
|
||||
|
||||
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) {
|
||||
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path)
|
||||
{
|
||||
auto file = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(path).get();
|
||||
|
||||
char* data = file->buffer.get();
|
||||
|
@ -602,9 +589,8 @@ extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) {
|
|||
|
||||
std::map<std::string, SoundFontSample*> cachedCustomSFs;
|
||||
|
||||
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) {
|
||||
//auto str = StringHelper::Sprintf("audio/samples/sample_%08X", romOffset);
|
||||
|
||||
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path)
|
||||
{
|
||||
if (std::string(path) == "")
|
||||
return nullptr;
|
||||
|
||||
|
@ -618,7 +604,7 @@ extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) {
|
|||
|
||||
if (strem2[0] == 'R' && strem2[1] == 'I' && strem2[2] == 'F' && strem2[3] == 'F')
|
||||
{
|
||||
SoundFontSample* sampleC = new SoundFontSample;
|
||||
SoundFontSample* sampleC = (SoundFontSample*)malloc(sizeof(SoundFontSample));
|
||||
|
||||
*strem++; // RIFF
|
||||
*strem++; // size
|
||||
|
@ -653,10 +639,13 @@ extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) {
|
|||
if (sample == nullptr)
|
||||
return NULL;
|
||||
|
||||
if (sample->cachedGameAsset != nullptr) {
|
||||
if (sample->cachedGameAsset != nullptr)
|
||||
{
|
||||
SoundFontSample* sampleC = (SoundFontSample*)sample->cachedGameAsset;
|
||||
return (SoundFontSample*)sample->cachedGameAsset;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundFontSample* sampleC = (SoundFontSample*)malloc(sizeof(SoundFontSample));
|
||||
|
||||
sampleC->sampleAddr = sample->data.data();
|
||||
|
@ -690,10 +679,9 @@ extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) {
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(int fontIndex) {
|
||||
extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
||||
auto soundFont =
|
||||
std::static_pointer_cast<Ship::AudioSoundFont>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(
|
||||
StringHelper::Sprintf("audio/fonts/font_%02X", fontIndex)));
|
||||
std::static_pointer_cast<Ship::AudioSoundFont>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
|
||||
|
||||
if (soundFont == nullptr)
|
||||
return NULL;
|
||||
|
@ -706,6 +694,7 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(int fontIndex) {
|
|||
{
|
||||
SoundFont* soundFontC = (SoundFont*)malloc(sizeof(SoundFont));
|
||||
|
||||
soundFontC->fntIndex = soundFont->id;
|
||||
soundFontC->numDrums = soundFont->drums.size();
|
||||
soundFontC->numInstruments = soundFont->instruments.size();
|
||||
soundFontC->numSfx = soundFont->soundEffects.size();
|
||||
|
@ -796,8 +785,7 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(int fontIndex) {
|
|||
}
|
||||
|
||||
soundFontC->instruments[i] = inst;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
soundFontC->instruments[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,8 +50,7 @@ Gfx* ResourceMgr_PatchGfxByName(const char* path, int size);
|
|||
char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path);
|
||||
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
||||
Vtx* ResourceMgr_LoadVtxByName(const char* path);
|
||||
SoundFont* ResourceMgr_LoadAudioSoundFont(int fontIndex);
|
||||
SequenceData ResourceMgr_LoadSeqByID(int seqID);
|
||||
SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path);
|
||||
SequenceData ResourceMgr_LoadSeqByName(const char* path);
|
||||
SoundFontSample* ResourceMgr_LoadAudioSample(const char* path);
|
||||
CollisionHeader* ResourceMgr_LoadColByName(const char* path);
|
||||
|
|
|
@ -10,10 +10,10 @@ const s16 D_8014A6C0[] = {
|
|||
0x0030, // gTatumsPerBeat
|
||||
};
|
||||
|
||||
#ifdef _SOH64
|
||||
const AudioContextInitSizes D_8014A6C4 = { 0x57F00, 0x2E0E0, 0xFCE0 };
|
||||
#ifdef _SOH64 // OTRTODO: This might be overkill...
|
||||
const AudioContextInitSizes D_8014A6C4 = { 0x37F000, 0xE0E00, 0xBCE00 };
|
||||
#else
|
||||
const AudioContextInitSizes D_8014A6C4 = { 0x37F00, 0xE0E0, 0xBCE0 };
|
||||
const AudioContextInitSizes D_8014A6C4 = { 0x37F000, 0xE0E00, 0xBCE00 };
|
||||
#endif
|
||||
|
||||
ReverbSettings D_80133420[][3] = {
|
||||
|
|
|
@ -288,7 +288,6 @@ void AudioLoad_InitSampleDmaBuffers(s32 arg0) {
|
|||
|
||||
s32 AudioLoad_IsFontLoadComplete(s32 fontId) {
|
||||
return true;
|
||||
|
||||
if (fontId == 0xFF) {
|
||||
return true;
|
||||
|
||||
|
@ -390,7 +389,6 @@ SoundFontData* AudioLoad_SyncLoadSeqFonts(s32 seqId, u32* outDefaultFontId) {
|
|||
|
||||
while (numFonts > 0) {
|
||||
fontId = gAudioContext.sequenceFontTable[index++];
|
||||
|
||||
font = AudioLoad_SyncLoadFont(fontId);
|
||||
numFonts--;
|
||||
}
|
||||
|
@ -597,7 +595,9 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||
|
||||
numFonts--;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
SequenceData seqData2 = ResourceMgr_LoadSeqByName(sequenceMap[seqId]);
|
||||
|
||||
for (int i = 0; i < seqData2.numFonts; i++)
|
||||
|
@ -609,14 +609,12 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||
}
|
||||
|
||||
seqData = AudioLoad_SyncLoadSeq(seqId);
|
||||
|
||||
if (seqData == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioSeq_ResetSequencePlayer(seqPlayer);
|
||||
seqPlayer->seqId = seqId;
|
||||
|
||||
if (gUseLegacySD)
|
||||
seqPlayer->defaultFont = AudioLoad_GetRealTableIndex(FONT_TABLE, fontId);
|
||||
else
|
||||
|
@ -693,7 +691,8 @@ SoundFontData* AudioLoad_SyncLoadFont(u32 fontId) {
|
|||
}
|
||||
|
||||
if (!gUseLegacySD) {
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontId);
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont
|
||||
(fontMap[fontId]);
|
||||
|
||||
sampleBankId1 = sf->sampleBankId1;
|
||||
sampleBankId2 = sf->sampleBankId2;
|
||||
|
@ -748,20 +747,25 @@ uintptr_t AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
|
|||
char* seqData = 0;
|
||||
SoundFont* fnt;
|
||||
|
||||
if (!gUseLegacySD && tableType == SEQUENCE_TABLE) {
|
||||
if (!gUseLegacySD && tableType == SEQUENCE_TABLE)
|
||||
{
|
||||
SequenceData sData = ResourceMgr_LoadSeqByName(sequenceMap[id]);
|
||||
seqData = sData.seqData;
|
||||
size = sData.seqDataSize;
|
||||
medium = sData.medium;
|
||||
cachePolicy = sData.cachePolicy;
|
||||
romAddr = 0;
|
||||
} else if (!gUseLegacySD && tableType == FONT_TABLE) {
|
||||
fnt = ResourceMgr_LoadAudioSoundFont(id);
|
||||
}
|
||||
else if (!gUseLegacySD && tableType == FONT_TABLE)
|
||||
{
|
||||
fnt = ResourceMgr_LoadAudioSoundFont(fontMap[id]);
|
||||
size = sizeof(SoundFont);
|
||||
medium = 2;
|
||||
cachePolicy = 0;
|
||||
romAddr = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
table = AudioLoad_GetLoadTable(tableType);
|
||||
size = table->entries[realId].size;
|
||||
size = ALIGN16(size);
|
||||
|
@ -832,7 +836,8 @@ uintptr_t AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id) {
|
||||
u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id)
|
||||
{
|
||||
if ((tableType == SEQUENCE_TABLE || tableType == FONT_TABLE) && !gUseLegacySD) {
|
||||
return id;
|
||||
}
|
||||
|
@ -891,7 +896,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||
Drum* drum;
|
||||
SoundFontSound* sfx;
|
||||
s32 i;
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontId);
|
||||
SoundFont* sf = NULL;
|
||||
|
||||
s32 numDrums = 0;
|
||||
s32 numInstruments = 0;
|
||||
|
@ -902,6 +907,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||
numInstruments = gAudioContext.soundFonts[fontId].numInstruments;
|
||||
numSfx = gAudioContext.soundFonts[fontId].numSfx;
|
||||
} else {
|
||||
sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
numDrums = sf->numDrums;
|
||||
numInstruments = sf->numInstruments;
|
||||
numSfx = sf->numSfx;
|
||||
|
@ -909,7 +915,8 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo
|
|||
|
||||
void** ptrs = (void**)mem;
|
||||
|
||||
#define BASE_OFFSET(x) (void*)((uintptr_t)(x) + (uintptr_t)(mem))
|
||||
|
||||
#define BASE_OFFSET(x) (void*)((u32)(x) + (u32)(mem))
|
||||
|
||||
reloc2 = ptrs[0];
|
||||
if (1) {}
|
||||
|
@ -1421,12 +1428,11 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
|
|||
|
||||
if (gUseLegacySD)
|
||||
numFonts = gAudioContext.soundFontTable->numEntries;
|
||||
else
|
||||
numFonts = 0x26; // OTRTODO: Count the number of soundfonts that are inside the OTR(s)
|
||||
|
||||
gAudioContext.soundFonts = AudioHeap_Alloc(&gAudioContext.audioInitPool, numFonts * sizeof(SoundFont));
|
||||
if (gUseLegacySD)
|
||||
{
|
||||
gAudioContext.soundFonts = AudioHeap_Alloc(&gAudioContext.audioInitPool, numFonts * sizeof(SoundFont));
|
||||
|
||||
if (gUseLegacySD) {
|
||||
for (i = 0; i < numFonts; i++) {
|
||||
AudioLoad_InitSoundFontMeta(i);
|
||||
}
|
||||
|
@ -1448,9 +1454,27 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
|
|||
|
||||
free(seqList);
|
||||
|
||||
int bp = 0;
|
||||
int fntListSize = 0;
|
||||
char** fntList = ResourceMgr_ListFiles("audio/fonts*", &fntListSize);
|
||||
|
||||
for (int i = 0; i < fntListSize; i++)
|
||||
{
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fntList[i]);
|
||||
|
||||
char* str = malloc(strlen(fntList[i]) + 1);
|
||||
strcpy(str, fntList[i]);
|
||||
|
||||
fontMap[sf->fntIndex] = str;
|
||||
}
|
||||
|
||||
numFonts = fntListSize;
|
||||
|
||||
free(fntList);
|
||||
gAudioContext.soundFonts = AudioHeap_Alloc(&gAudioContext.audioInitPool, numFonts * sizeof(SoundFont));
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (temp_v0_3 = AudioHeap_Alloc(&gAudioContext.audioInitPool, D_8014A6C4.permanentPoolSize), temp_v0_3 == NULL) {
|
||||
// cast away const from D_8014A6C4
|
||||
// *((u32*)&D_8014A6C4.permanentPoolSize) = 0;
|
||||
|
@ -1884,7 +1908,8 @@ void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, RelocIn
|
|||
void* reloc;
|
||||
|
||||
// NOTE: Seems precarious to assume the RAM is never <= 0x3EB2A0, but it largely works.
|
||||
if ((uintptr_t)sound->sample < maxSoundBankSize || !gUseLegacySD) {
|
||||
if ((uintptr_t)sound->sample < maxSoundBankSize || !gUseLegacySD)
|
||||
{
|
||||
if (!gUseLegacySD) {
|
||||
SoundFontSample* sample2 = sound;
|
||||
} else {
|
||||
|
@ -2170,7 +2195,7 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, RelocInfo* relocInfo
|
|||
gAudioContext.numUsedSamples = 0;
|
||||
|
||||
if (!gUseLegacySD) {
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontId);
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
|
||||
numDrums = sf->numDrums;
|
||||
numInstruments = sf->numInstruments;
|
||||
|
@ -2307,7 +2332,7 @@ void AudioLoad_LoadPermanentSamples(void) {
|
|||
//fontId = gAudioContext.permanentCache[i].id;
|
||||
|
||||
if (!gUseLegacySD) {
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontId);
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
relocInfo.sampleBankId1 = sf->sampleBankId1;
|
||||
relocInfo.sampleBankId2 = sf->sampleBankId2;
|
||||
} else {
|
||||
|
|
|
@ -286,11 +286,11 @@ void Audio_ProcessNotes(void) {
|
|||
}
|
||||
|
||||
subAttrs.frequency *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale;
|
||||
|
||||
|
||||
f32 resampRate = gAudioContext.audioBufferParameters.resampleRate;
|
||||
|
||||
if (!gUseLegacySD && !noteSubEu2->bitField1.isSyntheticWave && noteSubEu2->sound.soundFontSound != NULL &&
|
||||
noteSubEu2->sound.soundFontSound->sample != NULL &&
|
||||
noteSubEu2->sound.soundFontSound->sample != NULL &&
|
||||
noteSubEu2->sound.soundFontSound->sample->sampleRateMagicValue == 'RIFF') {
|
||||
resampRate = CALC_RESAMPLE_FREQ(noteSubEu2->sound.soundFontSound->sample->sampleRate);
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ SoundFontSound* Audio_InstrumentGetSound(Instrument* instrument, s32 semitone) {
|
|||
|
||||
Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
|
||||
Instrument* inst;
|
||||
|
||||
|
||||
if (fontId == 0xFF) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
|
|||
return NULL;
|
||||
}
|
||||
} else {
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontId);
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
|
||||
if (instId >= sf->numInstruments)
|
||||
return NULL;
|
||||
|
@ -354,7 +354,7 @@ Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
|
|||
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
|
||||
return inst;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return inst;
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ Drum* Audio_GetDrum(s32 fontId, s32 drumId) {
|
|||
|
||||
drum = gAudioContext.soundFonts[fontId].drums[drumId];
|
||||
} else {
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontId);
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
drum = sf->drums[drumId];
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ SoundFontSound* Audio_GetSfx(s32 fontId, s32 sfxId) {
|
|||
|
||||
sfx = &gAudioContext.soundFonts[fontId].soundEffects[sfxId];
|
||||
} else {
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontId);
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
sfx = &sf->soundEffects[sfxId];
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
#include "global.h"
|
||||
|
||||
extern bool gUseLegacySD;
|
||||
extern char* sequenceMap[512];
|
||||
extern char* sequenceMap[256];
|
||||
char* fontMap[256];
|
||||
|
||||
#define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80)
|
||||
#define PORTAMENTO_MODE(x) ((x).mode & ~0x80)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue