Answered
0
0

At the moment, this is the code I’m using:

inst = AUDIO_SYSTEM->PlaySound("event:/ow", 0.5f); //0.5f being the volume

    if (inst)
    {
      float oldPitch;
      inst->getPitch(&oldPitch);
      oldPitch = oldPitch + 0.02 * dt;
      inst->setPitch(oldPitch);
    }

I’m not sure why the code doesn’t work. When this sound is triggered, it plays the sound unpitched, rather than the pitch increasing over time. Is there a way to change the pitch of the individual sound event on-the-fly, without going through a DSP?

  • You must to post comments
Best Answer
0
0

Hi,
That code should work fine. In fact I can do the same change with the 3d.cpp example that comes with the programmers API, in the main loop:

    float pitch;
    ERRCHECK(eventInstance->getPitch(&pitch));
    pitch = pitch + 0.01f;
    ERRCHECK(eventInstance->setPitch(pitch));

By adding that code, the engine pitch increases over time.

You could log the values of pitch that you are setting and check that it is increasing as you expect. Also if you check the return code out of getPitch and setPitch you can make sure there isn’t any problem (such as the event instance handle not being valid).

  • Nestor
    I haven't had the chance to check yet, but does this work the same when using FMOD Studio?
  • Geoff Carlton
    Yes, that code is for FMOD Studio.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.