Beispiel #1
0
	SoundID AudioPlayer::playSound( ResID id , float volume , bool beLoop )
	{
		SoundRes* res = getSound( id );
		if ( res == NULL )
			return ERROR_SOUND_ID;

		FMOD_CHANNEL* channel;
		FMOD_System_PlaySound( mFmodSys , FMOD_CHANNEL_FREE , res->sound , false , &channel );
		FMOD_Channel_SetVolume( channel , volume * res->volume * mSoundVolume );
		FMOD_Channel_SetCallback( channel ,ChannelCallBack );

		if ( beLoop )
			FMOD_Channel_SetMode( channel ,FMOD_LOOP_NORMAL );

		return registerChannel( channel );
	}
Beispiel #2
0
void Audio::jouerSon(audio_t son, bool boucle) throw(Audio::Exc_Son) {
	if(boucle)
		FMOD_Sound_SetLoopCount(son, -1);
	else
		FMOD_Sound_SetLoopCount(son, 0);

	FMOD_CHANNEL *c = 0;
	resultat = FMOD_System_PlaySound(_systeme, FMOD_CHANNEL_FREE, son, false, &c);
	erreur(resultat, 7);
	
	int nb;
	FMOD_Channel_GetIndex(c, &nb);
	_canaux[nb] = c;
	
	FMOD_Channel_SetCallback(c, &sonStoppe);
	FMOD_Channel_SetVolume(c, Parametres::volumeEffets());
}