I have several actors with a FMODAudio component that change size based on the volume of the fmod event. I do this with a custom BP node that takes the FMODAudio component object reference and returns the RMS value. My problem is that all of the actor sizes are changing based on the loudest sound that’s getting played by Fmod, and not by the respected fmod event instance.
float UFmod_BP_Function_Library::GetFMODInstanceRMS(UFMODAudioComponent* FMODInstance)
{
FMOD::ChannelGroup* ChanGroup = nullptr;
FMODInstance->StudioInstance->getChannelGroup(&ChanGroup);
if (ChanGroup)
{
FMOD::DSP* ChanDSP = nullptr;
ChanGroup->getDSP(FMOD_CHANNELCONTROL_DSP_HEAD, &ChanDSP);
if (ChanDSP)
{
ChanDSP->setMeteringEnabled(false, true);
FMOD_DSP_METERING_INFO Info = {};
ChanDSP->getMeteringInfo(nullptr, &Info);
return Info.rmslevel[0];
}
}
return 0;
}