From: ehofman Date: Wed, 13 Jan 2010 14:29:59 +0000 (+0000) Subject: test for an AL or ALC error before calling an ALUT function. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=176e760de1166ff73ab87534cfc1db1572cd7982;p=simgear.git test for an AL or ALC error before calling an ALUT function. --- diff --git a/simgear/sound/soundmgr_openal.cxx b/simgear/sound/soundmgr_openal.cxx index a9db312e..ea6c60d7 100644 --- a/simgear/sound/soundmgr_openal.cxx +++ b/simgear/sound/soundmgr_openal.cxx @@ -552,12 +552,14 @@ bool SGSoundMgr::load(string &samplepath, void **dbuf, int *fmt, #if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1 ALfloat freqf; + testForALError("load file"); + testForALCError("load file"); data = alutLoadMemoryFromFile(samplepath.c_str(), &format, &size, &freqf ); freq = (ALsizei)freqf; int error = alutGetError(); if (data == NULL || error != ALUT_ERROR_NO_ERROR) { string msg = "Failed to load wav file: "; - msg.append(alutGetErrorString(error)); + msg.append(alutGetErrorString(error)); throw sg_io_exception(msg.c_str(), sg_location(samplepath)); return false; }