#include "fsCCachedSoundEffect.h"
#include "fsCore/src/fsCResourceName.h"
#include "fsCSoundEffectInstance.h"
fsISoundEffectInstance* fsCCachedSoundEffect::play(fsBool pLoop)
{
fsCSoundEffectInstance* inst = new fsCSoundEffectInstance(this, pLoop);
if (inst->playing())
{
return inst;
}
delete inst;
return nullptr;
}
fsCCachedSoundEffect::fsCCachedSoundEffect(const fsCResourceName& pFileName):
mShutDown(false),
mFilename(pFileName.nameGet())
{
mSound = ::LoadSound(pFileName.nameGet().utf8Get());<--- Variable 'mSound' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'mSound' a value by passing the value to the constructor in the initialization list.
}
fsCCachedSoundEffect::~fsCCachedSoundEffect()
{
mShutDown = true;
}