Changed: Additional checks for streaming buffers in OpenAL

This commit is contained in:
kaetemi 2012-12-10 13:09:41 +01:00
parent 6c54ebe6aa
commit 6512526d95
2 changed files with 9 additions and 3 deletions

View file

@ -120,7 +120,7 @@ bool CBufferAL::unlock(uint size)
// Error handling // Error handling
if (alGetError() == AL_NO_ERROR) if (alGetError() == AL_NO_ERROR)
_IsLoaded = true; _IsLoaded = true; // ->lock() set it to false
return _IsLoaded; return _IsLoaded;
} }
@ -161,8 +161,7 @@ bool CBufferAL::fill(const uint8 *src, uint size)
alBufferData(_BufferName, _SampleFormat, src, size, _Frequency); alBufferData(_BufferName, _SampleFormat, src, size, _Frequency);
// Error handling // Error handling
if (alGetError() == AL_NO_ERROR) _IsLoaded = (alGetError() == AL_NO_ERROR);
_IsLoaded = true;
return _IsLoaded; return _IsLoaded;
} }

View file

@ -162,6 +162,13 @@ void CSourceAL::submitStreamingBuffer(IBuffer *buffer)
CBufferAL *bufferAL = static_cast<CBufferAL *>(buffer); CBufferAL *bufferAL = static_cast<CBufferAL *>(buffer);
ALuint bufferName = bufferAL->bufferName(); ALuint bufferName = bufferAL->bufferName();
nlassert(bufferName); nlassert(bufferName);
if (!bufferAL->isBufferLoaded())
{
nlwarning("AL: Streaming buffer was not loaded, skipping buffer. This should not happen.");
return;
}
alSourceQueueBuffers(_Source, 1, &bufferName); alSourceQueueBuffers(_Source, 1, &bufferName);
alTestError(); alTestError();
_QueuedBuffers.push(bufferAL); _QueuedBuffers.push(bufferAL);