0
0

I have no idea why this code doesn’t work to set the volume of a channel:

[code:1k0uwmoj]
FMOD::Channel *soundChannel;
FMOD::System * tempSystem;

result = tempSystem->playSound(FMOD_CHANNEL_FREE, this->sound, true, &soundChannel);

//This is the Method to getvolume
float SoundEmitter::GetVolume()
{
float currentVolume = 0.0f;
float* volumePoint = &currentVolume;
soundChannel->getVolume(volumePoint);
return currentVolume;
}

//this is the method to set volumes
void SoundEmitter::SetVolume(float volume)
{
soundChannel->setVolume(volume);
}
[/code:1k0uwmoj]

I am so clueless whats wrong with this block of code. Anybody can help me out?
[/code]

  • You must to post comments
0
0

Check the FMOD_RESULT from your calls to getVolume() and setVolume(), you may be able to find out from that.

  • You must to post comments
0
0

Like dogbert said, you should be checking the FMOD_RESULT returned by get/setvolume calls.

Other things:

result = tempSystem->playSound(FMOD_CHANNEL_FREE, this->sound,[b:1vec0tzp] true[/b:1vec0tzp], &soundChannel);
I hope you’re aware that the sound is paused.

This line is redundant:
float* volumePoint = &currentVolume;

This following would be sufficient:
soundChannel->getVolume(&currentVolume);

  • You must to post comments
0
0

Ahhhh there is a FMOD Error.

got the error "An invalid object handle was used."….

Haha i figured it out,

I called SetVolume() before i called this function:
result = tempSystem->playSound(FMOD_CHANNEL_FREE, this->sound, true, &soundChannel);

Thanks for the help…. totally forgot aobut FMOD Errors…..

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.