Hi! I intend to use Master Audio for my projects and I was trying to get STM to play its sounds through it.
I looked into it and I think I figured out the general changes/additions it needs, it's actually pretty easy, but I hesitate to go in and just start changing code, especially since it'd become a hassle to redo the changes whenever there's a new update, plus I'm not familiar with the code to modify the editor and add the extra fields it needs. I was hoping to just request it as a feature and explain those changes to hopefully make it easier to implement?
Basically, you have a Master Audio object in the scene, define Sound Groups in it and to play sounds you just reference a Sound Group by name, passing it as a string argument on any of Master Audio's play sound methods. So to get it to work, all that's needed is to add some text fields to the default Audio Clip, the custom Audio Clips and Sound Clip in the editor.
- default Audio Clip: just a string field, maybe with a [SoundGroup] attribute so the user can pick the sound from a dropdown.
- Audio Clip: it wouldn't need an array of clips, since its own name could reference a Sound Group. Should have the same [SoundGroup] attribute too. The different sound variations would then be handled from Master Audio, by adding them to the Sound Group itself.
- Sound Clip: instead of taking a clip for each character, it'd again take a string with the [SoundGroup] attribute.
That's for the editor side, now for the implementation side:
I think the only changes needed would be on the PlaySound method. There's no need for an Audio Source, Master Audio handles it separately and in fact they recommend removing them. There's no need to check if sounds are currently playing or allowed to be cut off, since each Sound Group has its own settings for that. Finding and assigning the clip to play based on the read character would be the same, but instead of finding a clip, it'd be a string with a Sound Group name. The pitch mode and all that would stay, but instead of modifying the pitch attribute of the audio source, it'd be stored in a variable and sent as an argument on a PlaySoundAndForget() call that replaces the audioSource.play().
I think that's about it. There might be extra stuff like a way for the user to choose whether to use this or the regular implementation but that should be the core functionality.