Magicaxis
Magicaxis

Reputation: 381

Unable to detect volume in FMOD

I'm trying to get the volume of the microphone input with Fmod, but getVolume always returns 0. Yes, I have tested, and my microphone works fine.

This runs in a loop:

float tempvolume = 0.0f;
result = channel->getVolume(&tempvolume);
ERRCHECK(result);

//Set the sound volume
channel->getVolume(&tempvolume);
if (tempvolume < 0.1f){
    do something
}else{
    do something else
}

But like I said, tempvolume is always equal to 0.0

What can I do?

EDIT: I realize now that "getVolume" Merely returns the volume you set for the channel. So the whole question changes now to "How do I detect volume from the microphone?"

Upvotes: 0

Views: 681

Answers (1)

Mathew Block
Mathew Block

Reputation: 1643

FMOD does not provide any view into the hardware or OS volume level for the microphone.

If you want to measure the volume of the current recording signal consider System::recordStart, play the FMOD::Sound returned then call Channel::getWaveData. You can process the wave data how you like looking for peaks or RMS as required.

Upvotes: 1

Related Questions