diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2025-02-03 11:48:30 -0600 |
|---|---|---|
| committer | Lywx <kiritodev01@gmail.com> | 2025-02-03 20:57:27 -0600 |
| commit | 3020f3bd95676d2830a8310b92017880404958ad (patch) | |
| tree | e817fbe806d78ab96498f74eb44d4dd25921a590 | |
| parent | 93199b4c02eca1364359e88fdd700386d6fc8bf0 (diff) | |
Fixed implementation issues with CODEC_S16
| -rw-r--r-- | src/audio/audio_synthesis.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/audio/audio_synthesis.c b/src/audio/audio_synthesis.c index a9f16173..93cb7b1b 100644 --- a/src/audio/audio_synthesis.c +++ b/src/audio/audio_synthesis.c @@ -1036,21 +1036,23 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta goto skip; case CODEC_S16: + aClearBuffer(cmd, DMEM_UNCOMPRESSED_NOTE, (numSamplesToLoadAdj + 16) * 2); flags = A_CONTINUE; skipBytes = 0; - size_t bytesToRead; numSamplesProcessed += numSamplesToLoadAdj; - dmemUncompressedAddrOffset1 = numSamplesToLoadAdj; + aligned = numSamplesToLoadAdj; + size_t bytesToRead; - if (((synthState->samplePosInt * 2) + (numSamplesToLoadAdj) * SAMPLE_SIZE) < bookSample->size) { - bytesToRead = (numSamplesToLoadAdj) * SAMPLE_SIZE; + if (((synthState->samplePosInt * 2) + (numSamplesToLoadAdj + 16) * 2) < + bookSample->size) { + bytesToRead = (numSamplesToLoadAdj + 16) * 2; } else { bytesToRead = bookSample->size - (synthState->samplePosInt * 2); } // @port [Custom audio] // TLDR samples are loaded async and might be null the first time they are played. // See note in AudioSampleFactory.cpp - if (sampleAddr != NULL) { + if ((void*) sampleAddr != NULL) { aLoadBuffer(cmd++, sampleAddr + (synthState->samplePosInt * 2), DMEM_UNCOMPRESSED_NOTE, bytesToRead); } |
