0
0

I’ve got a simple event containing 6 sounds to be played at random each time the event is triggered.

When loading the .fev into the fmod_eventplayer utility, there are two play buttons: [i:3mbh4puc]play in new source[/i:3mbh4puc] (triangle-asterisk) and [i:3mbh4puc]play in selected source[/i:3mbh4puc] (triangle). Repeatedly pressing [i:3mbh4puc]play in new source[/i:3mbh4puc] produces the desired behavior: a new instance of the sound is played for each press, using additional channels until the max playback limit is reached (in this case, 6).

BUT in my [Android] game, when repeatedly triggering the event, it sounds as if I’m pressing [i:3mbh4puc]play in selected source[/i:3mbh4puc] … only one instance of the sound plays at a time. Actually, it’s worse than that: only one instance plays, and then no additional sounds will play until the first instance finishes.

In the code, I’m triggering the event by calling FMOD_Event_Start multiple times. I also tried setting FMOD_EVENT_LOADINFO sizeof_instancepool_simple = 6, when calling FMOD_EventSystem_Load, but to no effect.

I’m pretty sure the event is set up correctly (available at [url:3mbh4puc]http://www.twittering.com/twittering/code/FMOD/VPS2files.zip[/url:3mbh4puc]) so how do i trigger the event to "play in new source" mode?

  • pdx
  • You must to post comments
0
0

The code in your last post is correct, you can just call getEvent as needed. The will work with the default behaviour "steal oldest". There are a few other [i:1qlxu88o]max plaback behaviours[/i:1qlxu88o] which need to be handled differently, in particular ‘just fail’ and ‘just fail if quietest’.

  • You must to post comments
0
0

uh, yeah, i thought using an array of events was kinda inelegant, and of course, it is. each time i trigger the event, i simply have to get a new one, like this:
[code:32cpaqnr]
result = FMOD_EventSystem_GetEvent(gEventSystem, "VPS2/VPS2/VPS2ding", FMOD_EVENT_DEFAULT, &gPlayEvent);
CHECK_RESULT(result);
result = FMOD_Event_Start(gPlayEvent);
CHECK_RESULT(result);
[/code:32cpaqnr]
that also produces the desired result, but makes a lot more sense. i guess i was mislead by the sample code, which puts the getEvent call in the initialization method. this (to me) implied that getting events was something to be done once when the program starts (like getting the eventSystem).

  • pdx
  • You must to post comments
0
0

yup, that works, thanks! but just to confirm …

during initialization, i get the first event, get the max playback properties, then fill in the rest of the array:
[code:13plq4n7]
result = FMOD_EventSystem_GetEvent(gEventSystem, "VPS2/VPS2/VPS2ding", FMOD_EVENT_DEFAULT, &gEvent[0]);
CHECK_RESULT(result);
result = FMOD_Event_GetPropertyByIndex(gEvent[0], FMOD_EVENTPROPERTY_MAX_PLAYBACKS, &propertyValue, thisInstance);
CHECK_RESULT(result);
maxPlaybacks = (int)propertyValue;
for (eventNum=1; eventNum < maxPlaybacks; eventNum++)
{
result = FMOD_EventSystem_GetEvent(gEventSystem, "VPS2/VPS2/VPS2ding", FMOD_EVENT_DEFAULT, &gEvent[eventNum]);
CHECK_RESULT(result);
}
[/code:13plq4n7]
then each time the event is triggered, i cycle through the event array:
[code:13plq4n7]
eventNum++;
if (eventNum >= maxPlaybacks)
{eventNum = 0;}
result = FMOD_Event_Start(gEvent[eventNum]);
CHECK_RESULT(result);
[/code:13plq4n7]
this produces the desired results, but is it the best way to do it?

  • pdx
  • You must to post comments
0
0

You must call getEvent for each instance. Each FMOD::Event* is a handle for a single event instance, you can then that handle to update the instance state such as 3D position.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.