mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-02-11 04:32:25 +03:00
Fixed implementation issues with CODEC_S16
This commit is contained in:
parent
93199b4c02
commit
3020f3bd95
@ -1036,21 +1036,23 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta
|
|||||||
goto skip;
|
goto skip;
|
||||||
|
|
||||||
case CODEC_S16:
|
case CODEC_S16:
|
||||||
|
aClearBuffer(cmd, DMEM_UNCOMPRESSED_NOTE, (numSamplesToLoadAdj + 16) * 2);
|
||||||
flags = A_CONTINUE;
|
flags = A_CONTINUE;
|
||||||
skipBytes = 0;
|
skipBytes = 0;
|
||||||
size_t bytesToRead;
|
|
||||||
numSamplesProcessed += numSamplesToLoadAdj;
|
numSamplesProcessed += numSamplesToLoadAdj;
|
||||||
dmemUncompressedAddrOffset1 = numSamplesToLoadAdj;
|
aligned = numSamplesToLoadAdj;
|
||||||
|
size_t bytesToRead;
|
||||||
|
|
||||||
if (((synthState->samplePosInt * 2) + (numSamplesToLoadAdj) * SAMPLE_SIZE) < bookSample->size) {
|
if (((synthState->samplePosInt * 2) + (numSamplesToLoadAdj + 16) * 2) <
|
||||||
bytesToRead = (numSamplesToLoadAdj) * SAMPLE_SIZE;
|
bookSample->size) {
|
||||||
|
bytesToRead = (numSamplesToLoadAdj + 16) * 2;
|
||||||
} else {
|
} else {
|
||||||
bytesToRead = bookSample->size - (synthState->samplePosInt * 2);
|
bytesToRead = bookSample->size - (synthState->samplePosInt * 2);
|
||||||
}
|
}
|
||||||
// @port [Custom audio]
|
// @port [Custom audio]
|
||||||
// TLDR samples are loaded async and might be null the first time they are played.
|
// TLDR samples are loaded async and might be null the first time they are played.
|
||||||
// See note in AudioSampleFactory.cpp
|
// See note in AudioSampleFactory.cpp
|
||||||
if (sampleAddr != NULL) {
|
if ((void*) sampleAddr != NULL) {
|
||||||
aLoadBuffer(cmd++, sampleAddr + (synthState->samplePosInt * 2), DMEM_UNCOMPRESSED_NOTE,
|
aLoadBuffer(cmd++, sampleAddr + (synthState->samplePosInt * 2), DMEM_UNCOMPRESSED_NOTE,
|
||||||
bytesToRead);
|
bytesToRead);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user