0
0

In designer, I set “step” sound’s loop mode is Oneshot.

In program:

PlayEvent( FMOD::Event * soundEvent )
{
if( soundEvent == NULL )
return;

EVENT_STATE state;

soundEvent->getState( &state ) )

if( state == EVENT_STATE_READY )
     soundEvent->start();

}

Press ‘W’ key, first call this function, state = 1, I can heard sound.
Press ‘W’ again, second call function, no sound. Check state, it equals to 9. But in Event_State, there are only value 1, 2, 4, and 8.

And if I delect this: ” if( state == EVENT_STATE_READY )”, no state check and just start event. I can’t hear sound either.

Thanks

  • You must to post comments
0
0

Just to clarify, I should be calling getEvent every time before I play an event (to get a valid instance) rather than storing a pointer to it and calling event->start() multiple times (which does generally seem to work)?

  • You must to post comments
0
0

Depends on your usage :

If you call Event::start() on the same event instance then you’ll hear that event instance restart.

If you have the event property "Max playbacks" set to > 1 then you can call EventGroup::getEvent() and then Event::start() which will spawn a new instance of the event each time i.e. you’ll hear them all overlapping/playing at once.

If "Max playbacks" == 3, for example, and you’ve already got 3 instances playing then when you call EventGroup::getEvent a 4th time then one of the playing event instances may be stolen depending on the event "Max playbacks behavior".

Cheers,

  • You must to post comments
0
0

Thanks Andrew, so my understanding is that it’s okay for example to store 4 Event pointers to the same sound (e.g. 4 separate instances of the same beeping sound with a single getEvent call for each) and expect the Event pointer to always remain valid (the same) and playable as long as the "Max playbacks" is at least 4 in the Event and "Maximum spawned sounds" is at least 4 in the Sound definition without any instance stealing going on?

  • You must to post comments
0
0

Correct. Actually "Maximum spawned sounds" is irrelevant here so you can leave that at 1 if you like. There’s no memory/speed hit either way.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.