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;

	}
Beispiel #2
0
	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;

	}