Fixed: ugly fix to not crash when we cannot create a buffer #1116
This commit is contained in:
parent
00cb427b90
commit
629065a528
1 changed files with 16 additions and 9 deletions
|
@ -892,12 +892,19 @@ void CSourceAL::setStreamingBuffersMax(uint buffers)
|
|||
|
||||
for(uint i = 0; i < _BuffersMax; ++i)
|
||||
{
|
||||
try {
|
||||
// create a new buffer
|
||||
CBufferAL *buffer = static_cast<CBufferAL*>(_SoundDriver->createBuffer());
|
||||
// use StorageSoftware because buffers will be reused
|
||||
// deleting and recreating them is a waste of time
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue