diff options
| author | engineer124 <47598039+engineer124@users.noreply.github.com> | 2023-06-25 09:56:48 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-24 19:56:48 -0400 |
| commit | 21655f31c5278bb367dcb67ecea1104eb00f6142 (patch) | |
| tree | 70b3dde36de55a14fff7e34a3fbafb4203dfc2a4 /src/audio | |
| parent | 9b341a4d6a721b46baa81ee2f47815b6073f5096 (diff) | |
Audio Effects Cleanup (#1295)
* audio effects cleanup
* more cleanup
* header comments
* more docs
* cleanup
* file name fix
* swap if
* more cleanup
* move comment
* ADSR notes
* fix bss, pr review
Diffstat (limited to 'src/audio')
| -rw-r--r-- | src/audio/lib/effects.c | 154 | ||||
| -rw-r--r-- | src/audio/lib/heap.c | 3 | ||||
| -rw-r--r-- | src/audio/lib/playback.c | 39 | ||||
| -rw-r--r-- | src/audio/lib/seqplayer.c | 20 | ||||
| -rw-r--r-- | src/audio/lib/thread.c | 3 |
5 files changed, 117 insertions, 102 deletions
diff --git a/src/audio/lib/effects.c b/src/audio/lib/effects.c index 580b7fd22..93d895514 100644 --- a/src/audio/lib/effects.c +++ b/src/audio/lib/effects.c @@ -1,6 +1,18 @@ +/** + * @file effects.c + * + * The first half of this file processes sound on the seqPlayer, channel, and layer level + * once the .seq file is finished for this update. + * + * The second half of this file implements three types of audio effects over long periods of times: + * - Vibrato: regular, pulsating change of pitch + * - Portamento: pitch sliding from one note to another + * - Multi-Point ADSR Envelope: volume changing over time through Attack, Decay, Sustain, Release + */ #include "global.h" +#include "audio/effects.h" -void AudioEffects_SequenceChannelProcessSound(SequenceChannel* channel, s32 recalculateVolume, s32 applyBend) { +void AudioScript_SequenceChannelProcessSound(SequenceChannel* channel, s32 recalculateVolume, s32 applyBend) { f32 channelVolume; f32 chanFreqScale; s32 i; @@ -8,7 +20,7 @@ void AudioEffects_SequenceChannelProcessSound(SequenceChannel* channel, s32 reca if (channel->changes.s.volume || recalculateVolume) { channelVolume = channel->volume * channel->volumeScale * channel->seqPlayer->appliedFadeVolume; if (channel->seqPlayer->muted && (channel->muteFlags & MUTE_FLAGS_SOFTEN)) { - channelVolume = channel->seqPlayer->muteVolumeScale * channelVolume; + channelVolume = channelVolume * channel->seqPlayer->muteVolumeScale; } channel->appliedVolume = SQ(channelVolume); } @@ -48,7 +60,7 @@ void AudioEffects_SequenceChannelProcessSound(SequenceChannel* channel, s32 reca channel->changes.asByte = 0; } -void AudioEffects_SequencePlayerProcessSound(SequencePlayer* seqPlayer) { +void AudioScript_SequencePlayerProcessSound(SequencePlayer* seqPlayer) { s32 i; if ((seqPlayer->fadeTimer != 0) && (seqPlayer->skipTicks == 0)) { @@ -73,29 +85,32 @@ void AudioEffects_SequencePlayerProcessSound(SequencePlayer* seqPlayer) { seqPlayer->appliedFadeVolume = seqPlayer->fadeVolume * seqPlayer->fadeVolumeScale; } - for (i = 0; i < ARRAY_COUNT(seqPlayer->channels); i++) { + for (i = 0; i < SEQ_NUM_CHANNELS; i++) { if (seqPlayer->channels[i]->enabled == true) { - AudioEffects_SequenceChannelProcessSound(seqPlayer->channels[i], seqPlayer->recalculateVolume, - seqPlayer->applyBend); + AudioScript_SequenceChannelProcessSound(seqPlayer->channels[i], seqPlayer->recalculateVolume, + seqPlayer->applyBend); } } seqPlayer->recalculateVolume = false; } -f32 AudioEffects_GetPortamentoFreqScale(Portamento* portamento) { - u32 loResCur; +/** + * @return freqScale + */ +f32 AudioEffects_UpdatePortamento(Portamento* portamento) { + u32 bendIndex; f32 portamentoFreq; portamento->cur += portamento->speed; - loResCur = (portamento->cur >> 8) & 0xFF; + bendIndex = (portamento->cur >> 8) & 0xFF; - if (loResCur >= 127) { - loResCur = 127; - portamento->mode = 0; + if (bendIndex >= 127) { + bendIndex = 127; + portamento->mode = PORTAMENTO_MODE_OFF; } - portamentoFreq = AUDIO_LERPIMP(1.0f, gBendPitchOneOctaveFrequencies[loResCur + 128], portamento->extent); + portamentoFreq = AUDIO_LERPIMP(1.0f, gBendPitchOneOctaveFrequencies[bendIndex + 128], portamento->extent); return portamentoFreq; } @@ -104,13 +119,17 @@ s16 AudioEffects_GetVibratoPitchChange(VibratoState* vib) { s32 index; vib->time += (s32)vib->rate; - index = (vib->time >> 10) & 0x3F; + // 0x400 is 1 unit of time, 0x10000 is 1 period + index = (vib->time / 0x400) % WAVE_SAMPLE_COUNT; return vib->curve[index]; } -f32 AudioEffects_GetVibratoFreqScale(VibratoState* vib) { - static f32 activeVibratoFreqScaleSum = 0.0f; - static s32 activeVibratoCount = 0; +/** + * @return freqScale + */ +f32 AudioEffects_UpdateVibrato(VibratoState* vib) { + static f32 sActiveVibratoFreqScaleSum = 0.0f; + static s32 sActiveVibratoCount = 0; f32 pitchChange; f32 depth; f32 invDepth; @@ -124,7 +143,7 @@ f32 AudioEffects_GetVibratoFreqScale(VibratoState* vib) { } if (subVib != NULL) { - if (vib->depthChangeTimer) { + if ((u32)vib->depthChangeTimer != 0) { if (vib->depthChangeTimer == 1) { vib->depth = (s32)subVib->vibratoDepthTarget; } else { @@ -138,7 +157,7 @@ f32 AudioEffects_GetVibratoFreqScale(VibratoState* vib) { } } - if (vib->rateChangeTimer) { + if ((u32)vib->rateChangeTimer != 0) { if (vib->rateChangeTimer == 1) { vib->rate = (s32)subVib->vibratoRateTarget; } else { @@ -157,38 +176,40 @@ f32 AudioEffects_GetVibratoFreqScale(VibratoState* vib) { return 1.0f; } - pitchChange = AudioEffects_GetVibratoPitchChange(vib) + 32768.0f; + pitchChange = (f32)AudioEffects_GetVibratoPitchChange(vib) + 0x8000; scaledDepth = vib->depth / 4096.0f; depth = scaledDepth + 1.0f; invDepth = 1.0f / depth; - // inverse linear interpolation - result = 1.0f / ((depth - invDepth) * pitchChange / 65536.0f + invDepth); + // Inverse linear interpolation + result = 1.0f / ((depth - invDepth) * pitchChange / 0x10000 + invDepth); - activeVibratoFreqScaleSum += result; - activeVibratoCount++; + sActiveVibratoFreqScaleSum += result; + sActiveVibratoCount++; return result; } -void AudioEffects_NoteVibratoUpdate(Note* note) { - if (note->playbackState.portamento.mode != 0) { - note->playbackState.portamentoFreqScale = AudioEffects_GetPortamentoFreqScale(¬e->playbackState.portamento); +void AudioEffects_UpdatePortamentoAndVibrato(Note* note) { + // Update Portamento + if (note->playbackState.portamento.mode != PORTAMENTO_MODE_OFF) { + note->playbackState.portamentoFreqScale = AudioEffects_UpdatePortamento(¬e->playbackState.portamento); } + // Update Vibrato if (note->playbackState.vibratoState.active) { - note->playbackState.vibratoFreqScale = AudioEffects_GetVibratoFreqScale(¬e->playbackState.vibratoState); + note->playbackState.vibratoFreqScale = AudioEffects_UpdateVibrato(¬e->playbackState.vibratoState); } } -void AudioEffects_NoteVibratoInit(Note* note) { +void AudioEffects_InitVibrato(Note* note) { NotePlaybackState* playbackState = ¬e->playbackState; VibratoState* vib = &playbackState->vibratoState; VibratoSubStruct* subVib; vib->active = true; - vib->curve = gWaveSamples[2]; + vib->curve = gWaveSamples[2]; // gSineWaveSample - if (playbackState->parentLayer->unk_0A.s.bit_3 == 1) { + if (playbackState->parentLayer->unk_0A.s.useVibrato == true) { vib->vibSubStruct = &playbackState->parentLayer->channel->vibrato; } else { vib->vibSubStruct = &playbackState->parentLayer->vibrato; @@ -213,12 +234,12 @@ void AudioEffects_NoteVibratoInit(Note* note) { vib->delay = subVib->vibratoDelay; } -void AudioEffects_NotePortamentoInit(Note* note) { +void AudioEffects_InitPortamento(Note* note) { note->playbackState.portamentoFreqScale = 1.0f; note->playbackState.portamento = note->playbackState.parentLayer->portamento; } -void AudioEffects_AdsrInit(AdsrState* adsr, EnvelopePoint* envelope, s16* volOut) { +void AudioEffects_InitAdsr(AdsrState* adsr, EnvelopePoint* envelope, s16* volOut) { adsr->action.asByte = 0; adsr->delay = 0; adsr->envelope = envelope; @@ -230,41 +251,44 @@ void AudioEffects_AdsrInit(AdsrState* adsr, EnvelopePoint* envelope, s16* volOut // removed, but the function parameter was forgotten and remains.) } -f32 AudioEffects_AdsrUpdate(AdsrState* adsr) { - u8 state = adsr->action.s.state; +/** + * @return volumeScale + */ +f32 AudioEffects_UpdateAdsr(AdsrState* adsr) { + u8 status = adsr->action.s.status; - switch (state) { - case ADSR_STATE_DISABLED: + switch (status) { + case ADSR_STATUS_DISABLED: return 0.0f; - case ADSR_STATE_INITIAL: + case ADSR_STATUS_INITIAL: if (adsr->action.s.hang) { - adsr->action.s.state = ADSR_STATE_HANG; + adsr->action.s.status = ADSR_STATUS_HANG; break; } // fallthrough - case ADSR_STATE_START_LOOP: - adsr->envIndex = 0; - adsr->action.s.state = ADSR_STATE_LOOP; + case ADSR_STATUS_START_LOOP: + adsr->envelopeIndex = 0; + adsr->action.s.status = ADSR_STATUS_LOOP; // fallthrough retry: - case ADSR_STATE_LOOP: - adsr->delay = adsr->envelope[adsr->envIndex].delay; + case ADSR_STATUS_LOOP: + adsr->delay = adsr->envelope[adsr->envelopeIndex].delay; switch (adsr->delay) { case ADSR_DISABLE: - adsr->action.s.state = ADSR_STATE_DISABLED; + adsr->action.s.status = ADSR_STATUS_DISABLED; break; case ADSR_HANG: - adsr->action.s.state = ADSR_STATE_HANG; + adsr->action.s.status = ADSR_STATUS_HANG; break; case ADSR_GOTO: - adsr->envIndex = adsr->envelope[adsr->envIndex].arg; + adsr->envelopeIndex = adsr->envelope[adsr->envelopeIndex].arg; goto retry; case ADSR_RESTART: - adsr->action.s.state = ADSR_STATE_INITIAL; + adsr->action.s.status = ADSR_STATUS_INITIAL; break; default: @@ -272,60 +296,60 @@ f32 AudioEffects_AdsrUpdate(AdsrState* adsr) { if (adsr->delay == 0) { adsr->delay = 1; } - adsr->target = adsr->envelope[adsr->envIndex].arg / 32767.0f; - adsr->target = adsr->target * adsr->target; + adsr->target = adsr->envelope[adsr->envelopeIndex].arg / 32767.0f; + adsr->target = SQ(adsr->target); adsr->velocity = (adsr->target - adsr->current) / adsr->delay; - adsr->action.s.state = ADSR_STATE_FADE; - adsr->envIndex++; + adsr->action.s.status = ADSR_STATUS_FADE; + adsr->envelopeIndex++; break; } - if (adsr->action.s.state != ADSR_STATE_FADE) { + if (adsr->action.s.status != ADSR_STATUS_FADE) { break; } // fallthrough - case ADSR_STATE_FADE: + case ADSR_STATUS_FADE: adsr->current += adsr->velocity; adsr->delay--; if (adsr->delay <= 0) { - adsr->action.s.state = ADSR_STATE_LOOP; + adsr->action.s.status = ADSR_STATUS_LOOP; } // fallthrough - case ADSR_STATE_HANG: + case ADSR_STATUS_HANG: break; - case ADSR_STATE_DECAY: - case ADSR_STATE_RELEASE: + case ADSR_STATUS_DECAY: + case ADSR_STATUS_RELEASE: adsr->current -= adsr->fadeOutVel; - if (adsr->sustain != 0.0f && state == ADSR_STATE_DECAY) { + if ((adsr->sustain != 0.0f) && (status == ADSR_STATUS_DECAY)) { if (adsr->current < adsr->sustain) { adsr->current = adsr->sustain; adsr->delay = 128; - adsr->action.s.state = ADSR_STATE_SUSTAIN; + adsr->action.s.status = ADSR_STATUS_SUSTAIN; } break; } if (adsr->current < 0.00001f) { adsr->current = 0.0f; - adsr->action.s.state = ADSR_STATE_DISABLED; + adsr->action.s.status = ADSR_STATUS_DISABLED; } break; - case ADSR_STATE_SUSTAIN: + case ADSR_STATUS_SUSTAIN: adsr->delay--; if (adsr->delay == 0) { - adsr->action.s.state = ADSR_STATE_RELEASE; + adsr->action.s.status = ADSR_STATUS_RELEASE; } break; } if (adsr->action.s.decay) { - adsr->action.s.state = ADSR_STATE_DECAY; + adsr->action.s.status = ADSR_STATUS_DECAY; adsr->action.s.decay = false; } if (adsr->action.s.release) { - adsr->action.s.state = ADSR_STATE_RELEASE; + adsr->action.s.status = ADSR_STATUS_RELEASE; adsr->action.s.release = false; } diff --git a/src/audio/lib/heap.c b/src/audio/lib/heap.c index 5d8dfee89..24bb7043d 100644 --- a/src/audio/lib/heap.c +++ b/src/audio/lib/heap.c @@ -1,4 +1,5 @@ #include "global.h" +#include "audio/effects.h" void* AudioHeap_SearchRegularCaches(s32 tableType, s32 cache, s32 id); void AudioHeap_InitSampleCaches(size_t persistentSampleCacheSize, size_t temporarySampleCacheSize); @@ -870,7 +871,7 @@ s32 AudioHeap_ResetStep(void) { } else { for (i = 0; i < gAudioCtx.numNotes; i++) { if (gAudioCtx.notes[i].sampleState.bitField0.enabled && - gAudioCtx.notes[i].playbackState.adsr.action.s.state != ADSR_STATE_DISABLED) { + gAudioCtx.notes[i].playbackState.adsr.action.s.status != ADSR_STATUS_DISABLED) { gAudioCtx.notes[i].playbackState.adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv; gAudioCtx.notes[i].playbackState.adsr.action.s.release = true; diff --git a/src/audio/lib/playback.c b/src/audio/lib/playback.c index a626645c5..6bc5e3943 100644 --- a/src/audio/lib/playback.c +++ b/src/audio/lib/playback.c @@ -1,4 +1,5 @@ #include "global.h" +#include "audio/effects.h" void AudioPlayback_NoteSetResamplingRate(NoteSampleState* sampleState, f32 resamplingRateInput); void AudioPlayback_AudioListPushFront(AudioListItem* list, AudioListItem* item); @@ -134,15 +135,15 @@ void AudioPlayback_NoteSetResamplingRate(NoteSampleState* sampleState, f32 resam void AudioPlayback_NoteInit(Note* note) { if (note->playbackState.parentLayer->adsr.decayIndex == 0) { - AudioEffects_AdsrInit(¬e->playbackState.adsr, note->playbackState.parentLayer->channel->adsr.envelope, + AudioEffects_InitAdsr(¬e->playbackState.adsr, note->playbackState.parentLayer->channel->adsr.envelope, ¬e->playbackState.adsrVolScaleUnused); } else { - AudioEffects_AdsrInit(¬e->playbackState.adsr, note->playbackState.parentLayer->adsr.envelope, + AudioEffects_InitAdsr(¬e->playbackState.adsr, note->playbackState.parentLayer->adsr.envelope, ¬e->playbackState.adsrVolScaleUnused); } note->playbackState.status = PLAYBACK_STATUS_0; - note->playbackState.adsr.action.s.state = ADSR_STATE_INITIAL; + note->playbackState.adsr.action.s.status = ADSR_STATUS_INITIAL; note->sampleState = gDefaultSampleState; } @@ -156,7 +157,7 @@ void AudioPlayback_NoteDisable(Note* note) { note->sampleState.bitField0.finished = false; note->playbackState.parentLayer = NO_LAYER; note->playbackState.prevParentLayer = NO_LAYER; - note->playbackState.adsr.action.s.state = ADSR_STATE_DISABLED; + note->playbackState.adsr.action.s.status = ADSR_STATUS_DISABLED; note->playbackState.adsr.current = 0; } @@ -170,7 +171,7 @@ void AudioPlayback_ProcessNotes(void) { NotePlaybackState* playbackState; NoteSubAttributes subAttrs; u8 bookOffset; - f32 scale; + f32 adsrVolumeScale; s32 i; for (i = 0; i < gAudioCtx.numNotes; i++) { @@ -218,14 +219,14 @@ void AudioPlayback_ProcessNotes(void) { if (1) {} noteSampleState = ¬e->sampleState; if ((playbackState->status >= 1) || noteSampleState->bitField0.finished) { - if ((playbackState->adsr.action.s.state == ADSR_STATE_DISABLED) || + if ((playbackState->adsr.action.s.status == ADSR_STATUS_DISABLED) || noteSampleState->bitField0.finished) { if (playbackState->wantedParentLayer != NO_LAYER) { AudioPlayback_NoteDisable(note); if (playbackState->wantedParentLayer->channel != NULL) { AudioPlayback_NoteInitForLayer(note, playbackState->wantedParentLayer); - AudioEffects_NoteVibratoInit(note); - AudioEffects_NotePortamentoInit(note); + AudioEffects_InitVibrato(note); + AudioEffects_InitPortamento(note); AudioPlayback_AudioListRemove(¬e->listItem); AudioScript_AudioListPushBack(¬e->listItem.pool->active, ¬e->listItem); playbackState->wantedParentLayer = NO_LAYER; @@ -247,7 +248,7 @@ void AudioPlayback_ProcessNotes(void) { continue; } } - } else if (playbackState->adsr.action.s.state == ADSR_STATE_DISABLED) { + } else if (playbackState->adsr.action.s.status == ADSR_STATUS_DISABLED) { if (playbackState->parentLayer != NO_LAYER) { playbackState->parentLayer->bit1 = true; } @@ -257,8 +258,8 @@ void AudioPlayback_ProcessNotes(void) { continue; } - scale = AudioEffects_AdsrUpdate(&playbackState->adsr); - AudioEffects_NoteVibratoUpdate(note); + adsrVolumeScale = AudioEffects_UpdateAdsr(&playbackState->adsr); + AudioEffects_UpdatePortamentoAndVibrato(note); playbackStatus = playbackState->status; attrs = &playbackState->attributes; if ((playbackStatus == PLAYBACK_STATUS_1) || (playbackStatus == PLAYBACK_STATUS_2)) { @@ -320,7 +321,7 @@ void AudioPlayback_ProcessNotes(void) { subAttrs.frequency *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale; subAttrs.frequency *= gAudioCtx.audioBufferParameters.resampleRate; - subAttrs.velocity *= scale; + subAttrs.velocity *= adsrVolumeScale; AudioPlayback_InitSampleState(note, sampleState, &subAttrs); noteSampleState->bitField1.bookOffset = bookOffset; skip:; @@ -490,14 +491,14 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) { if (note->playbackState.parentLayer != layer) { if (note->playbackState.parentLayer == NO_LAYER && note->playbackState.wantedParentLayer == NO_LAYER && - note->playbackState.prevParentLayer == layer && target != ADSR_STATE_DECAY) { + note->playbackState.prevParentLayer == layer && target != ADSR_STATUS_DECAY) { note->playbackState.adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv; note->playbackState.adsr.action.s.release = true; } return; } - if (note->playbackState.adsr.action.s.state != ADSR_STATE_DECAY) { + if (note->playbackState.adsr.action.s.status != ADSR_STATUS_DECAY) { attrs->freqScale = layer->noteFreqScale; attrs->velocity = layer->noteVelocity; attrs->pan = layer->notePan; @@ -551,7 +552,7 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) { note->playbackState.prevParentLayer = note->playbackState.parentLayer; note->playbackState.parentLayer = NO_LAYER; - if (target == ADSR_STATE_RELEASE) { + if (target == ADSR_STATUS_RELEASE) { note->playbackState.adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv; note->playbackState.adsr.action.s.release = true; note->playbackState.status = PLAYBACK_STATUS_2; @@ -568,18 +569,18 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) { } } - if (target == ADSR_STATE_DECAY) { + if (target == ADSR_STATUS_DECAY) { AudioPlayback_AudioListRemove(¬e->listItem); AudioPlayback_AudioListPushFront(¬e->listItem.pool->decaying, ¬e->listItem); } } void AudioPlayback_SeqLayerNoteDecay(SequenceLayer* layer) { - AudioPlayback_SeqLayerDecayRelease(layer, ADSR_STATE_DECAY); + AudioPlayback_SeqLayerDecayRelease(layer, ADSR_STATUS_DECAY); } void AudioPlayback_SeqLayerNoteRelease(SequenceLayer* layer) { - AudioPlayback_SeqLayerDecayRelease(layer, ADSR_STATE_RELEASE); + AudioPlayback_SeqLayerDecayRelease(layer, ADSR_STATUS_RELEASE); } /** @@ -600,7 +601,7 @@ s32 AudioPlayback_BuildSyntheticWave(Note* note, SequenceLayer* layer, s32 waveI } freqScale = layer->freqScale; - if ((layer->portamento.mode != 0) && (0.0f < layer->portamento.extent)) { + if ((layer->portamento.mode != PORTAMENTO_MODE_OFF) && (layer->portamento.extent > 0.0f)) { freqScale *= (layer->portamento.extent + 1.0f); } diff --git a/src/audio/lib/seqplayer.c b/src/audio/lib/seqplayer.c index 270164972..34ec93a7b 100644 --- a/src/audio/lib/seqplayer.c +++ b/src/audio/lib/seqplayer.c @@ -15,20 +15,8 @@ */ #include "global.h" -#define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80) -#define PORTAMENTO_MODE(x) ((x).mode & ~0x80) - #define PROCESS_SCRIPT_END -1 -typedef enum { - /* 0 */ PORTAMENTO_MODE_OFF, - /* 1 */ PORTAMENTO_MODE_1, - /* 2 */ PORTAMENTO_MODE_2, - /* 3 */ PORTAMENTO_MODE_3, - /* 4 */ PORTAMENTO_MODE_4, - /* 5 */ PORTAMENTO_MODE_5 -} PortamentoMode; - u8 AudioScript_ScriptReadU8(SeqScriptState* state); s16 AudioScript_ScriptReadS16(SeqScriptState* state); u16 AudioScript_ScriptReadCompressedU16(SeqScriptState* state); @@ -634,7 +622,7 @@ s32 AudioScript_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSa note = layer->note; if (note->playbackState.parentLayer == layer) { - AudioEffects_NoteVibratoInit(note); + AudioEffects_InitVibrato(note); } } } @@ -642,7 +630,7 @@ s32 AudioScript_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSa if ((layer->note != NULL) && (layer->note->playbackState.parentLayer == layer)) { note = layer->note; - AudioEffects_NotePortamentoInit(note); + AudioEffects_InitPortamento(note); } return 0; @@ -2204,7 +2192,7 @@ void AudioScript_ProcessSequences(s32 arg0) { seqPlayer = &gAudioCtx.seqPlayers[i]; if (seqPlayer->enabled == true) { AudioScript_SequencePlayerProcessSequence(seqPlayer); - AudioEffects_SequencePlayerProcessSound(seqPlayer); + AudioScript_SequencePlayerProcessSound(seqPlayer); } } @@ -2214,7 +2202,7 @@ void AudioScript_ProcessSequences(s32 arg0) { void AudioScript_SkipForwardSequence(SequencePlayer* seqPlayer) { while (seqPlayer->skipTicks > 0) { AudioScript_SequencePlayerProcessSequence(seqPlayer); - AudioEffects_SequencePlayerProcessSound(seqPlayer); + AudioScript_SequencePlayerProcessSound(seqPlayer); seqPlayer->skipTicks--; } } diff --git a/src/audio/lib/thread.c b/src/audio/lib/thread.c index 082e77a67..fe4804693 100644 --- a/src/audio/lib/thread.c +++ b/src/audio/lib/thread.c @@ -4,6 +4,7 @@ * Top-level file that coordinates all audio code on the audio thread. */ #include "global.h" +#include "audio/effects.h" AudioTask* AudioThread_UpdateImpl(void); void AudioThread_SetFadeOutTimer(s32 seqPlayerIndex, s32 fadeTimer); @@ -938,7 +939,7 @@ s32 AudioThread_CountAndReleaseNotes(s32 flags) { playbackState = ¬e->playbackState; if (note->sampleState.bitField0.enabled) { noteSampleState = ¬e->sampleState; - if (playbackState->adsr.action.s.state != ADSR_STATE_DISABLED) { + if (playbackState->adsr.action.s.status != ADSR_STATUS_DISABLED) { if (flags >= AUDIO_NOTE_SAMPLE_NOTES) { tunedSample = noteSampleState->tunedSample; if ((tunedSample == NULL) || noteSampleState->bitField1.isSyntheticWave) { |
