Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ambient sound not updating in game on setting options change #2030

Conversation

leoCottret
Copy link
Collaborator

@leoCottret leoCottret commented Oct 15, 2022

Summary

SUMMARY: Bugfixes "Fix ambient volume not updating after options change"

Purpose of change

Fix #2019
Ambient effect volume is not updated after changing it through the options in game.
The volume will only be updated after you move to an other area.
Which can be annoying if you want to test if you like an ambient sound, to adjust the volume etc.

Describe the solution

I first tried to update the volume of the current ambient effect after options change in game (same behavior as music).
But several channels (ambient sounds), can be played simultaneously.
So I now:

  • save the last played channel with its options each time a new channel is started
  • and on options change
    • stop all channels
    • start the last played channel with its options and the updated volume

Describe alternatives you've considered

I could keep track of every channel parameters to restart every channels on options change, but I feel like it would complexify the code for little gain.
Here the main goals are reached, changing the volume gives instant result, so a player can quickly tweak the ambiant effect volume, and won't think that it's bugged.

Testing

  1. Starting the game with 0 ambient sound volume
  2. Changing the volume to 100. The ambient effect can be heard
  3. Changing the volume to 20. The effect volume is lower, and not duplicated
  4. Teleporting to an area with a different effect, changing the volume, the last effect has its volume udpated.

@scarf005
Copy link
Member

looks great. tho i suggest to group those variables into struct.

@Coolthulhu Coolthulhu self-assigned this Oct 18, 2022
@Coolthulhu Coolthulhu merged commit 7e16690 into cataclysmbnteam:upload Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ambient sound volume can't be changed in game
3 participants