Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualcozzie

Posted 20 May 2013 - 02:14 PM

Hi,

 

I've started to implement FMOD in my game (instead of directsound).

Now I'm struggling with passing a FMOD::Sound as a reference, to my loadsound function.

 

The problem is that the sound isn't loaded at all.

When I replace the pSound parameter 'sound' by a global FMOD::Sound (not passed as parameter), it works fine.

 

What am I overseeing?

 

bool Fmod_LoadSound(char *filename, FMOD::Sound *pSound)
{
	fmodResult = fmodSystem->createSound(filename, FMOD_DEFAULT, 0, &pSound);
	if(!Fmod_ErrorCheck(fmodResult)) return false;

	pSound->setMode(FMOD_LOOP_OFF);
	return true;
}

/**												**
 ** Play a sound through fmod ********************
 **												**/

void Fmod_PlaySound(FMOD::Sound *pSound)
{
	fmodSystem->playSound(FMOD_CHANNEL_FREE, pSound, false, &fmodChannel);
}

In the file where I declare and load the sound:

 

FMOD::Sound	*sound_shoot		= NULL;

	if(!Fmod_LoadSound("data/sound/_shoot.wav", sound_shoot)) return false; 

 

The only thing I found till now is that createSound needs a pointer to a pointer (**FMOD::Sound).

Any help is really appreciated.


#1cozzie

Posted 20 May 2013 - 02:10 PM

Hi,

 

I've started to implement FMOD in my game (instead of directsound).

Now I'm struggling with passing a FMOD::Sound as a reference, to my loadsound function.

 

The problem is that the sound isn't loaded at all.

When I replace the pSound parameter 'sound' by a global FMOD::Sound (not passed as parameter), it works fine.

 

What am I overseeing?

 

bool Fmod_LoadSound(char *filename, FMOD::Sound *pSound)
{
	fmodResult = fmodSystem->createSound(filename, FMOD_DEFAULT, 0, &pSound);
	if(!Fmod_ErrorCheck(fmodResult)) return false;

	pSound->setMode(FMOD_LOOP_OFF);
	return true;
}

/**												**
 ** Play a sound through fmod ********************
 **												**/

void Fmod_PlaySound(FMOD::Sound *pSound)
{
	fmodSystem->playSound(FMOD_CHANNEL_FREE, pSound, false, &fmodChannel);
}

The only thing I found till now is that createSound needs a pointer to a pointer (**FMOD::Sound).

Any help is really appreciated.


PARTNERS