Changing pitch to ChannelGroup not working

Hello!

I’m trying to change the pitch of a channel group, but the only thing I get is ERR_INVALID_PARAM

Here’s how I get the channelGroup:

 slowBus = FMODUnity.RuntimeManager.GetBus("Bus:/Fader/SFX/Boss");

    slowBus.getChannelGroup(out slowGroup);

And here’s how I change the pitch:

    public void SetPitch(float percentage)
{
    slowGroup.setPitch(percentage);
}

I’ve tried to lock and unlock the channelgroup, passing different parameter values, etc. Nothing works. I’ve also tried to get the name or the mute state of it and again the same error.

Many thanks if you can help!

ChannelGroup::setPitch takes in a value:

…where 0.5 represents half pitch (one octave down), 1.0 represents unmodified pitch and 2.0 represents double pitch (one octave up).

If the value is outside that range you will get ERR_INVALID_PARAM.

In 2.0, it is possible to automate the pitch on a Bus and control it using a global parameter.

I’ve tried passing values from 0.5 to 2.0 and the result is always ERR_INVALID_PARAM.

I think that the problem coul be the way I get the channel group? If not, can please tell me how to add a parameter to a Bus, maybe I can do the trick with that.

Thanks!

Studio::Bus::lockChannelGroup is an asynchronous function and takes time for the ChannelGroup to be created, if it isn’t already.

The channel group may not be available immediately after calling this function. When Studio has been initialized in asynchronous mode, the channel group will not be created until the command has been executed in the async thread. When Studio has been initialized with FMOD_STUDIO_INIT_SYNCHRONOUS_UPDATE, the channel group will be created in the next Studio::System::update call.

You can call Studio::System::flushCommands to ensure the channel group has been created. Alternatively you can keep trying to obtain the channel group via Studio::bus::getChannelGroup until it is ready.

Otherwise you can find more information on how Global parameters can also be used in the mixer, to control bus properties in the Parameters chapeter of the Studio Docs.

Oh, I didn’t knew it was asynchronous. Also the documentation page I was using was different than this one, so that might be my mistake. Now it works, thank you very much!! :grin::grin: