mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-21 13:53:49 -07:00
Updated zapd_audio_support on zelda64
This commit is contained in:
commit
8b63cf93d8
29 changed files with 1957 additions and 224 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,6 @@
|
|||
<Root>
|
||||
<File Name="code" OutName="audio" RangeStart="0x0" RangeEnd="0x12CBB0">
|
||||
<Audio Name="audio" Offset="0x00"/>
|
||||
<Audio Name="audio" Offset="0x00">
|
||||
</Audio>
|
||||
</File>
|
||||
</Root>
|
||||
|
|
|
@ -18,11 +18,6 @@
|
|||
#define _AudiotableSegmentRomStart "Audiotable"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define _icon_item_gameover_staticSegmentRomStart 0
|
||||
#define _icon_item_gameover_staticSegmentRomEnd 0
|
||||
#define _icon_item_staticSegmentRomStart 0
|
||||
#define _icon_item_staticSegmentRomEnd 0
|
||||
#define _map_i_staticSegmentRomStart 0
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#if defined(_WIN64) || defined(__x86_64__)
|
||||
#define _SOH64
|
||||
#define AUDIO_HEAP_SIZE 0x70000
|
||||
#define AUDIO_HEAP_SIZE 0xF0000
|
||||
#else
|
||||
#define AUDIO_HEAP_SIZE 0x38000
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
#define AIBUF_LEN 0x580
|
||||
|
||||
#define CALC_RESAMPLE_FREQ(sampleRate) ((float)sampleRate / (s32)gAudioContext.audioBufferParameters.frequency)
|
||||
|
||||
extern bool gUseLegacySD;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ ADSR_STATE_DISABLED,
|
||||
/* 1 */ ADSR_STATE_INITIAL,
|
||||
|
@ -136,6 +140,8 @@ typedef struct
|
|||
/* 0x04 */ u8* sampleAddr;
|
||||
/* 0x08 */ AdpcmLoop* loop;
|
||||
/* 0x0C */ AdpcmBook* book;
|
||||
u32 sampleRateMagicValue; // For wav samples only...
|
||||
s32 sampleRate; // For wav samples only...
|
||||
} SoundFontSample; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
|
@ -1062,6 +1068,16 @@ typedef enum {
|
|||
/* -1 */ OCARINA_NOTE_INVALID = 0xFF
|
||||
} OcarinaNoteIdx;
|
||||
|
||||
typedef struct {
|
||||
char* seqData;
|
||||
int32_t seqDataSize;
|
||||
uint8_t seqNumber;
|
||||
uint8_t medium;
|
||||
uint8_t cachePolicy;
|
||||
int32_t numFonts;
|
||||
uint8_t fonts[16];
|
||||
} SequenceData;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<EnableASAN>true</EnableASAN>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -59,6 +59,7 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len);
|
|||
extern "C" int AudioPlayer_Buffered(void);
|
||||
extern "C" int AudioPlayer_GetDesiredBuffered(void);
|
||||
extern "C" void ResourceMgr_CacheDirectory(const char* resName);
|
||||
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path);
|
||||
|
||||
// C->C++ Bridge
|
||||
extern "C" void OTRAudio_Init()
|
||||
|
@ -198,11 +199,16 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
|
|||
//AudioMgr_ThreadEntry(&gAudioMgr);
|
||||
// 528 and 544 relate to 60 fps at 32 kHz 32000/60 = 533.333..
|
||||
// in an ideal world, one third of the calls should use num_samples=544 and two thirds num_samples=528
|
||||
#define SAMPLES_HIGH 560
|
||||
#define SAMPLES_LOW 528
|
||||
//#define SAMPLES_HIGH 560
|
||||
//#define SAMPLES_LOW 528
|
||||
// PAL values
|
||||
//#define SAMPLES_HIGH 656
|
||||
//#define SAMPLES_LOW 624
|
||||
|
||||
// 44KHZ values
|
||||
#define SAMPLES_HIGH 752
|
||||
#define SAMPLES_LOW 720
|
||||
|
||||
#define AUDIO_FRAMES_PER_UPDATE (R_UPDATE_RATE > 0 ? R_UPDATE_RATE : 1 )
|
||||
#define NUM_AUDIO_CHANNELS 2
|
||||
int samples_left = AudioPlayer_Buffered();
|
||||
|
@ -321,6 +327,22 @@ extern "C" void ResourceMgr_InvalidateCache() {
|
|||
OTRGlobals::Instance->context->GetResourceManager()->InvalidateResourceCache();
|
||||
}
|
||||
|
||||
// OTRTODO: There is probably a more elegant way to go about this...
|
||||
extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) {
|
||||
auto lst = OTRGlobals::Instance->context->GetResourceManager()->ListFiles(searchMask);
|
||||
char** result = (char**)malloc(lst->size() * sizeof(char*));
|
||||
|
||||
for (int i = 0; i < lst->size(); i++) {
|
||||
char* str = (char*)malloc(lst.get()[0][i].size() + 1);
|
||||
memcpy(str, lst.get()[0][i].data(), lst.get()[0][i].size());
|
||||
str[lst.get()[0][i].size()] = '\0';
|
||||
result[i] = str;
|
||||
}
|
||||
|
||||
*resultSize = lst->size();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_LoadFile(const char* resName) {
|
||||
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(resName);
|
||||
|
@ -545,35 +567,52 @@ extern "C" Vtx* ResourceMgr_LoadVtxByName(const char* path)
|
|||
return (Vtx*)res->vertices.data();
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadSeqByID(int seqID)
|
||||
{
|
||||
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 OTRGlobals::Instance->context->GetResourceManager()->LoadFile(StringHelper::Sprintf(fmtStr.c_str(), seqID)).get()->buffer.get();
|
||||
return ResourceMgr_LoadSeqByName(StringHelper::Sprintf(fmtStr.c_str(), seqID).c_str());
|
||||
}
|
||||
|
||||
extern "C" int ResourceMgr_GetSeqSizeByID(int seqID)
|
||||
{
|
||||
return OTRGlobals::Instance->context->GetResourceManager()
|
||||
->LoadFile(StringHelper::Sprintf("audio/sequences/seq_%02X", seqID))
|
||||
.get()
|
||||
->dwBufferSize;
|
||||
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) {
|
||||
auto file = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(path).get();
|
||||
|
||||
char* data = file->buffer.get();
|
||||
|
||||
SequenceData seqData;
|
||||
seqData.seqNumber = data[1];
|
||||
seqData.medium = data[2];
|
||||
seqData.cachePolicy = data[3];
|
||||
seqData.numFonts = data[4];
|
||||
|
||||
for (int i = 0; i < seqData.numFonts; i++)
|
||||
seqData.fonts[i] = data[5 + i];
|
||||
|
||||
seqData.seqData = &data[5 + seqData.numFonts];
|
||||
seqData.seqDataSize = file->dwBufferSize - 5 - seqData.numFonts;
|
||||
|
||||
return seqData;
|
||||
}
|
||||
|
||||
std::map<std::string, SoundFontSample*> cachedCustomSFs;
|
||||
|
||||
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(int romOffset)
|
||||
{
|
||||
auto str = StringHelper::Sprintf("audio/samples/sample_%08X", romOffset);
|
||||
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) {
|
||||
//auto str = StringHelper::Sprintf("audio/samples/sample_%08X", romOffset);
|
||||
|
||||
if (cachedCustomSFs.find(str) != cachedCustomSFs.end())
|
||||
return cachedCustomSFs[str];
|
||||
if (std::string(path) == "")
|
||||
return nullptr;
|
||||
|
||||
if (romOffset == 0x14f0) {
|
||||
int bp = 0;
|
||||
}
|
||||
if (cachedCustomSFs.find(path) != cachedCustomSFs.end())
|
||||
return cachedCustomSFs[path];
|
||||
|
||||
// Check if our file is actually a wav...
|
||||
auto sampleRaw = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(str);
|
||||
auto sampleRaw = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(path);
|
||||
uint32_t* strem = (uint32_t*)sampleRaw->buffer.get();
|
||||
uint8_t* strem2 = (uint8_t*)strem;
|
||||
|
||||
|
@ -587,6 +626,8 @@ extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(int romOffset)
|
|||
|
||||
*strem++; // fmt
|
||||
int fmtChunkSize = *strem++;
|
||||
*strem++; // wFormatTag + wChannels
|
||||
int32_t sampleRate = *strem++; // dwSamplesPerSec
|
||||
// OTRTODO: Make sure wav format is what the audio driver wants!
|
||||
|
||||
strem = (uint32_t*)&strem2[0x0C + fmtChunkSize + 8 + 4];
|
||||
|
@ -597,26 +638,25 @@ extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(int romOffset)
|
|||
// OTRTODO: Grab loop data from wav
|
||||
sampleC->loop = (AdpcmLoop*)malloc(sizeof(AdpcmLoop));
|
||||
sampleC->loop->start = 0;
|
||||
sampleC->loop->end = sampleC->size / 2;
|
||||
sampleC->loop->end = sampleC->size / 2; // OTRTODO: This calculation is probably incorrect... Sometimes it goes past the sample, sometimes it stops too early...
|
||||
sampleC->loop->count = 0;
|
||||
sampleC->sampleRateMagicValue = 'RIFF';
|
||||
sampleC->sampleRate = sampleRate;
|
||||
|
||||
cachedCustomSFs[str] = sampleC;
|
||||
cachedCustomSFs[path] = sampleC;
|
||||
return sampleC;
|
||||
}
|
||||
|
||||
auto sample = std::static_pointer_cast<Ship::AudioSample>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(str));
|
||||
auto sample = std::static_pointer_cast<Ship::AudioSample>(
|
||||
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(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();
|
||||
|
@ -692,7 +732,7 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(int fontIndex) {
|
|||
}
|
||||
}
|
||||
|
||||
drum->sound.sample = ResourceMgr_LoadAudioSample(soundFont->drums[i].offset);
|
||||
drum->sound.sample = ResourceMgr_LoadAudioSample(soundFont->drums[i].sampleFileName.c_str());
|
||||
drum->sound.tuning = soundFont->drums[i].tuning;
|
||||
|
||||
soundFontC->drums[i] = drum;
|
||||
|
@ -726,7 +766,7 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(int fontIndex) {
|
|||
if (soundFont->instruments[i].lowNotesSound != nullptr)
|
||||
{
|
||||
inst->lowNotesSound.sample =
|
||||
ResourceMgr_LoadAudioSample(soundFont->instruments[i].lowNotesSound->sampleOffset);
|
||||
ResourceMgr_LoadAudioSample(soundFont->instruments[i].lowNotesSound->sampleFileName.c_str());
|
||||
inst->lowNotesSound.tuning = soundFont->instruments[i].lowNotesSound->tuning;
|
||||
} else {
|
||||
inst->lowNotesSound.sample = NULL;
|
||||
|
@ -735,7 +775,7 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(int fontIndex) {
|
|||
|
||||
if (soundFont->instruments[i].normalNotesSound != nullptr) {
|
||||
inst->normalNotesSound.sample =
|
||||
ResourceMgr_LoadAudioSample(soundFont->instruments[i].normalNotesSound->sampleOffset);
|
||||
ResourceMgr_LoadAudioSample(soundFont->instruments[i].normalNotesSound->sampleFileName.c_str());
|
||||
inst->normalNotesSound.tuning = soundFont->instruments[i].normalNotesSound->tuning;
|
||||
|
||||
} else {
|
||||
|
@ -745,7 +785,7 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(int fontIndex) {
|
|||
|
||||
if (soundFont->instruments[i].highNotesSound != nullptr) {
|
||||
inst->highNotesSound.sample =
|
||||
ResourceMgr_LoadAudioSample(soundFont->instruments[i].highNotesSound->sampleOffset);
|
||||
ResourceMgr_LoadAudioSample(soundFont->instruments[i].highNotesSound->sampleFileName.c_str());
|
||||
inst->highNotesSound.tuning = soundFont->instruments[i].highNotesSound->tuning;
|
||||
} else {
|
||||
inst->highNotesSound.sample = NULL;
|
||||
|
@ -763,7 +803,7 @@ extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(int fontIndex) {
|
|||
|
||||
for (int i = 0; i < soundFont->soundEffects.size(); i++)
|
||||
{
|
||||
soundFontC->soundEffects[i].sample = ResourceMgr_LoadAudioSample(soundFont->soundEffects[i]->sampleOffset);
|
||||
soundFontC->soundEffects[i].sample = ResourceMgr_LoadAudioSample(soundFont->soundEffects[i]->sampleFileName.c_str());
|
||||
soundFontC->soundEffects[i].tuning = soundFont->soundEffects[i]->tuning;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ uint16_t OTRGetPixelDepth(float x, float y);
|
|||
int32_t OTRGetLastScancode();
|
||||
uint32_t ResourceMgr_GetGameVersion();
|
||||
void ResourceMgr_CacheDirectory(const char* resName);
|
||||
char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize);
|
||||
void ResourceMgr_LoadFile(const char* resName);
|
||||
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
||||
char* ResourceMgr_LoadJPEG(char* data, int dataSize);
|
||||
|
@ -49,6 +50,10 @@ 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);
|
||||
SequenceData ResourceMgr_LoadSeqByName(const char* path);
|
||||
SoundFontSample* ResourceMgr_LoadAudioSample(const char* path);
|
||||
CollisionHeader* ResourceMgr_LoadColByName(const char* path);
|
||||
uint64_t GetPerfCounter();
|
||||
struct SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path);
|
||||
|
@ -76,10 +81,6 @@ int AudioPlayer_GetDesiredBuffered(void);
|
|||
void AudioPlayer_Play(const uint8_t* buf, uint32_t len);
|
||||
void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
|
||||
int Controller_ShouldRumble(size_t i);
|
||||
char* ResourceMgr_LoadSeqByID(int seqID);
|
||||
int ResourceMgr_GetSeqSizeByID(int seqID);
|
||||
SoundFont* ResourceMgr_LoadAudioSoundFont(int fontIndex);
|
||||
SoundFontSample* ResourceMgr_LoadAudioSample(int romOffset);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1875,7 +1875,9 @@ AudioTable gSampleBankTable = { 0x0007,
|
|||
};
|
||||
#endif
|
||||
|
||||
// OTRTODO: Implement This in OTR File
|
||||
#if 0
|
||||
u8 gSequenceFontTable[1] = { 0 };
|
||||
#else
|
||||
u8 gSequenceFontTable[0x1C0] = {
|
||||
0xDC,
|
||||
0x00,
|
||||
|
@ -2111,3 +2113,4 @@ u8 gSequenceFontTable[0x1C0] = {
|
|||
0x03, 0x01, 0x1F, 0x01, 0x20, 0x01, 0x20, 0x01, 0x09, 0x01, 0x21, 0x01, 0x22, 0x01, 0x21, 0x01, 0x09, 0x01, 0x20,
|
||||
0x01, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
#endif
|
|
@ -544,16 +544,10 @@ u8 gDefaultShortNoteGateTimeTable[] = {
|
|||
};
|
||||
|
||||
AdsrEnvelope gDefaultEnvelope[] = {
|
||||
// OTRTODO: Byteswapped manually for quick audio support.
|
||||
{ 0x0100, 0x007D },
|
||||
{ 0xE803, 0x007D },
|
||||
{ 0xFFFF, 0x0000 },
|
||||
{ 0x0000, 0x0000 },
|
||||
/* { 1, 32000 },
|
||||
{ 1000, 32000 },
|
||||
{ -1, 0 },
|
||||
{ 0, 0 },
|
||||
*/
|
||||
};
|
||||
|
||||
NoteSubEu gZeroNoteSub = { 0 };
|
||||
|
|
|
@ -70,23 +70,24 @@ ReverbSettings D_80133420[][3] = {
|
|||
},
|
||||
};
|
||||
|
||||
// OTRTODO
|
||||
AudioSpec gAudioSpecs[18] = {
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[0], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x4000, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[1], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[2], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 23, 4, 0, 0, 2, D_80133420[4], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 23, 4, 0, 0, 2, D_80133420[5], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[6], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[7], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 23, 4, 0, 0, 2, D_80133420[8], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[9], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 23, 4, 0, 0, 2, D_80133420[8], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 28, 3, 0, 0, 2, D_80133420[10], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x2800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 28, 3, 0, 0, 1, D_80133420[11], 0x300, 0x200, 0x7FFF, 0, 0x4800, 0, 0x4000, 0, 0, 0, 0 },
|
||||
{ 32000, 1, 28, 3, 0, 0, 1, D_80133420[11], 0x300, 0x200, 0x7FFF, 0, 0, 0, 0x4000, 0x4800, 0, 0, 0 },
|
||||
{ 32000, 1, 22, 4, 0, 0, 2, D_80133420[0], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 22, 4, 0, 0, 2, D_80133420[8], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 16, 4, 0, 0, 2, D_80133420[0], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 24, 4, 0, 0, 2, D_80133420[0], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x4000, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 24, 4, 0, 0, 2, D_80133420[1], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 24, 4, 0, 0, 2, D_80133420[2], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 23, 4, 0, 0, 2, D_80133420[4], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 23, 4, 0, 0, 2, D_80133420[5], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 24, 4, 0, 0, 2, D_80133420[6], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 24, 4, 0, 0, 2, D_80133420[7], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 23, 4, 0, 0, 2, D_80133420[8], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 24, 4, 0, 0, 2, D_80133420[9], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 23, 4, 0, 0, 2, D_80133420[8], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 28, 3, 0, 0, 2, D_80133420[10], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x2800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 28, 3, 0, 0, 1, D_80133420[11], 0x300, 0x200, 0x7FFF, 0, 0x4800, 0, 0x4000, 0, 0, 0, 0 },
|
||||
{ 44000, 1, 28, 3, 0, 0, 1, D_80133420[11], 0x300, 0x200, 0x7FFF, 0, 0, 0, 0x4000, 0x4800, 0, 0, 0 },
|
||||
{ 44000, 1, 22, 4, 0, 0, 2, D_80133420[0], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 22, 4, 0, 0, 2, D_80133420[8], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 44000, 1, 16, 4, 0, 0, 2, D_80133420[0], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 22050, 1, 24, 4, 0, 0, 2, D_80133420[0], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3800, 0x2880, 0, 0, 0 },
|
||||
{ 32000, 1, 24, 4, 0, 0, 2, D_80133420[2], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3600, 0x2600, 0, 0, 0 },
|
||||
{ 44000, 1, 24, 4, 0, 0, 2, D_80133420[2], 0x300, 0x200, 0x7FFF, 0x7F0, 0xE00, 0, 0x3600, 0x2600, 0, 0, 0 },
|
||||
};
|
||||
|
|
|
@ -76,6 +76,8 @@ void* sUnusedHandler = NULL;
|
|||
|
||||
s32 gAudioContextInitalized = false;
|
||||
|
||||
char* sequenceMap[512];
|
||||
|
||||
uintptr_t fontStart;
|
||||
uint32_t fontOffsets[8192];
|
||||
|
||||
|
@ -388,6 +390,7 @@ SoundFontData* AudioLoad_SyncLoadSeqFonts(s32 seqId, u32* outDefaultFontId) {
|
|||
|
||||
while (numFonts > 0) {
|
||||
fontId = gAudioContext.sequenceFontTable[index++];
|
||||
|
||||
font = AudioLoad_SyncLoadFont(fontId);
|
||||
numFonts--;
|
||||
}
|
||||
|
@ -480,13 +483,26 @@ void AudioLoad_AsyncLoadFont(s32 fontId, s32 arg1, s32 retData, OSMesgQueue* ret
|
|||
u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts) {
|
||||
s32 index;
|
||||
|
||||
index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
|
||||
if (!gUseLegacySD)
|
||||
{
|
||||
if (seqId == 255)
|
||||
return NULL;
|
||||
|
||||
*outNumFonts = gAudioContext.sequenceFontTable[index++];
|
||||
if (*outNumFonts == 0) {
|
||||
return NULL;
|
||||
SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqId]);
|
||||
|
||||
if (sDat.numFonts == 0)
|
||||
return NULL;
|
||||
|
||||
return sDat.fonts;
|
||||
} else {
|
||||
index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
|
||||
|
||||
*outNumFonts = gAudioContext.sequenceFontTable[index++];
|
||||
if (*outNumFonts == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return &gAudioContext.sequenceFontTable[index];
|
||||
}
|
||||
return &gAudioContext.sequenceFontTable[index];
|
||||
}
|
||||
|
||||
void AudioLoad_DiscardSeqFonts(s32 seqId) {
|
||||
|
@ -569,16 +585,27 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||
AudioSeq_SequencePlayerDisable(seqPlayer);
|
||||
|
||||
fontId = 0xFF;
|
||||
index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
|
||||
numFonts = gAudioContext.sequenceFontTable[index++];
|
||||
|
||||
while (numFonts > 0) {
|
||||
fontId = gAudioContext.sequenceFontTable[index++];
|
||||
if (gUseLegacySD) {
|
||||
index = ((u16*)gAudioContext.sequenceFontTable)[seqId];
|
||||
numFonts = gAudioContext.sequenceFontTable[index++];
|
||||
|
||||
// if (gUseLegacySD)
|
||||
AudioLoad_SyncLoadFont(fontId);
|
||||
while (numFonts > 0) {
|
||||
fontId = gAudioContext.sequenceFontTable[index++];
|
||||
|
||||
numFonts--;
|
||||
AudioLoad_SyncLoadFont(fontId); // NOTE: If this is commented out, then enemies will play child link sounds...
|
||||
|
||||
numFonts--;
|
||||
}
|
||||
} else {
|
||||
SequenceData seqData2 = ResourceMgr_LoadSeqByName(sequenceMap[seqId]);
|
||||
|
||||
for (int i = 0; i < seqData2.numFonts; i++)
|
||||
{
|
||||
fontId = seqData2.fonts[i];
|
||||
AudioLoad_SyncLoadFont(fontId); // NOTE: If this is commented out, then enemies will play child link sounds...
|
||||
numFonts--;
|
||||
}
|
||||
}
|
||||
|
||||
seqData = AudioLoad_SyncLoadSeq(seqId);
|
||||
|
@ -660,7 +687,6 @@ SoundFontData* AudioLoad_SyncLoadFont(u32 fontId) {
|
|||
s32 didAllocate;
|
||||
RelocInfo relocInfo;
|
||||
s32 realFontId = AudioLoad_GetRealTableIndex(FONT_TABLE, fontId);
|
||||
//s32 realFontId = fontId;
|
||||
|
||||
if (gAudioContext.fontLoadStatus[realFontId] == 1) {
|
||||
return NULL;
|
||||
|
@ -722,26 +748,20 @@ uintptr_t AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) {
|
|||
char* seqData = 0;
|
||||
SoundFont* fnt;
|
||||
|
||||
if (!gUseLegacySD && tableType == SEQUENCE_TABLE)
|
||||
{
|
||||
seqData = ResourceMgr_LoadSeqByID(id);
|
||||
size = ResourceMgr_GetSeqSizeByID(id);
|
||||
size -= 2;
|
||||
medium = seqData[0];
|
||||
cachePolicy = seqData[1];
|
||||
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;
|
||||
seqData += 2;
|
||||
}
|
||||
else if (!gUseLegacySD && tableType == FONT_TABLE)
|
||||
{
|
||||
} else if (!gUseLegacySD && tableType == FONT_TABLE) {
|
||||
fnt = ResourceMgr_LoadAudioSoundFont(id);
|
||||
size = sizeof(SoundFont);
|
||||
medium = 2;
|
||||
cachePolicy = 0;
|
||||
romAddr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
table = AudioLoad_GetLoadTable(tableType);
|
||||
size = table->entries[realId].size;
|
||||
size = ALIGN16(size);
|
||||
|
@ -1181,7 +1201,6 @@ s32 AudioLoad_AssertValidAddr(uintptr_t ramAddr, uintptr_t startAddr, size_t siz
|
|||
#define BASE_ROM_OFFSET(x) (uintptr_t)((uintptr_t)(x) + (uintptr_t)(romAddr))
|
||||
|
||||
void AudioLoad_InitSwapFontSampleHeaders(SoundFontSample* sample, uintptr_t romAddr) {
|
||||
// OTRTODO: This will be removed when we actually extract the data.
|
||||
size_t maxSoundFontSize = 0x3AA0; // soundFont 0 is the largest size at 0x3AA0
|
||||
AdpcmLoop* loop;
|
||||
AdpcmBook* book;
|
||||
|
@ -1390,12 +1409,21 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
|
|||
uintptr_t bankStart = ResourceMgr_LoadFileRaw(_AudiobankSegmentRomStart);
|
||||
uintptr_t tableStart = ResourceMgr_LoadFileRaw(_AudiotableSegmentRomStart);
|
||||
|
||||
// If we have the old audioseq files present (and this is a 32-bit build), use the legacy audio system
|
||||
if (seqStart != NULL && bankStart != NULL && tableStart != NULL)
|
||||
gUseLegacySD = true;
|
||||
|
||||
fontStart = bankStart;
|
||||
|
||||
AudioLoad_InitTable(gAudioContext.sequenceTable, seqStart, 0);
|
||||
AudioLoad_InitTable(gAudioContext.soundFontTable, bankStart, 0);
|
||||
AudioLoad_InitTable(gAudioContext.sampleBankTable, tableStart, 0);
|
||||
numFonts = gAudioContext.soundFontTable->numEntries;
|
||||
|
||||
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) {
|
||||
|
@ -1404,6 +1432,23 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
|
|||
}
|
||||
|
||||
AudioLoad_InitSwapFont();
|
||||
} else {
|
||||
int seqListSize = 0;
|
||||
char** seqList = ResourceMgr_ListFiles("audio/sequences*", &seqListSize);
|
||||
|
||||
for (int i = 0; i < seqListSize; i++)
|
||||
{
|
||||
SequenceData sDat = ResourceMgr_LoadSeqByName(seqList[i]);
|
||||
|
||||
char* str = malloc(strlen(seqList[i]) + 1);
|
||||
strcpy(str, seqList[i]);
|
||||
|
||||
sequenceMap[sDat.seqNumber] = str;
|
||||
}
|
||||
|
||||
free(seqList);
|
||||
|
||||
int bp = 0;
|
||||
}
|
||||
|
||||
if (temp_v0_3 = AudioHeap_Alloc(&gAudioContext.audioInitPool, D_8014A6C4.permanentPoolSize), temp_v0_3 == NULL) {
|
||||
|
@ -1424,7 +1469,6 @@ void AudioLoad_InitSlowLoads(void) {
|
|||
s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) {
|
||||
SoundFontSample* sample;
|
||||
AudioSlowLoad* slowLoad;
|
||||
|
||||
sample = AudioLoad_GetFontSample(fontId, instId);
|
||||
if (sample == NULL) {
|
||||
*isDone = 0;
|
||||
|
@ -1596,11 +1640,13 @@ s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* isDone) {
|
|||
slowLoad->sample.sampleAddr = NULL;
|
||||
slowLoad->isDone = isDone;
|
||||
|
||||
if (!gUseLegacySD) {
|
||||
char* seqData = ResourceMgr_LoadSeqByID(seqId);
|
||||
size = ResourceMgr_GetSeqSizeByID(seqId) - 2;
|
||||
slowLoad->curDevAddr = seqData + 2;
|
||||
slowLoad->medium = seqData[0];
|
||||
if (!gUseLegacySD)
|
||||
{
|
||||
SequenceData sData = ResourceMgr_LoadSeqByName(sequenceMap[seqId]);
|
||||
char* seqData = sData.seqData;
|
||||
size = sData.seqDataSize;
|
||||
slowLoad->curDevAddr = seqData;
|
||||
slowLoad->medium = sData.medium;
|
||||
} else {
|
||||
size = seqTable->entries[seqId].size;
|
||||
size = ALIGN16(size);
|
||||
|
@ -1825,41 +1871,22 @@ void AudioLoad_AsyncDmaUnkMedium(uintptr_t devAddr, uintptr_t ramAddr, size_t si
|
|||
#define RELOC(v, base) (reloc = (uintptr_t)((uintptr_t)(v) + (uintptr_t)(base)))
|
||||
|
||||
void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, RelocInfo* relocInfo, int fontId) {
|
||||
// OTRTODO: This is hack to detect whether or not the sample has been relocated.
|
||||
size_t maxSoundBankSize = 0x3EB2A0; // sample bank 0 is largest size at 0x3EB2A0
|
||||
if ((uintptr_t)mem <= maxSoundBankSize) {
|
||||
// OTRTODO: This can be removed once we have properly byteswapped files on the disk.
|
||||
assert("mem for sound font bank is too low.");
|
||||
if (gUseLegacySD)
|
||||
{
|
||||
// NOTE: This is hack to detect whether or not the sample has been relocated.
|
||||
if ((uintptr_t)mem <= maxSoundBankSize) {
|
||||
assert("mem for sound font bank is too low.");
|
||||
}
|
||||
}
|
||||
|
||||
SoundFontSample* sample;
|
||||
void* reloc;
|
||||
|
||||
// OTRTODO: Seems precarious to assume the RAM is never <= 0x3EB2A0, but it largely works.
|
||||
if ((uintptr_t)sound->sample < maxSoundBankSize || !gUseLegacySD)
|
||||
{
|
||||
// NOTE: Seems precarious to assume the RAM is never <= 0x3EB2A0, but it largely works.
|
||||
if ((uintptr_t)sound->sample < maxSoundBankSize || !gUseLegacySD) {
|
||||
if (!gUseLegacySD) {
|
||||
SoundFontSample* sample2 = sound;
|
||||
|
||||
if (sample2->unk_bit25 != 1)
|
||||
{
|
||||
//if (sample2->size == 0x5CC8)
|
||||
//{
|
||||
// switch (sample2->medium) {
|
||||
// case 0:
|
||||
// sample2->medium = relocInfo->medium1;
|
||||
// break;
|
||||
// case 1:
|
||||
// sample2->medium = relocInfo->medium2;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// sample2->unk_bit25 = 1;
|
||||
// if (sample2->unk_bit26 && (sample2->medium != MEDIUM_RAM)) {
|
||||
// // gAudioContext.usedSamples[gAudioContext.numUsedSamples++] = sample2;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
} else {
|
||||
sample = sound->sample = RELOC(sound->sample, mem);
|
||||
|
||||
|
@ -2112,8 +2139,10 @@ s32 AudioLoad_GetSamplesForFont(s32 fontId, SoundFontSample** sampleSet) {
|
|||
void AudioLoad_AddUsedSample(SoundFontSound* sound) {
|
||||
SoundFontSample* sample = sound->sample;
|
||||
|
||||
if ((sample->size != 0) && (sample->unk_bit26) && (sample->medium != MEDIUM_RAM)) {
|
||||
gAudioContext.usedSamples[gAudioContext.numUsedSamples++] = sample;
|
||||
if (sample != NULL) {
|
||||
if ((sample->size != 0) && (sample->unk_bit26) && (sample->medium != MEDIUM_RAM)) {
|
||||
gAudioContext.usedSamples[gAudioContext.numUsedSamples++] = sample;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,18 @@ void Audio_ProcessNotes(void) {
|
|||
}
|
||||
|
||||
subAttrs.frequency *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale;
|
||||
subAttrs.frequency *= gAudioContext.audioBufferParameters.resampleRate;
|
||||
|
||||
f32 resampRate = gAudioContext.audioBufferParameters.resampleRate;
|
||||
|
||||
if (!gUseLegacySD && !noteSubEu2->bitField1.isSyntheticWave && noteSubEu2->sound.soundFontSound != NULL &&
|
||||
noteSubEu2->sound.soundFontSound->sample != NULL &&
|
||||
noteSubEu2->sound.soundFontSound->sample->sampleRateMagicValue == 'RIFF') {
|
||||
resampRate = CALC_RESAMPLE_FREQ(noteSubEu2->sound.soundFontSound->sample->sampleRate);
|
||||
}
|
||||
|
||||
subAttrs.frequency *= resampRate;
|
||||
|
||||
|
||||
subAttrs.velocity *= scale;
|
||||
Audio_InitNoteSub(note, noteSubEu2, &subAttrs);
|
||||
noteSubEu->bitField1.bookOffset = bookOffset;
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
|
||||
extern bool gUseLegacySD;
|
||||
extern char* sequenceMap[512];
|
||||
|
||||
#define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80)
|
||||
#define PORTAMENTO_MODE(x) ((x).mode & ~0x80)
|
||||
#define PORTAMENTO_MODE_1 1
|
||||
|
@ -939,7 +942,7 @@ u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** inst
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (inst->envelope != NULL)
|
||||
if (inst->envelope != NULL)
|
||||
{
|
||||
adsr->envelope = inst->envelope;
|
||||
adsr->releaseRate = (inst->releaseRate);
|
||||
|
@ -1060,9 +1063,14 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
command = (u8)parameters[0];
|
||||
|
||||
if (seqPlayer->defaultFont != 0xFF) {
|
||||
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
||||
lowBits = gAudioContext.sequenceFontTable[offset];
|
||||
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
|
||||
if (gUseLegacySD) {
|
||||
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
||||
lowBits = gAudioContext.sequenceFontTable[offset];
|
||||
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
|
||||
} else {
|
||||
SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqPlayer->seqId]);
|
||||
command = sDat.fonts[sDat.numFonts - result - 1];
|
||||
}
|
||||
}
|
||||
|
||||
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, command)) {
|
||||
|
@ -1171,9 +1179,14 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
command = (u8)parameters[0];
|
||||
|
||||
if (seqPlayer->defaultFont != 0xFF) {
|
||||
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
||||
lowBits = gAudioContext.sequenceFontTable[offset];
|
||||
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
|
||||
if (gUseLegacySD) {
|
||||
offset = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
||||
lowBits = gAudioContext.sequenceFontTable[offset];
|
||||
command = gAudioContext.sequenceFontTable[offset + lowBits - result];
|
||||
} else {
|
||||
SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqPlayer->seqId]);
|
||||
command = sDat.fonts[sDat.numFonts - result - 1];
|
||||
}
|
||||
}
|
||||
|
||||
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, command)) {
|
||||
|
@ -1330,14 +1343,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
break;
|
||||
case 0xB2:
|
||||
offset = (u16)parameters[0];
|
||||
// OTRTODO: Byteswap added for quick audio
|
||||
channel->unk_22 = BOMSWAP16(*(u16*)(seqPlayer->seqData + (uintptr_t)(offset + scriptState->value * 2)));
|
||||
break;
|
||||
case 0xB4:
|
||||
channel->dynTable = (void*)&seqPlayer->seqData[channel->unk_22];
|
||||
break;
|
||||
case 0xB5:
|
||||
// OTRTODO: Byteswap added for quick audio
|
||||
channel->unk_22 = BOMSWAP16(((u16*)(channel->dynTable))[scriptState->value]);
|
||||
break;
|
||||
case 0xB6:
|
||||
|
|
|
@ -561,6 +561,9 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
|
|||
NoteSubEu* noteSubEu2;
|
||||
s32 unk14;
|
||||
|
||||
if (aiBufLen == 0)
|
||||
return;
|
||||
|
||||
t = gAudioContext.numNotes * updateIndex;
|
||||
count = 0;
|
||||
if (gAudioContext.numSynthesisReverbs == 0) {
|
||||
|
|
|
@ -363,7 +363,11 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
void Audio_QueueSeqCmd(u32 cmd) {
|
||||
extern f32 D_80130F24;
|
||||
extern f32 D_80130F28;
|
||||
|
||||
void Audio_QueueSeqCmd(u32 cmd)
|
||||
{
|
||||
sAudioSeqCmds[sSeqCmdWrPos++] = cmd;
|
||||
}
|
||||
|
||||
|
|
|
@ -2093,9 +2093,14 @@ void func_80075B44(GlobalContext* globalCtx) {
|
|||
case 7:
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3,
|
||||
CHANNEL_IO_PORT_1, 0);
|
||||
if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) {
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5,
|
||||
CHANNEL_IO_PORT_1, 1);
|
||||
if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0)
|
||||
{
|
||||
// OTRTODO: This is where corrupt audio happens. Commenting this out seems to not introduce any side effects?
|
||||
// Further investigation is needed...
|
||||
|
||||
if (gUseLegacySD)
|
||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5,
|
||||
CHANNEL_IO_PORT_1, 1);
|
||||
}
|
||||
globalCtx->envCtx.unk_E0++;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue