Don't Shut down the game with Error() if OpenAL buffer commands fail

based on a Patch from https://github.com/PROPHESSOR, see
https://github.com/dhewm/dhewm3/pull/184
(I added a common->Warning() as a compromise between common->Error()
 and just ignoring the error)
This commit is contained in:
Daniel Gibson 2018-02-12 03:20:31 +01:00
parent 47946bf1e4
commit ebac192352

View file

@ -364,7 +364,8 @@ void idSoundSample::MakeDefault( void ) {
alGetError();
alBufferData( openalBuffer, objectInfo.nChannels==1?AL_FORMAT_MONO16:AL_FORMAT_STEREO16, nonCacheData, objectMemSize, objectInfo.nSamplesPerSec );
if ( alGetError() != AL_NO_ERROR ) {
common->Error( "idSoundCache: error loading data into OpenAL hardware buffer" );
common->Warning( "idSoundCache: error loading data into OpenAL hardware buffer" );
hardwareBuffer = false;
} else {
hardwareBuffer = true;
}
@ -494,7 +495,8 @@ void idSoundSample::Load( void ) {
alGetError();
alBufferData( openalBuffer, objectInfo.nChannels==1?AL_FORMAT_MONO16:AL_FORMAT_STEREO16, nonCacheData, objectMemSize, objectInfo.nSamplesPerSec );
if ( alGetError() != AL_NO_ERROR ) {
common->Error( "idSoundCache: error loading data into OpenAL hardware buffer" );
common->Warning( "idSoundCache: error loading data into OpenAL hardware buffer" );
hardwareBuffer = false;
} else {
hardwareBuffer = true;
}
@ -546,9 +548,10 @@ void idSoundSample::Load( void ) {
alGetError();
alBufferData( openalBuffer, objectInfo.nChannels==1?AL_FORMAT_MONO16:AL_FORMAT_STEREO16, destData, objectSize * sizeof( short ), objectInfo.nSamplesPerSec );
if ( alGetError() != AL_NO_ERROR )
common->Error( "idSoundCache: error loading data into OpenAL hardware buffer" );
else {
if ( alGetError() != AL_NO_ERROR ) {
common->Warning( "idSoundCache: error loading data into OpenAL hardware buffer" );
hardwareBuffer = false;
} else {
hardwareBuffer = true;
}