Answered
0
1

Hello, sorry if this has been answered but I cannot find it.

(Sorry, I cannot seem to add tags to this thread, but it is a Windows and C++ question)

I want to know how I can change the volume of a 3D positional sound while it is already playing.

I know that I can change the volume of any NEW 3D sound with channel->setVolume(), however I do not know how to access an existing 3D sound created with that same channel, and change its master volume.

For example, I want to be able to have users change the sound volume in my program’s options window, and have the 3D sound’s volume change immediately.

All other non-3D sounds work by calling the channel->setVolume() function, however the 3D sounds do not.

How to I access these sounds and change their volumes?

Here is the general code I use to set up and play the sounds:

//Sound setup
Sounds::LoadEnvSound()
{
result = system->playSound(FMOD_CHANNEL_FREE, envSoundList[soundID], true, &channelList[soundID]);
result = channelList[soundID]->set3DAttributes(&pos, &vel);
result = channelList[soundID]->setPaused(false);
result = channelList[soundID]->setVolume( VGlobal::soundVolume );
}

//Called every frame
Sounds::Set3DPos()
{
result = system->set3DListenerAttributes(0, &listenerpos, &vel, &forward, &up);
system->update();
}

Thanks.

  • You must to post comments
Best Answer
0
0

Hi Chris,

It would be good to put all the 3D sounds’ channels you wish to adjust into a ChannelGroup and you can allow users to adjust the volume there.

https://fmod.com/resources/documentation-api?page=content/generated/FMOD_Channel_SetChannelGroup.html#/

https://fmod.com/resources/documentation-api?page=content/generated/FMOD_ChannelGroup_SetVolume.html#/

Thanks,
Richard

  • You must to post comments
0
0

Thank you, channel groups seems to be the answer I needed. It seems to be working, thanks!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.