void Sounds::playSound(Sounds::Sound* sound) { if(Settings::getInstance()->soundEnabled == false) return; int channel = s3eSoundGetFreeChannel(); if(s3eSoundChannelPlay(channel, sound->buffer, sound->fileSize/2, 1, 0) == S3E_RESULT_ERROR) { char buffer[200]; sprintf(buffer, "Error in s3eSoundChannelPlay: %s", s3eSoundGetErrorString()); IGLog(buffer); } }
unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath) { int channel = s3eSoundGetFreeChannel(); s3eSoundChannelPlay(channel, g_SoundBuffer, g_SoundFileSize/2, 1, 0); if (s3eSoundGetError()!= S3E_SOUND_ERR_NONE) { IwAssertMsg(GAME, this, ("Play sound %s Failed. Error Code : %s", pszFilePath, s3eSoundGetErrorString())); } return channel; }
unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop) { SoundFxMap::iterator it = g_pSoundFxMap->find(pszFilePath) ; int16* buff = 0 ; if( it==g_pSoundFxMap->end() ) { preloadEffect(pszFilePath) ; } buff = (*g_pSoundFxMap)[pszFilePath].data ; int channel = s3eSoundGetFreeChannel(); s3eSoundChannelPlay(channel, buff, (*g_pSoundFxMap)[pszFilePath].size/2, (bLoop ? 0 : 1), 0); if (s3eSoundGetError()!= S3E_SOUND_ERR_NONE) { IwAssertMsg(GAME, false, ("Play sound %s Failed. Error Code : %s", pszFilePath, s3eSoundGetErrorString())); } return channel; }
unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop) { // Changing file path to full path std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath); SoundFxMap::iterator it = g_pSoundFxMap->find(fullPath) ; int16* buff = 0 ; if( it==g_pSoundFxMap->end() ) { preloadEffect(fullPath.c_str()) ; } buff = (*g_pSoundFxMap)[fullPath].data ; int channel = s3eSoundGetFreeChannel(); s3eSoundChannelPlay(channel, buff, (*g_pSoundFxMap)[fullPath].size/2, (bLoop ? 0 : 1), 0); if (s3eSoundGetError()!= S3E_SOUND_ERR_NONE) { IwAssertMsg(GAME, false, ("Play sound %s Failed. Error Code : %s", fullPath.c_str(), s3eSoundGetErrorString())); } return channel; }