FMOD scripting to modify an effect in every Event

Hi,
I’m trying to create a script with the low level api that process every event and set Bypass=true for a specific effect.
I need to make a build for PS4 and I can’t have the OculusSpatializer effect attached to my events. I just wanted a new menù entry that let me enable/disable this component on every event.

I’ve never used the low level scripting and I have some problems retrieving all the events list in my FMOD project, and also retrieving a specific effect attached to it.
I’ve read the documentation and the user manual, but I’m a bit stuck.
Any help will be appreciated.

Thanks in advance,
Simone

I wrote/copied this script:

studio.menu.addMenuItem({
name: “FMOD Examples\PS4 switch”,
isEnabled: function() { return studio.window.browserSelection().length; },
execute: function() {

function doBatchRename(widget, commit) {
  try {
    studio.window.browserSelection().forEach(function(item) {
      console.log("Item name: "+item.name);

      if(commit) {
        if(item.isOfType("WorkspaceItem")) {
          var newName = item.name;
          switch(action) {
            case 0:
              //find if the event has a Oculus Spatializer attached and bypass it
              //find the 3D Object Panner and set bypass as false
              console.log("PS4");
              break;
            case 1:
              //find if the event ha a 3D Object Panner attached and bypass it
              //find the Oculus Spatilizer and set bypass as false
              console.log("Other_Platforms");
              break;
          }
          alert("Done");
        }
      }
    });
  }
  catch(e) {
  }
}

studio.ui.showModalDialog({
  windowTitle: "PS4Switch",
  windowWidth: 100,
  widgetType: studio.ui.widgetType.Layout,
  layout: studio.ui.layoutType.VBoxLayout,
  items: [
    { widgetType: studio.ui.widgetType.Label, text: "Operation" },
    {
      widgetType: studio.ui.widgetType.ComboBox,
      widgetId: "m_action",
      items: [
        { text: "PS4 " }, // 0
        { text: "Other_Platforms" },  // 1
      ],
      currentIndex: 0,
      onCurrentIndexChanged: function() { doBatchRename(this); },
    },
    {
      widgetType: studio.ui.widgetType.Layout,
      layout: studio.ui.layoutType.HBoxLayout,
      contentsMargins: { left: 0, top: 12, right: 0, bottom: 0 },
      items: [
        { widgetType: studio.ui.widgetType.Spacer, sizePolicy: { horizontalPolicy: studio.ui.sizePolicy.MinimumExpanding } },
        { widgetType: studio.ui.widgetType.PushButton, text: "Apply", onClicked: function() { doBatchRename(this, true); this.closeDialog(); } },
      ],
    },
  ],
});

},
});

I managed to get the list of selected event (that was not what I wanted, wich was to apply changes to every event, not selected to, but it works).
The problem now is that I don’t know how to access to the Oculus Spatializer and to the 3D Object Panner components.

ok, I’ve found out that i can access to the masterBus of the event using this line:
var masterBus = item.mixer.masterBus;
now the problem is that i don’t know how to access to the componets attached to it.

Hi Simone,

Unfortunately bypassing the Oculus plugin will not work the way you expect it to. When you bypass a plugin or effect, it is still built into the banks and loaded into the game when the bank is loaded. Since the Oculus plugin is not compatible on PS4, even though you have set it to be bypassed, the PS4 will still try to load this plugin and fail causing FMOD to not initialize correctly.

In our next release, FMOD Studio 1.10.00, we have a new feature called “platform exclusivity” that will be exactly what you need. You can have the Oculus or Google VR plugins set to only be included on the desktop platform and the 3D Object Panner to only be included on the PS4 platform, which keeps everything within one project. This release is coming up in the next few weeks so please keep an eye out for it.

Thanks,
Richard

1 Like

This will save me a lot of work! I’ll keep an eye on it.
Hoping it will be soon so we could really get into the PS4 conversion of our project.

Best wishes,
Simone