1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-18 05:44:53 +00:00

Audio Docs: Adsr Decay Rate (#1238)

* Init adsr decay docs

* cleanup

* cleanup

* Revert some docs

* Cleaner docs

* count hex to dec

* scaled updates per frame

* Consistency

* Oops, fix meaning

* Avoid `decayRate` conflict with reverb `decayRate`

* PR suggestion
This commit is contained in:
engineer124 2022-05-30 04:31:43 +10:00 committed by GitHub
parent d39ce02458
commit 8f1fd58f22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 47 deletions

View file

@ -125,7 +125,7 @@ void Audio_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput)
}
void Audio_NoteInit(Note* note) {
if (note->playbackState.parentLayer->adsr.releaseRate == 0) {
if (note->playbackState.parentLayer->adsr.decayIndex == 0) {
Audio_AdsrInit(&note->playbackState.adsr, note->playbackState.parentLayer->channel->adsr.envelope,
&note->playbackState.adsrVolScaleUnused);
} else {
@ -506,10 +506,10 @@ void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
} else {
note->playbackState.unk_04 = 1;
note->playbackState.adsr.action.s.decay = true;
if (layer->adsr.releaseRate == 0) {
note->playbackState.adsr.fadeOutVel = gAudioContext.unk_3520[layer->channel->adsr.releaseRate];
if (layer->adsr.decayIndex == 0) {
note->playbackState.adsr.fadeOutVel = gAudioContext.adsrDecayTable[layer->channel->adsr.decayIndex];
} else {
note->playbackState.adsr.fadeOutVel = gAudioContext.unk_3520[layer->adsr.releaseRate];
note->playbackState.adsr.fadeOutVel = gAudioContext.adsrDecayTable[layer->adsr.decayIndex];
}
note->playbackState.adsr.sustain =
((f32)(s32)(layer->channel->adsr.sustain) * note->playbackState.adsr.current) / 256.0f;