开发者

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开发者_C百科 instead of [0, 1]?

Thanks!

EDIT: I use setVolume just after this:

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


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);


change the order of setVolume and playSound, it works in my project


I'm not 100% sure, but the sound may need to be stopped/paused before setting the volume to unlock it and resume playing the sound after the volume has been set.

Other things to check could be that the sound is being played on the correct channel (or that you are setting the volume on the correct channel). Is the sound locked? Is sound a part of a channelgroup that could be overwriting the volume (although FMOD docs say that channelgroups should scale, not overwrite)?


I had this issue using FMOD and went down a lot of these same roads. I tried pausing the sound. I wondered if it was because my sound was looped.

In the end it was entirely an application issue. I was not using the right channel object.

There is no need to pause in order to change volume. The point of playing the sound initially paused, then setting the volume to a non-default value, then unpausing the sound, is to avoid playing that sound briefly at default volume.


try this

result = channle->setPaused(false);//after you set volume
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