0
0

Hi,

I’m using the event system in a very simple game that features an object that floats around the screen, and bounces off walls (making a ‘pong’ sound on a wall hit). I’ve set all the events to be Programmer Selected, and for the most part, all is working.

I trigger the sounds with this line of code that I got from the Simple Event demo:

ERRCHECK(fmodresult = event->start());

The sound in question is 1 second long, and I’ve set it to allow up to 4 instances to play simultaneously. Also, it’s set to oneshot.

When the floating object is moving at a moderate speed, all the wall bounce sounds work fine, but if i speed the object up, many of the hits get skipped. I use the x and y coordinates of the object as my sound trigger – when the object is at x <= 0, for example, the above line of code runs.

Any thoughts about how I can guarantee that each hit plays?

Thank you,

Rob

  • You must to post comments
0
0

[quote:3l4o6f6r]When the floating object is moving at a moderate speed, all the wall bounce sounds work fine, but if i speed the object up, many of the hits get skipped. I use the x and y coordinates of the object as my sound trigger – when the object is at x <= 0, for example, the above line of code runs. [/quote:3l4o6f6r]

I assume the higher speed means greater distance per frame. Is it possible that the object isn’t getting to the boundary because it’s moving too fast? Can you put a break point on the event->start call and make sure you code is getting that far.

If not you might want to try making a buffer something like:

