forked from mirror/openmw-tes3mp
Fix for unnecessary exceptions when opening sounds
This would throw often during normal play, even though the throws are caught and ignored, can be annoying when the debugger is set to 'catch throw'.
This commit is contained in:
parent
5b846ebc71
commit
84fd682e4e
1 changed files with 9 additions and 9 deletions
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <components/vfs/manager.hpp>
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
#include "openal_output.hpp"
|
||||
|
@ -782,17 +784,15 @@ const CachedSound& OpenAL_Output::getBuffer(const std::string &fname)
|
|||
int srate;
|
||||
|
||||
DecoderPtr decoder = mManager.getDecoder();
|
||||
try
|
||||
// Workaround: Bethesda at some point converted some of the files to mp3, but the references were kept as .wav.
|
||||
std::string file = fname;
|
||||
if (!decoder->mResourceMgr->exists(file))
|
||||
{
|
||||
decoder->open(fname);
|
||||
}
|
||||
catch(std::exception&)
|
||||
{
|
||||
std::string::size_type pos = fname.rfind('.');
|
||||
if(pos == std::string::npos)
|
||||
throw;
|
||||
decoder->open(fname.substr(0, pos)+".mp3");
|
||||
std::string::size_type pos = file.rfind('.');
|
||||
if(pos != std::string::npos)
|
||||
file = file.substr(0, pos)+".mp3";
|
||||
}
|
||||
decoder->open(file);
|
||||
|
||||
decoder->getInfo(&srate, &chans, &type);
|
||||
format = getALFormat(chans, type);
|
||||
|
|
Loading…
Reference in a new issue