0
0

Hi everyone
we are trying to get an Fmod Studio project to run in Unity.

we have one event containing footstep sounds. So for every footstep we want to hear, we stop() and start() the emitter, which cuts off the footstep already playing from before… but we want the footsteps to overlap.

the only idea we have to do this would be to create a new emitter for every footstep we want to play. surely, that’s not the way to go, right?

thanks for any help!
Micha

  • You must to post comments
1
0

Hi Micha,

To trigger a key off, you just call EventInstance.getCue "KeyOff", then trigger that cue.

Something like this:

    [code:3nfj9t0q]var eventInstance = FMOD_StudioSystem.instance.getEvent("/MyEvent");
    FMOD.Studio.CueInstance cue;
    eventInstance.getCue("KeyOff", out cue);
    cue.trigger();[/code:3nfj9t0q]

Note: there is a typo in the current integration layer where CueInstance.trigger is actually called CueInstance.setValue, so for this to work in the current version just replace "trigger" with "setValue" and pass through any float, it will be ignored. This will be fixed in the next release of the integration.

  • You must to post comments
0
0

Dear Peter,
how do i trigger the "keyoff" (manual page 243) that makes the cursor advance on the timeline when it is on a sustain point?
Micha

  • You must to post comments
0
0

There are a number of ways to approach this, the simplest would be to use a oneshot event for each step. So in script you call FMOD_StudioSystem.instance.PlayOneShot each time the characters foot collides with the ground.

  • You must to post comments
0
0

[quote="peter":1c8xk5kk]There are a number of ways to approach this, the simplest would be to use a oneshot event for each step. So in script you call FMOD_StudioSystem.instance.PlayOneShot each time the characters foot collides with the ground.[/quote:1c8xk5kk]

Thank you!

Can i read up on those different apporaches anywhere?

my footstep sound event has a parameter called "surface", it gives a different sound depending on if you walk on concrete or snow.
so… when i call a oneShot event, how can i pass that parameter?
the only way i know for passing parameters is via the emitter, but oneShot sounds don’t use the emitter, right?

  • You must to post comments
0
0

If you need to set a parameter then you will need to get the event instance. To play a one shot and set the parameter you would do something similar to what is inside the PlayOneShot function, something like this:

[code:2b5nl29l] var instance = getEvent(path);

    var attributes = FMOD.Studio.UnityUtil.to3DAttributes(position);
    ERRCHECK( instance.set3DAttributes(attributes) );

    FMOD.Studio.ParameterInstance param = null;
    ERRCHECK( instance.getParameter("surface", out param) );
    ERRCHECK( param.setValue(1.0f) );

    ERRCHECK( instance.start() );
    ERRCHECK( instance.release() );[/code:2b5nl29l]

Note that [b:2b5nl29l]release()[/b:2b5nl29l] is called immediately after start, this is how to make a ‘one shot’. Once you call release it will play out the sound to completion and release the event. Note that this requires that the event is not endless, if the runtime cannot determine whether the event will terminate release will return an error.

  • You must to post comments
0
0

Thank you so much, this help a lot!
Micha

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.