if ( (x <= buffer) || ( x >= (maxX – buffer) )…

Hope this is helpful.

  • You must to post comments
0
0

No one has come up with any suggestions, so I thought I might post another thought on this. Is it possible when the object is bouncing between walls, that each sound must complete before a new one can be triggered? For example, the sound file is 1 second in length, so if the time for the object to bounce from the right wall to the left wall is only .5 seconds, might the second trigger not be playing because the first one has to complete?

If so, how can I deal with this issue?

Rob

  • You must to post comments
0
0

There’s no universal requirement that one sound finish before the next one starts. The only limit is that you have no more than "MaxPlaybacks" instances active at once. Even there, if you set your max playbacks behavior to "steal oldest" or "steal quietest" then you will get a sound at every impact.

I suspect that you are doing something wrong in your implementation of your programmer sound and that’s why you’re seeing the behavior you are. I’m curious why you are using a programmer sound in the first place. It seems like overkill for such a simple case. Even if you are trying to do surface dependent sounds, just have different events for different surfaces.

  • You must to post comments
0
0

What is the difference between "Programer Selected" and "Sequential Event Restart"?

  • You must to post comments
0
0

[quote="audiodev":30s0yc4n]There’s no universal requirement that one sound finish before the next one starts. The only limit is that you have no more than "MaxPlaybacks" instances active at once. Even there, if you set your max playbacks behavior to "steal oldest" or "steal quietest" then you will get a sound at every impact.

I suspect that you are doing something wrong in your implementation of your programmer sound and that’s why you’re seeing the behavior you are. I’m curious why you are using a programmer sound in the first place. It seems like overkill for such a simple case. Even if you are trying to do surface dependent sounds, just have different events for different surfaces.[/quote:30s0yc4n]

I just noticed that you were under the impression I was using a Programmer Sound. In my post I indicated I was using Programmer Selected.

  • You must to post comments
0
0

Ok, I’ll post the relevant code, in hopes someone can lead me to the right path:

The includes:[code:99nxj1d5]#include <stdio.h>

include <conio.h>

include "./api_event/inc/fmod_event.hpp"

include "./api_event/inc/fmod_errors.h"

include <stdlib.h>[/code:99nxj1d5]

Initialization:

[code:99nxj1d5]//////////////////////FMOD Initialization///////////////////
FMOD::EventSystem eventsystem;
FMOD::Event *event,
event2,event3,event4;
FMOD_RESULT fmodresult;
int key;
[/code:99nxj1d5]

Create event system and load assests:

[code:99nxj1d5]////initialize fmod objects and load assets
ERRCHECK(fmodresult = FMOD::EventSystem_Create(&eventsystem));
ERRCHECK(fmodresult = eventsystem->init(128, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL));
ERRCHECK(fmodresult = eventsystem->setMediaPath("./assets/"));
ERRCHECK(fmodresult = eventsystem->load("week5.fev", 0, 0));
ERRCHECK(fmodresult = eventsystem->getEvent("week5/Class5/GameMusic/Dremples", FMOD_EVENT_DEFAULT, &event));
ERRCHECK(fmodresult = eventsystem->getEvent("week5/Class5/GameMusic/Allyourbass", FMOD_EVENT_DEFAULT, &event2));
ERRCHECK(fmodresult = eventsystem->getEvent("week5/Class5/SFX/Bounce", FMOD_EVENT_DEFAULT, &event3));
ERRCHECK(fmodresult = eventsystem->getEvent("week5/Class5/SFX/Userbounce", FMOD_EVENT_DEFAULT, &event4));
[/code:99nxj1d5]

Play background music:

[code:99nxj1d5]//play game music
ERRCHECK(fmodresult = event->start());[/code:99nxj1d5]

This is the problematic event:

[code:99nxj1d5]//play wall collide sound for player
if(player.x <= 30 || player.x >= pD3D->GetDisplayWidth() – (player.width+30))
ERRCHECK(fmodresult = event4->start());

//play ceiling and floor collide sound for player
if (player.y <= 30 || player.y >= pD3D->GetDisplayHeight() – player.height +1)
ERRCHECK(fmodresult = event4->start());

[/code:99nxj1d5]

  • You must to post comments
0
0

No official response? Was it something I didn’t say ( or something I said?)

  • You must to post comments
0
0

What is the max playbacks and max playbacks behaviour setting on your event?

  • You must to post comments
0
0

[quote="brett":3ikkjga6]What is the max playbacks and max playbacks behaviour setting on your event?[/quote:3ikkjga6]

Max playbacks is = 8
Max playbacks behaviour = StealOldest

Here is the fmod designer generated report:

#

week5.txt

Generated by FMOD Designer v4.17.0

#

#

Events

#

Name : /Class5/GameMusic/Dremples
Index : /EVENTGROUP_WEEK5_CLASS5/EVENTGROUP_CLASS5_GAMEMUSIC/EVENT_WEEK5_CLASS5_GAMEMUSIC_DREMPLES
Id : EVENTID_WEEK5_CLASS5_GAMEMUSIC_DREMPLES = 0
Notes :
Max. playbacks : 1
DSP Effects : none
Category : master

Name : /Class5/GameMusic/Allyourbass
Index : /EVENTGROUP_WEEK5_CLASS5/EVENTGROUP_CLASS5_GAMEMUSIC/EVENT_WEEK5_CLASS5_GAMEMUSIC_ALLYOURBASS
Id : EVENTID_WEEK5_CLASS5_GAMEMUSIC_ALLYOURBASS = 1
Notes :
Max. playbacks : 1
DSP Effects : FMOD Compressor
Parameter name : param00
Parameter index : EVENTPARAMETER_WEEK5_CLASS5_GAMEMUSIC_ALLYOURBASS_PARAM00 = 0
Range : 0.000000 -> 1.000000
Velocity : 0
Category : master

Name : /Class5/SFX/Bounce
Index : /EVENTGROUP_WEEK5_CLASS5/EVENTGROUP_CLASS5_SFX/EVENT_WEEK5_CLASS5_SFX_BOUNCE
Id : EVENTID_WEEK5_CLASS5_SFX_BOUNCE = 2
Notes :
Max. playbacks : 4
DSP Effects : none
Category : master

Name : /Class5/SFX/Userbounce
Index : /EVENTGROUP_WEEK5_CLASS5/EVENTGROUP_CLASS5_SFX/EVENT_WEEK5_CLASS5_SFX_USERBOUNCE
Id : EVENTID_WEEK5_CLASS5_SFX_USERBOUNCE = 3
Notes :
Max. playbacks : 8
DSP Effects : none
Category : master

#

Groups

#

Name : /Class5
Index : /EVENTGROUP_WEEK5_CLASS5
Numerical Index : /0
Notes :

Name : /Class5/GameMusic
Index : /EVENTGROUP_WEEK5_CLASS5/EVENTGROUP_CLASS5_GAMEMUSIC
Numerical Index : /0/0
Notes :

Name : /Class5/SFX
Index : /EVENTGROUP_WEEK5_CLASS5/EVENTGROUP_CLASS5_SFX
Numerical Index : /0/1
Notes :

#

Categories

#

Name : /master
Index : /EVENTCATEGORY_WEEK5_MASTER
Numerical Index : /-1
Notes :

Name : /music
Index : /EVENTCATEGORY_WEEK5_MASTER/EVENTCATEGORY_WEEK5_MASTER_MUSIC
Numerical Index : /0
Notes :

#

Reverbs

#

#

Music Cues

#

#

Music Parameters

#

  • You must to post comments
0
0

I guess this issue is just a quirk of the engine, as – in the 3 days since I first posted about it – no one seems to have any notion of what might be causing it.

  • You must to post comments
Showing 10 results
Your Answer

Please first to submit.