Fixes OpenAL errors

This commit is contained in:
smallmodel 2024-07-01 17:39:47 +02:00
parent 74ff3b920e
commit ae13be0c37
No known key found for this signature in database
GPG key ID: A96F163ED4891440

View file

@ -2827,7 +2827,7 @@ openal_channel::set_sfx
*/ */
bool openal_channel::set_sfx(sfx_t *pSfx) bool openal_channel::set_sfx(sfx_t *pSfx)
{ {
ALfloat freq = 0; ALint freq = 0;
this->pSfx = pSfx; this->pSfx = pSfx;
if (!pSfx->buffer || !qalIsBuffer(pSfx->buffer)) { if (!pSfx->buffer || !qalIsBuffer(pSfx->buffer)) {
@ -2893,7 +2893,7 @@ bool openal_channel::set_sfx(sfx_t *pSfx)
alDieIfError(); alDieIfError();
// Get the base frequency // Get the base frequency
qalGetBufferfv(pSfx->buffer, AL_FREQUENCY, &freq); qalGetBufferi(pSfx->buffer, AL_FREQUENCY, &freq);
alDieIfError(); alDieIfError();
iBaseRate = freq; iBaseRate = freq;
@ -3062,9 +3062,11 @@ void openal_channel::set_sample_loop_count(S32 count)
alDieIfError(); alDieIfError();
} }
for (S32 i = 0; i < count; i++) { if (buffer) {
qalSourceQueueBuffers(source, 1, &buffer); for (S32 i = 0; i < count; i++) {
alDieIfError(); qalSourceQueueBuffers(source, 1, &buffer);
alDieIfError();
}
} }
} }