Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ typedef struct NotePlaybackState {
/* 0x6C */ VibratoState vibratoState;
} NotePlaybackState; // size = 0x88

// JAudio: "commonch"
typedef struct NoteSubEu {
struct {
/* 0x00 */ volatile u8 enabled : 1;
Expand Down Expand Up @@ -622,6 +623,7 @@ typedef struct NoteSubEu {
/* 0x18 */ char pad_18[0x8];
} NoteSubEu; // size = 0x20

// JAudio: "channel"
typedef struct Note {
/* 0x00 */ AudioListItem listItem;
/* 0x10 */ NoteSynthesisState synthesisState;
Expand Down Expand Up @@ -737,12 +739,14 @@ typedef struct AudioSampleCache {
/* 0x290 */ s32 numEntries;
} AudioSampleCache; // size = 0x294

// JAudio: Persistent <-> "stay"
typedef struct AudioPersistentCache {
/* 0x00*/ u32 numEntries;
/* 0x04*/ AudioAllocPool pool;
/* 0x14*/ AudioCacheEntry entries[16];
} AudioPersistentCache; // size = 0xD4

// JAudio: Temporary <-> "auto"
typedef struct AudioTemporaryCache {
/* 0x00*/ u32 nextSide;
/* 0x04*/ AudioAllocPool pool;
Expand Down
10 changes: 10 additions & 0 deletions src/audio/game/general.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,8 @@ void AudioOcarina_MapNotesToScarecrowButtons(u8 noteSongIndex) {
* - ocarina action (only used to make flags != 0)
* bitmask 0x80000000:
* - unused (only used to make flags != 0)
*
* original name: Na_StartOcarinaSinglePlayCheck2
*/
void AudioOcarina_Start(u16 ocarinaFlags) {
u8 i;
Expand Down Expand Up @@ -1752,6 +1754,8 @@ void AudioOcarina_EnableInput(u8 inputEnabled) {
* Resets ocarina properties based on the ocarina instrument id
* If ocarina instrument id is "OCARINA_INSTRUMENT_OFF", turn off the ocarina
* For all ocarina instrument ids, turn the ocarina on with the instrument id
*
* original name possibly Na_StopOcarinaMode
*/
void AudioOcarina_SetInstrument(u8 ocarinaInstrumentId) {
if (sOcarinaInstrumentId == ocarinaInstrumentId) {
Expand Down Expand Up @@ -1786,6 +1790,9 @@ void AudioOcarina_SetInstrument(u8 ocarinaInstrumentId) {
}
}

/**
* original name possibly Na_StartOcarinaBgm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this name come from? I can't find it in the repo, nor in ACreTeam/ac-decomp, nor in zeldaret/af, nor in the AC map files

Copy link
Collaborator Author

@Thar0 Thar0 Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JP versions of Majora's Mask have strings no other versions seem to have

$ strings baseroms/n64-jp-1.1/baserom-decompressed.z64 | grep Na_StartOc
Na_StartOcarinaSinglePlayCheck2( message->ocarina_no );
Na_StartOcarinaBgm Na_StartOcarinaBgm Na_StartOcarinaBgm

*/
void AudioOcarina_SetPlaybackSong(s8 songIndexPlusOne, s8 playbackState) {
if (songIndexPlusOne == 0) {
sPlaybackState = 0;
Expand Down Expand Up @@ -3232,6 +3239,9 @@ void Audio_ClearSariaBgm2(void) {
sSariaBgmPtr = NULL;
}

/**
* original name: Na_StartMorinigBgm
*/
void Audio_PlayMorningSceneSequence(u16 seqId) {
Audio_PlaySceneSequence(seqId);
// Writing a value of 1 to ioPort 0 will be used by
Expand Down
30 changes: 30 additions & 0 deletions src/audio/internal/effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#include "attributes.h"
#include "audio.h"

/**
* original name: __Nas_CallWaveProcess_Sub
*/
void Audio_SequenceChannelProcessSound(SequenceChannel* channel, s32 recalculateVolume, s32 applyBend) {
f32 channelVolume;
f32 chanFreqScale;
Expand Down Expand Up @@ -50,6 +53,9 @@ void Audio_SequenceChannelProcessSound(SequenceChannel* channel, s32 recalculate
channel->changes.asByte = 0;
}

/**
* original name: Nas_MainCtrl
*/
void Audio_SequencePlayerProcessSound(SequencePlayer* seqPlayer) {
s32 i;

Expand Down Expand Up @@ -85,6 +91,9 @@ void Audio_SequencePlayerProcessSound(SequencePlayer* seqPlayer) {
seqPlayer->recalculateVolume = false;
}

/**
* original name: Nas_SweepCalculator
*/
f32 Audio_GetPortamentoFreqScale(Portamento* portamento) {
u32 loResCur;
f32 portamentoFreq;
Expand All @@ -102,6 +111,9 @@ f32 Audio_GetPortamentoFreqScale(Portamento* portamento) {
return portamentoFreq;
}

/**
* original name: Nas_ModTableRead
*/
s16 Audio_GetVibratoPitchChange(VibratoState* vib) {
s32 index;

Expand All @@ -110,6 +122,9 @@ s16 Audio_GetVibratoPitchChange(VibratoState* vib) {
return vib->curve[index];
}

/**
* original name: Nas_Modulator
*/
f32 Audio_GetVibratoFreqScale(VibratoState* vib) {
static f32 D_80130510 = 0.0f;
static s32 D_80130514 = 0;
Expand Down Expand Up @@ -174,6 +189,9 @@ f32 Audio_GetVibratoFreqScale(VibratoState* vib) {
return result;
}

/**
* original name: Nas_ChannelModulation
*/
void Audio_NoteVibratoUpdate(Note* note) {
if (note->playbackState.portamento.mode != 0) {
note->playbackState.portamentoFreqScale = Audio_GetPortamentoFreqScale(&note->playbackState.portamento);
Expand All @@ -183,6 +201,9 @@ void Audio_NoteVibratoUpdate(Note* note) {
}
}

/**
* original name: Nas_ChannelModInit
*/
void Audio_NoteVibratoInit(Note* note) {
VibratoState* vib;
SequenceChannel* channel;
Expand Down Expand Up @@ -211,11 +232,17 @@ void Audio_NoteVibratoInit(Note* note) {
vib->delay = channel->vibratoDelay;
}

/**
* original name: Nas_SweepInit
*/
void Audio_NotePortamentoInit(Note* note) {
note->playbackState.portamentoFreqScale = 1.0f;
note->playbackState.portamento = note->playbackState.parentLayer->portamento;
}

/**
* original name: Nas_EnvInit
*/
void Audio_AdsrInit(AdsrState* adsr, EnvelopePoint* envelope, s16* volOut) {
adsr->action.asByte = 0;
adsr->delay = 0;
Expand All @@ -227,6 +254,9 @@ void Audio_AdsrInit(AdsrState* adsr, EnvelopePoint* envelope, s16* volOut) {
// removed, but the function parameter was forgotten and remains.)
}

/**
* original name: Nas_EnvProcess
*/
f32 Audio_AdsrUpdate(AdsrState* adsr) {
u8 state = adsr->action.s.state;

Expand Down
Loading