Scripting: How To Add Effect Before Volume, Change Output Of Return And Create Parameter

Hi,

I’ve started using FMOD Studio’s scripting functionality and have hit some brick walls with certain functions. Those are:

  1. Add a reverb effect before the fader
  2. Changing the bus output to the master output (mono to 5.1, for example)
  3. Creating a game parameter and put in into a certain folder

So far, I can only add an effect after the fader and the rest are stumping me.

Any help is appreciated,
James

Hi James,

The fader counts as the first item in the effects chain on a track, and setting the owner of an effect to an effect chain will automatically append it to that list. In order to add an effect before the fader, you will need to use the relationships and explicitly tell FMOD Studio that this new effect is the first item:

event.groupTracks[0].mixerGroup.effectChain.relationships.effects.insert(0, newEffect)

For changing the output format of a group track, you will need to set the panner of the track to allow overriding output formats and then set the output format itself.

track.mixerGroup.panner.outputFormatOverridden = true

track.mixerGroup.panner.overridingOutputFormat = 5

For creating preset parameters and placing them in certain folders, you will need to set up a parameter definition, create a preset folder and assign that folder to the master preset parameter folder.

var parameterDefinition = {name: "New Parameter", type:studio.project.parameterType.User, min:0, max:10}

var newParameter = studio.project.workspace.addGameParameter(parameterDefinition)

var presetFolder = studio.project.create("ParameterPresetFolder")

presetFolder.folder = studio.project.workspace.masterParameterPresetFolder

newParmeter.presetOwner.folder = presetFolder

I hope this has helped.

Thanks,
Richard

Thank you, Richard. This has been a great help!