Hey, I need some help understanding how to monitor the output level of an event instance. I’ve looked around and ended up with this function, which compiles and executes, but only outputs 0.0. I’m writing this code using the Unreal Engine FMOD API.
float UAudioFunctions::GetOutputLevel(FFMODEventInstance instance)
{
FMOD::ChannelGroup* group;
FMOD::DSP* dsp;
FMOD_DSP_METERING_INFO* input = new FMOD_DSP_METERING_INFO();
FMOD_DSP_METERING_INFO* output = new FMOD_DSP_METERING_INFO();
instance.Instance->getChannelGroup(&group);
group->getDSP(0, &dsp);
dsp->getMeteringInfo(input, output);
return output->rmslevel[0];
}
I also made this function which I call on the same EventInstance beforehand:
void UAudioFunctions::SetChannelGroupMeteringEnabled(FFMODEventInstance instance, bool isEnabled)
{
FMOD::ChannelGroup* group;
FMOD::DSP* dsp;
instance.Instance->getChannelGroup(&group);
group->getDSP(0, &dsp);
dsp->setMeteringEnabled(false, isEnabled);
}
I’ve tried looking for answers, but I can only find vague half-answers. What is a channel group? What is a DSP? Why do I need to get the DSP head? What is the DSP head? Why are there 32 “channels” in the rmslevel and peaklevel of the DSP’s meteringinfo, and what do each of them represent?
I’m just hopelessly lost and honestly have no idea what I’m doing or how to accomplish what I want. I just need to be able to monitor the volume/amplitude levels of the event while it’s playing for animation purposes. Any number between a predictable range that matches how loud the playing EventInstance is at any given time will work for me. Please help!