Hi everyone,
I’m trying to understand in detail how FMOD::DSP::getMeteringInfo works in the Core API.
I need the RMS level of an FMOD event to modify the size of a mesh in real time, but the values I’m getting are unclear.
Here’s a simplified version of the code I’m using for testing in Unreal:
float UPRFileUtility::TestFMODModulation(UFMODAudioComponent* InAudioComp)
{
FMOD::ChannelGroup* ChanGroup = nullptr;
InAudioComp->StudioInstance->getChannelGroup(&ChanGroup);
if (ChanGroup)
{
FMOD::DSP* ChanDSP = nullptr;
ChanGroup->getDSP(FMOD_CHANNELCONTROL_DSP_HEAD, &ChanDSP);
if (ChanDSP)
{
ChanDSP->setMeteringEnabled(true, false);
FMOD_DSP_METERING_INFO prelevels = {};
ChanDSP->getMeteringInfo(&prelevels, 0);
if (prelevels.numsamples > 0)
{
float sum = 0;
for (int i = 0; i < 32; i++)
{
if (prelevels.rmslevel[i] > 0)
{
sum += prelevels.rmslevel[i];
UE_LOG(LogTemp, Error, TEXT("rmslevel: %f at index %d"), prelevels.rmslevel[i], i);
}
}
UE_LOG(LogTemp, Warning, TEXT("sum: %f and numsample: %d"), sum, prelevels.numsamples);
return sum / 32.f;
}
}
}
return -1.f;
}
As you can see in the image, only a few indices of the array contain values different from 0, yet in Unreal Engine the sound that’s playing is perfectly audible.
Would it be possible to get more detailed information about howFMOD::DSP::getMeteringInfo works?
Thanks in advance!
