void SimpleAudioEngine::preloadEffect(const char* pszFilePath) { SoundFxMap::iterator it = g_pSoundFxMap->find(pszFilePath) ; if( it==g_pSoundFxMap->end() ) { #if 0 CIwResHandlerWAV * wav_handler = new CIwResHandlerWAV(); class OpenSoundData: public CIwSoundData { public: int16 * GetBuffer() { return (int16*)m_Samples; } }; OpenSoundData * res = (OpenSoundData*)dynamic_cast<CIwSoundData*>(wav_handler->Build(pszFilePath)); int32 data_size = res->GetBufferSize(); int16* buff = (int16*)malloc(data_size); memcpy(buff, res->GetBuffer(), data_size); (*g_pSoundFxMap)[pszFilePath] = SoundFx(buff, data_size); delete res; delete wav_handler; #else s3eFile *fileHandle = s3eFileOpen(pszFilePath, "rb"); IwAssertMsg(GAME, fileHandle, ("Open file %s Failed. s3eFileError Code : %i", pszFilePath, s3eFileGetError())); int32 fileSize = s3eFileGetSize(fileHandle); int16* buff = (int16*)malloc(fileSize); (*g_pSoundFxMap)[pszFilePath] = SoundFx(buff,fileSize) ; memset(buff, 0, fileSize); s3eFileRead(buff, fileSize, 1, fileHandle); s3eFileClose(fileHandle); #endif } }
void SimpleAudioEngine::preloadEffect(const char* pszFilePath) { SoundFxMap::iterator it = g_pSoundFxMap->find(pszFilePath) ; if( it==g_pSoundFxMap->end() ) { s3eFile *fileHandle = s3eFileOpen(pszFilePath, "rb"); IwAssertMsg(GAME, fileHandle, ("Open file %s Failed. s3eFileError Code : %i", pszFilePath, s3eFileGetError())); int32 fileSize = s3eFileGetSize(fileHandle); int16* buff = (int16*)malloc(fileSize); (*g_pSoundFxMap)[pszFilePath] = SoundFx(buff,fileSize) ; memset(buff, 0, fileSize); s3eFileRead(buff, fileSize, 1, fileHandle); s3eFileClose(fileHandle); } }
void SimpleAudioEngine::preloadEffect(const char* pszFilePath) { // Changing file path to full path std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath); SoundFxMap::iterator it = g_pSoundFxMap->find(fullPath) ; if( it==g_pSoundFxMap->end() ) { s3eFile *fileHandle = s3eFileOpen(fullPath.c_str(), "rb"); IwAssertMsg(GAME, fileHandle, ("Open file %s Failed. s3eFileError Code : %i", fullPath.c_str(), s3eFileGetError())); int32 fileSize = s3eFileGetSize(fileHandle); int16* buff = (int16*)malloc(fileSize); (*g_pSoundFxMap)[fullPath] = SoundFx(buff,fileSize) ; memset(buff, 0, fileSize); s3eFileRead(buff, fileSize, 1, fileHandle); s3eFileClose(fileHandle); } }