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

feat: add audio settings #909

Merged
merged 10 commits into from
Jan 25, 2024
Merged

Conversation

nelson137
Copy link
Contributor

Add an "Audio" page to settings with volume controls. It features a main volume slider and sliders to control music and sound effects separately.

This replaces AudioEvents with a new AudioCenter that manages all audios (I would've liked to use AudioManager but that's taken by bones).

before:

audio_events.play(*explosion_sound, *explosion_volume);

after:

audio_center.play_sound(*explosion_sound, *explosion_volume);

For sounds, the volume is calculated as main_volume * effects_volume * requested_volume where the requested volume is the argument to play_sound. A similar method exists for music.

Sound effects are modeled by entities with an Audio component. When they are stopped/finish the entity is killed. The music system only supported 1 song at a time, so music is stored on the AudioCenter as an Option<Audio>. This can easily be refactored to use entities, like sound effects do, in the future if needed.

@nelson137
Copy link
Contributor Author

I just upgraded shlex (v1.2.0) to v1.3.0 to fix the failing task due to the security advisory

Copy link
Member

@zicklag zicklag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! This is great, thanks!

@zicklag zicklag added this pull request to the merge queue Jan 25, 2024
Merged via the queue into fishfolk:main with commit b78d907 Jan 25, 2024
8 checks passed
@nelson137 nelson137 deleted the feat/audio-settings branch January 25, 2024 18:11
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.

2 participants