mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-21 08:28:44 +00:00
Fixed: ugly fix to not crash when we cannot create a buffer #1116
This commit is contained in:
parent
23f89c8d90
commit
d2bc4b288a
1 changed files with 16 additions and 9 deletions
|
@ -890,15 +890,22 @@ void CSourceAL::setStreamingBuffersMax(uint buffers)
|
||||||
unqueueBuffers();
|
unqueueBuffers();
|
||||||
removeBuffers();
|
removeBuffers();
|
||||||
|
|
||||||
for(uint i = 0; i < _BuffersMax; ++i)
|
for(uint i = 0; i < _BuffersMax; ++i)
|
||||||
{
|
{
|
||||||
// create a new buffer
|
try {
|
||||||
CBufferAL *buffer = static_cast<CBufferAL*>(_SoundDriver->createBuffer());
|
// create a new buffer
|
||||||
// use StorageSoftware because buffers will be reused
|
CBufferAL *buffer = static_cast<CBufferAL*>(_SoundDriver->createBuffer());
|
||||||
// deleting and recreating them is a waste of time
|
// use StorageSoftware because buffers will be reused
|
||||||
buffer->setStorageMode(IBuffer::StorageSoftware);
|
// deleting and recreating them is a waste of time
|
||||||
_Buffers[buffer->bufferName()] = buffer;
|
buffer->setStorageMode(IBuffer::StorageSoftware);
|
||||||
}
|
_Buffers[buffer->bufferName()] = buffer;
|
||||||
|
} catch(ESoundDriverGenBuf &e) {
|
||||||
|
nlwarning("Cannot create %d buffers. openal fails after %d buffers", buffers, i);
|
||||||
|
_BuffersMax = i;
|
||||||
|
_BuffersName.resize(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the default size for streaming buffers
|
/// Set the default size for streaming buffers
|
||||||
|
|
Loading…
Reference in a new issue