I am looking for a way to improve editor support using audio tables. Specifically, I’d like to see in edit mode, whether a file is available for playback or not. I want this to avoid typos and make it overall easier to setup things.
I am building a system that plays narrator comments and they are localized to different langauges. So I am using a programmer instrument in conjunction with audio tables to achieve this. It generally works fine.
Some comments might randomly select one of multiple variants. The number of variants can depend on the language. It seems I have to provide a list of audio file names for each language. I have build custom scripted assets to achieve this.
However, this can easily lead to file names not being quite correct, and I want to have editor support to avoid this.
Is there any way to query in edit mode whether a file is available in an audio table of a bank?
When you mention
edit mode are you referencing the Unity Editor? E.g. having an editor window that lists the available audio files that are included in the audio table like we currently have with the
Currently, when calling
getSoundInfo() it will return an FMOD Engine | Core API Reference - FMOD_RESULT which can be checked against
FMOD.RESULT.OK. You could use this to check that an audio file was successfully found.
Exactly! An event browser like that would be fantastic.
But even checking a name I’d have to type in would be a big help.
The issue with getSoundInfo() is that the RuntimeManager requires play mode, so I cannot check it in edit time. I get the following error message when attempting that:
[FMOD] RuntimeManager accessed outside of runtime. Do not use RuntimeManager for Editor-only functionality, create your own System objects instead.
I wouldn’t know how to create those ‘System objects’ to do this in the editor…
In play mode I can can check the result of getSoundInfo(), but I’ll have to enter play mode and go through all the sounds I need to check for all languages, so it’s quite uncomfortable compared to a browser.
Okay, I found that there are methods in the EditorUtils that allow me to achieve this.
I have now built an asset for associating a Locale with a Bank so I can check specific banks for audio files.
I’d love to also preview play them, still figuring out how to do that.
I will pass this on to our development team to look into further.
This would require you to create your own FMOD System, which is outlined here: FMOD Engine | Studio API Guide - Creating the Studio System.
This could be done with the FMOD Studio system that you create with the steps above.
Hope this helps.