Change volume StudioEventEmitter

Hi,
Is possible to change thr volume of an emitter or it can only be done using FMOD?

Hi,

What version of FMOD are you using? Could you elaborate on how you want to change the volume? Via code or by another means.

If you have a reference to the event emitter you can change its volume by using EventInstance::setVolume() (FMOD API | Studio API - Studio::EventInstance).

Hope this helps!

Sorry for my late reply.
Is this code right or I’m missing something?


            sfxOnHit.EventInstance.setVolume(0.5f);
            sfxOnHit.Play();
1 Like

Hi,

An Event Instance won’t be valid until it is created and played. In your example, the setVolume() function will return ERR_INVALID_HANDLE, full error explanations can be found here: FMOD Engine | Core API Reference - Common, letting us know the Event Instance hasn’t been created yet. Try playing the Emitter before you change the volume of its Evnet Instance, and you can check the Event Instance is ready to be interacted with by using sfxOnHit.EventInstance.isValid() which returns a bool.

Hope this helps!