audiofmod

FMOD channel setVolume doesn't work


I use this:

err = channel->setVolume(someVolumeBetween0and1);

Even if err is FMOD_OK, the volume doesn't change. Am I doing something wrong? Is there any way to change the volume for a sound(channel)? Is there other range for volume instead of [0, 1]?

Thanks!

EDIT: I use setVolume just after this:

err = soundSystem->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);

Solution

  • I found something about volume in the FMOD manual: "When a sound is played, it will use the sound's default frequency, volume, pan, levels and priority... To change channel attributes before the sound is audible, start the channel paused by setting the paused flag to true, and calling the relevant channel based functions. Following that, unpause the channel with Channel::setPaused."

    So, right code should like this:

    err = soundSystem->playSound(FMOD_CHANNEL_FREE, sound, true, &channel);
    err = channel->setVolume(someVolumeBetween0and1);
    err = channel->setPaused(false);
    

    or, you can try this one also:

    err = soundSystem->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
    err = channel->setVolume(someVolumeBetween0and1);