While I am learning Studio at the same time I am thinking about possible implementation techniques for large projects. I am not a programmer but still I want to understand as much as I could about API features.
Since there is a possibility to nest events inside other events I want to understand is it possible to use per event sample load from banks for such multi events?
And if yes, how in this case it should work?
For example I have a general massive bank and a master event with two nested events in it.
If I will want to load only samples associated with the master event (and accordingly - the sub events) what a programmer should do?
Apply EventDescription::loadSampleData function for the two child events, and the master event will work automatically
The function could be applied for the master event only and it will automatically load samples from all child events?
But in this case are there any ways to load data for master events selectively?
For example if I have a big master event for all footsteps or weapons in a game and I do not want to load all the data but only the samples required for a particular level (sand steps for desert, concrete for city etc.)?
I guess it may depend on the way a master event is constructed. I mean whether there is a separate sub event for each footstep material or only a single event with multi modules representing the material change.
Are there ways in the Studio to perform such selective sample load?
Yeah, I’m also wondering if you can selectively load sample data for some of the nested events in a “master event”.
The case for footsteps is a good one:
It’s really convenient to have a master “Footstep”-event which contains nested events for all the possible footstep material sounds, setup in a Labeled or Discrete parameter sheet.
Through code you do OneShots and send a “materialIndex”-parameter
The master “Footstep”-event switches what nested event to play based on the number sent in by the “materialIndex”-parameter
So if you’re in a level which doesn’t have any objects with a eg. Sand Material, then it would be pointless to have the sample data for “Sand” (ie. one of the nested events) loaded in memory.
If you look in the Build tab of the Preferences dialog, you’ll find a checkbox labelled “Include referenced events in banks (recommended).” By default, this checkbox is checked, meaning that any referenced event is automatically included in the banks to which its parent event(s) are assigned.
If you uncheck this checkbox, referenced events are only included in the banks to which they are explicitly assigned. If you then call Studio::EventDescription::loadSampleData on a parent event whole child events are in banks that have not been loaded, those child events’ sampledata will not be loaded into memory, and the parent event will treat the event instruments as “empty instruments” that do not spawn instances of the associated events. (This does generate a warning, as it’s not something you’d want to do unintentionally.)
This method allows you to control which referenced events’ sampledata is loaded when you load the sampledata for a parent event. It’s not appropriate for all projects and events, which is why it’s not the default, but it’s ideal for your specific use-case, where the sounds required by nested events are only found in specific levels.
We’re already planning numerous improvements to the content and structure of our API documentation. These improvements should make it easier to find clear information about a wide variety of specific use-cases, including this one.