diff --git a/include/z64audio.h b/include/z64audio.h index 023fece0a6..ee145c9d80 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -496,8 +496,9 @@ typedef struct { /* 0x18 */ SequenceLayer* wantedParentLayer; /* 0x1C */ NoteAttributes attributes; /* 0x40 */ AdsrState adsr; - // Majora's Mask suggests this struct contains portamento, vibratoState -} NotePlaybackState; // size = 0x60 + /* 0x60 */ Portamento portamento; + /* 0x6C */ VibratoState vibratoState; +} NotePlaybackState; // size = 0x88 typedef struct { struct { @@ -539,10 +540,8 @@ typedef struct Note { /* 0x00 */ AudioListItem listItem; /* 0x10 */ NoteSynthesisState synthesisState; /* 0x30 */ NotePlaybackState playbackState; - /* 0x90 */ Portamento portamento; - /* 0x9C */ VibratoState vibratoState; /* 0xB8 */ char unk_B8[0x4]; - /* 0xBC */ u32 unk_BC; + /* 0xBC */ u32 startSamplePos; // initial position/index to start processing s16 samples /* 0xC0 */ NoteSubEu noteSubEu; } Note; // size = 0xE0 diff --git a/src/code/audio_effects.c b/src/code/audio_effects.c index 84fde3a305..9a6d1884a4 100644 --- a/src/code/audio_effects.c +++ b/src/code/audio_effects.c @@ -174,11 +174,11 @@ f32 Audio_GetVibratoFreqScale(VibratoState* vib) { } void Audio_NoteVibratoUpdate(Note* note) { - if (note->portamento.mode != 0) { - note->playbackState.portamentoFreqScale = Audio_GetPortamentoFreqScale(¬e->portamento); + if (note->playbackState.portamento.mode != 0) { + note->playbackState.portamentoFreqScale = Audio_GetPortamentoFreqScale(¬e->playbackState.portamento); } - if (note->vibratoState.active) { - note->playbackState.vibratoFreqScale = Audio_GetVibratoFreqScale(¬e->vibratoState); + if (note->playbackState.vibratoState.active) { + note->playbackState.vibratoFreqScale = Audio_GetVibratoFreqScale(¬e->playbackState.vibratoState); } } @@ -188,7 +188,7 @@ void Audio_NoteVibratoInit(Note* note) { note->playbackState.vibratoFreqScale = 1.0f; - vib = ¬e->vibratoState; + vib = ¬e->playbackState.vibratoState; vib->active = 1; vib->time = 0; @@ -212,7 +212,7 @@ void Audio_NoteVibratoInit(Note* note) { void Audio_NotePortamentoInit(Note* note) { note->playbackState.portamentoFreqScale = 1.0f; - note->portamento = note->playbackState.parentLayer->portamento; + note->playbackState.portamento = note->playbackState.parentLayer->portamento; } void Audio_AdsrInit(AdsrState* adsr, AdsrEnvelope* envelope, s16* volOut) { diff --git a/src/code/audio_playback.c b/src/code/audio_playback.c index fb9f77e817..02c9422d68 100644 --- a/src/code/audio_playback.c +++ b/src/code/audio_playback.c @@ -926,11 +926,11 @@ void Audio_NoteInitAll(void) { note->playbackState.attributes.velocity = 0.0f; note->playbackState.adsrVolScaleUnused = 0; note->playbackState.adsr.action.asByte = 0; - note->vibratoState.active = 0; - note->portamento.cur = 0; - note->portamento.speed = 0; + note->playbackState.vibratoState.active = 0; + note->playbackState.portamento.cur = 0; + note->playbackState.portamento.speed = 0; note->playbackState.stereoHeadsetEffects = false; - note->unk_BC = 0; + note->startSamplePos = 0; note->synthesisState.synthesisBuffers = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, 0x1E0); } } diff --git a/src/code/audio_synthesis.c b/src/code/audio_synthesis.c index 58135c3356..d50d1f4d48 100644 --- a/src/code/audio_synthesis.c +++ b/src/code/audio_synthesis.c @@ -745,7 +745,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS if (noteSubEu->bitField0.needsInit == true) { flags = A_INIT; synthState->restart = 0; - synthState->samplePosInt = note->unk_BC; + synthState->samplePosInt = note->startSamplePos; synthState->samplePosFrac = 0; synthState->curVolLeft = 0; synthState->curVolRight = 0;