summaryrefslogtreecommitdiff
path: root/src/code/code_800E4FE0.c
diff options
context:
space:
mode:
authorengineer124 <47598039+engineer124@users.noreply.github.com>2022-06-20 21:55:01 -0400
committerGitHub <noreply@github.com>2022-06-20 21:55:01 -0400
commit00b98027dbb1898f477aebbd9464b37c6f1a80f0 (patch)
treef1afd5da2fe6877543471ce251a311c6c4dc69b1 /src/code/code_800E4FE0.c
parente7e2da86a8cd96145b34a7717db1f36e4528ebb2 (diff)
Synthetic Waves Documentation (#1256)
* Synthetic wave documentation * Better docs * harmonicIndex * More * typo * Complete the abi buffer docs * Small change * Revert change * PR suggestions * Missed one * PR Feedback * Better documents * Well that was a silly copy-pasta mistake * Typo * Another comment * Plural * Make it more block-like * Capitalization * Add comments for gWaveSamples[8] * Adjust comment * More PR Suggestions * PR Suggestions * missed a phrasing * PR Suggestions * Update include/z64audio.h Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Diffstat (limited to 'src/code/code_800E4FE0.c')
-rw-r--r--src/code/code_800E4FE0.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/code/code_800E4FE0.c b/src/code/code_800E4FE0.c
index 785a02cf1..4e7fd9eb4 100644
--- a/src/code/code_800E4FE0.c
+++ b/src/code/code_800E4FE0.c
@@ -154,8 +154,6 @@ AudioTask* func_800E5000(void) {
// msg = 0000RREE R = read pos, E = End Pos
while (osRecvMesg(gAudioContext.cmdProcQueueP, (OSMesg*)&sp4C, OS_MESG_NOBLOCK) != -1) {
if (1) {}
- if (1) {}
- if (1) {}
Audio_ProcessCmds(sp4C);
j++;
}
@@ -166,9 +164,15 @@ AudioTask* func_800E5000(void) {
gAudioContext.curAbiCmdBuf =
AudioSynth_Update(gAudioContext.curAbiCmdBuf, &abiCmdCnt, currAiBuffer, gAudioContext.aiBufLengths[index]);
+
+ // Update audioRandom to the next random number
gAudioContext.audioRandom = (gAudioContext.audioRandom + gAudioContext.totalTaskCount) * osGetCount();
gAudioContext.audioRandom =
- gAudioContext.aiBuffers[index][gAudioContext.totalTaskCount & 0xFF] + gAudioContext.audioRandom;
+ gAudioContext.audioRandom + gAudioContext.aiBuffers[index][gAudioContext.totalTaskCount & 0xFF];
+
+ // gWaveSamples[8] interprets compiled assembly code as s16 samples as a way to generate sound with noise.
+ // Start with the address of func_800E4FE0, and offset it by a random number between 0 - 0xFFF0
+ // Use the resulting address as the starting address to interpret an array of samples i.e. `s16 samples[]`
gWaveSamples[8] = (s16*)(((u8*)func_800E4FE0) + (gAudioContext.audioRandom & 0xFFF0));
index = gAudioContext.rspTaskIndex;