void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop)
{
	if (! pszFilePath)
	{
		return;
	}

	s_Music.Open(_FullPath(pszFilePath), _Hash(pszFilePath));
	s_Music.Play((bLoop) ? -1 : 1);
}
Ejemplo n.º 2
0
void SimpleAudioEngine::preloadEffect(const char* pszFilePath)
{
    int nRet = 0;
    do 
    {
        BREAK_IF(! pszFilePath);

        nRet = _Hash(pszFilePath);

        BREAK_IF(sharedList().end() != sharedList().find(nRet));

        sharedList().insert(Effect(nRet, new MciPlayer()));
        MciPlayer * pPlayer = sharedList()[nRet];
        pPlayer->Open(_FullPath(pszFilePath), nRet);

        BREAK_IF(nRet == pPlayer->GetSoundID());

        sharedList().erase(nRet);
        nRet = 0;
    } while (0);
}