Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

0 votes

I tried various ways to set the Switch Group property of a Switch Container but I can't get it to work.

I first create a random container with two Switch Containers. I then iterate through the Switch Containers and my intention is to apply a Switch Group to each one.

function createObject(session){
    var container = {
      "parent": "{8250D45E-B369-40D4-A2D2-62DE313EBA7F}",
      "type": "RandomSequenceContainer",
      "name": "RandContainer",
      "@RandomOrSequence": 1,
      "children": [
        {
          "type": "SwitchContainer",
          "name": "A",
          "children" : [
            {"type" : "Sound", "name" : "aa"},
            {"type" : "Sound", "name" : "bb"},
            {"type" : "Sound", "name" : "cc"},
            {"type" : "Sound", "name" : "dd"}
          ]
        },

       {
          "type": "SwitchContainer",
          "name": "B",
          "children" : [
            {"type" : "Sound", "name" : "ee"},
            {"type" : "Sound", "name" : "ff"},
            {"type" : "Sound", "name" : "gg"},
            {"type" : "Sound", "name" : "hh"}
          ]
        }
      ]
    }

    session.call('ak.wwise.core.object.create', [], container ).then(
      function(res) {
        var children = res.kwargs.children
        children.map((child) => {
          console.log(child.id)
          const st = {
            "object" : child.id,
            "reference" : 'StateGroup',         <-----------  //I tried 'State', 'Switch', "StateGroup", "SwitchGroup", "SwitchContainer" also tried "property" instead of "reference"
            "value" : '{F1B87108-BC75-4400-8556-AD5235907703}'
          }
          session.call('ak.wwise.core.object.setReference', [], st).then(      <-----------  //Here I tried .setProperty, when using "reference" in the above object. Also I tried having the object as the second argument in the method...
            function(r) {
              console.log(r)
            },
            function(e){
              console.log(e)
            }
          )
        })
      },
      function (error) {
        console.log('error: ', error);
      }
    ).then(
      function() {
        connection.close();
      }
    );
}

 

One more thing - How would I go about associating a sound file to a particular State?

in General Discussion by Ando (190 points)

1 Answer

0 votes
The property you want, I believe is: "@SwitchGroupOrStateGroup"
And to assign a child of the Switch Container to a particular State or Switch, use "ak.wwise.core.switchContainer.addAssignment"
Hope that helps!
by Cody F. (140 points)
...