Yes querying the bus metering info is a good approach. The process would be:
- Find the bus with
Studio::System::getBus - Get the bus’s underlying Core API
ChannelGroupwithStudio::Bus::getChannelGroup- If you can’t access it, it’s probably because it hasn’t been created yet, in which case you need to force it into existence with
Studio::Bus::lockChannelGroup
- If you can’t access it, it’s probably because it hasn’t been created yet, in which case you need to force it into existence with
- Get the
ChannelGroup’sDSP_HEADwithChannelControl::getDSP - Enable metering on the DSP with
DSP::setMeteringEnabled
Now whenever you want to get the peak or rms levels you can use DSP::getMeteringInfo on that DSP object.
Hopefully that helps!
EDIT: I noticed someone else happens to be using this same approach for getting metering info, in case you need a code snippet to reference Clarification on how getMeteringInfo works