Hey guys,

New to FMOD and having a great time getting to grips with it.

I’m currently creating a simple demo for my final year project (back to university for my final year in September). I’m trying to set a sprite’s alpha value based off of the volume of one of my samples at that given time. I’ve got 5 sounds running and I’m only interested in the kick loop I’ve got going (running off a standard 4/4 loop, about 160 BMP).

I’ve scoured the API but been unable to find a way to get the channel/sound’s volume at a given position. I know ‘volume’ is the incorrect word, I’m ashamed at myself for not remember the correct one.. Hah. Of course the volume is 1.0f unless defined by me otherwise – I’m sure you guys can figure out what I’m referring to 😳 Any pointers would be appreciated, thanks in advance.

  • You must to post comments

If you’re interested in the RMS (http://en.wikipedia.org/wiki/Root_mean_square) of the signal over the last mix block you can use this code.

// After calling playSound() and getting channel back
FMOD::DSP* channelhead;
channel->getDSP(FMOD_CHANNELCONTROL_DSP_HEAD, &channelhead);
channelhead->setMeteringEnabled(false, true);

// Call this at regular intervals while the channel is playing
FMOD_DSP_METERING_INFO outputmeter = {};
channelhead->getMeteringInfo(0, &outputmeter);
float alpha = outputmeter.rmslevel[0]; // assume mono


  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.