mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-11 03:39:59 +00:00
Cleanup NotePlaybackState (#1255)
* Audio Cleanup * more * missed one * Audio docs imported from MM * Suggestions from Discord * Small fix * Fix sizes in z64audio.h * numSamples * Cleanup comments * Revert overlap with soundFont PR * revert Audio_AdsrUpdate cleanup (move to different PR) * PR Suggestion * Mainly typos * PR suggestion, vol -> volume * Better description * Name sampling frequency * A good number of PR suggestions * Missed a suggestion * More PR Suggestions * Cleanup NotePlaybackState * one more * Add comments for new variable names * Reverb samplePosInt * Missed one * Remove `Always set to 0`
This commit is contained in:
parent
1a41694d58
commit
bd4912a1bd
4 changed files with 15 additions and 16 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue