KDvoid SimpleAudioEngine::stopBackgroundMusic ( KDbool bReleaseData )
{
	SoundList::iterator it = l_aMusicList.find ( l_uCurrentMusic );

	if ( it != l_aMusicList.end ( ) )
	{
		if ( bReleaseData )
		{
			if ( it->second )
			{
				xmSoundClose ( it->second );
			}

			l_uCurrentMusic = 0;
			l_aEffectList.erase ( l_uCurrentMusic );
		}
		else
		{
			if ( it->second )
			{
				xmSoundStop ( it->second );
			}
		}
	}

	l_bIsBackgroundPlaying = KD_FALSE;
}
KDvoid SimpleAudioEngine::unloadEffect ( KDuint uSoundId )
{
	SoundList::iterator it = l_aEffectList.find(uSoundId);
	if (it != l_aEffectList.end())
	{
		xmSoundClose(it->second);
		l_aEffectList.erase(uSoundId);
	}
}
KDvoid SimpleAudioEngine::unloadEffect ( const KDchar* szFilePath )
{
	if (!szFilePath)
	{
		return;
	}

	std::string  sPath = FileUtils::getInstance()->fullPathForFilename(szFilePath);
	KDuint		   uID = _Hash(sPath.c_str());

	SoundList::iterator it = l_aEffectList.find(uID);
	if (it != l_aEffectList.end())
	{
		xmSoundClose(it->second);
		l_aEffectList.erase(uID);
	}
}