Last Ray of Hope Home of Kaluriel Hargrove

30Sep/08Off

Athena: Playing Sound with FMOD Soundbanks

Using the Soundbank

Finally to play an event in a soundbank, all that is needed is to have the Audio Manager initialised, load a soundbank successfully, and retrieve an event from the soundbank without error. If all goes well and no asserts get triggered, then play.

The code belows shows how to do this, with a loop to check to see if any of the channels are playing for that event.

//
//
#include "AudioManager.h"
#include "Soundbank.h"
 
//
//
int main()
{
	Soundbank * testSoundbank;
	SoundEvent testEvent;
 
	//
	//
	AudioManager::Init();
 
	//
	//
	testSoundbank = AudioManager::LoadSoundbankFromFile( "testSoundbank.fev" );
	testSoundbank->GetEventByName( "test/someTestSound", testEvent );
	testEvent.Play();
 
	//
	//
	while( testEvent.IsPlaying() )
	{
		AudioManager::Update();
	}
 
	//
	//
	delete testSoundbank;
 
	//
	//
	AudioManager::DeInit();
 
	return 0;
}

 

Some improvements are required, but for now that'll be my FMOD Ex code.

Tagged as: , , , Comments Off
Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.