Ok so one of the things I was not so sure about was my casual use of Metasounds.
In my ignorance, I’ve created a custom Metasound source for every sound wave file to be used as an instrument, and passing a reference to the MetasoundSource throughout the code.
The problem made itself evident when I added the multiply off Out Left/Right nodes. I wanted to turn the volume down (output volume multiplied by 0.5 cuts the volume in half).
This works… for one Metasound. I have over 50 😬
What I wanted to do was do the painful work of collapsing this all down into a single metasound, parameterizing all the possible inputs and effects, allowing me to create copies of this One-True-Metasound and control its inputs/effects from Instrument code.
So I have two inputs now on this common Metasound- setting the WaveAsset, which sound to play; and OutputVolume, setting the output volume.
Easy.
So now I just need a place to set these WaveAsset and OutputVolume inputs.
OutputVolume was easy, its just a float and there is a Set Float Parameter:
AudioComponent->SetFloatParameter(FName("OutputVolume"), 1.0f);
Note the funny way we do this, you specify by exact matching “InName”. Very Kubernetes.
For some reason, I couldn’t find the equivalent setting for setting the “WaveAsset”. Like, I burned the entire hour of work I have trying to find it.
I don’t know what my brain was missing, because its dead simple:
AudioComponent->SetWaveParameter(FName("WaveAsset"), WaveAssetReference);
Bummer I didn’t see this. Human brains doth work funny.
But, this does confirm my suspicion that I need to refactor from 50~ Metasounds to a single parameterized one.
Won’t be the most fun task, especially if I do this manually.
That being said, I may take this opportunity to really figure out how to not do this manually. But that’s its own bag of beans.