[ntsc-1.2] Match audio (#2122)

* general.c mostly ok

* match remaining audio funcs

* comments

* Finish matching audio

---------

Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
This commit is contained in:
cadmic
2024-09-03 17:32:38 -07:00
committed by GitHub
parent 3e200769f1
commit e44c7c656c
8 changed files with 207 additions and 34 deletions
+13
View File
@@ -435,6 +435,14 @@ void AudioSeq_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer) {
}
void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) {
s32 finished = 0;
#if PLATFORM_N64
if (seqPlayer->finished == 1) {
finished = 1;
}
#endif
AudioSeq_SequencePlayerDisableChannels(seqPlayer, 0xFFFF);
Audio_NotePoolClear(&seqPlayer->notePool);
if (!seqPlayer->enabled) {
@@ -449,6 +457,11 @@ void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) {
}
if (AudioLoad_IsFontLoadComplete(seqPlayer->defaultFont)) {
#if PLATFORM_N64
if (finished == 1) {
AudioHeap_ReleaseNotesForFont(seqPlayer->defaultFont);
}
#endif
AudioLoad_SetFontLoadStatus(seqPlayer->defaultFont, LOAD_STATUS_MAYBE_DISCARDABLE);
}
+14 -1
View File
@@ -643,7 +643,13 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
aMix(cmd++, DMEM_2CH_SIZE >> 4, reverb->decayRatio + 0x8000, DMEM_WET_LEFT_CH, DMEM_WET_LEFT_CH);
// Leak reverb between the left and right channels
if (reverb->leakRtl != 0 || reverb->leakLtr != 0) {
#if PLATFORM_N64
if (((reverb->leakRtl != 0) || (reverb->leakLtr != 0)) && (gAudioCtx.soundMode != SOUNDMODE_MONO))
#else
if ((reverb->leakRtl != 0) || (reverb->leakLtr != 0))
#endif
{
cmd = AudioSynth_LeakReverb(cmd, reverb);
}
@@ -778,6 +784,13 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
nParts = noteSubEu->bitField1.hasTwoParts + 1;
samplesLenFixedPoint = (resamplingRateFixedPoint * aiBufLen * 2) + synthState->samplePosFrac;
numSamplesToLoad = samplesLenFixedPoint >> 16;
#if PLATFORM_N64
if (numSamplesToLoad == 0) {
skipBytes = false;
}
#endif
synthState->samplePosFrac = samplesLenFixedPoint & 0xFFFF;
// Partially-optimized out no-op ifs required for matching. SM64 decomp
+7
View File
@@ -16,12 +16,19 @@ AudioTask* AudioThread_Update(void) {
return AudioThread_UpdateImpl();
}
#if PLATFORM_N64
static s32 sMaxAbiCmdCnt = 0x80;
static AudioTask* sWaitingAudioTask = NULL;
#endif
/**
* This is Audio_Update for the audio thread
*/
AudioTask* AudioThread_UpdateImpl(void) {
#if !PLATFORM_N64
static s32 sMaxAbiCmdCnt = 0x80;
static AudioTask* sWaitingAudioTask = NULL;
#endif
u32 samplesRemainingInAi;
s32 abiCmdCnt;
s32 pad;