Skip to content

feat: add audio settings#909

Merged
zicklag merged 10 commits intofishfolk:mainfrom
nelson137:feat/audio-settings
Jan 25, 2024
Merged

feat: add audio settings#909
zicklag merged 10 commits intofishfolk:mainfrom
nelson137:feat/audio-settings

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 nelson137 force-pushed the feat/audio-settings branch from 1a5c0d2 to 5991868 Compare January 23, 2024 02:08
@nelson137 nelson137 force-pushed the feat/audio-settings branch from 5991868 to fd2ae43 Compare January 23, 2024 02:46
@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
@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