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

AudioComponents can now set volume on client side #5458

Closed
wants to merge 1 commit into from

Conversation

TGRCdev
Copy link

@TGRCdev TGRCdev commented Sep 22, 2024

This PR adds an additional argument dirty to the SetVolume and SetGain methods.

I've been trying to set up a jukebox volume slider for a few days, and the only way I can get volume changes to change on client-side is by preventing the component from being marked as dirty on the client.

@ElectroJr
Copy link
Member

This solution doesn't really work. Anytime the server or client dirties the audio component for whatever reason, it will still override your volume modifications.

A better solution would probably be to add some client-only / non-networked fields called something like VolumeModifier or VolumeOverride that either modify or override the networked volume.

Though for the actual issue you're trying to solve in space-wizards/space-station-14/pull/32391, what we really need is a proper way of categorizing audio and having per-category volume customization. This is would probably take some effort to add, but I feel like its probably better to do it properly instead of trying to hack around the problem.

@TGRCdev
Copy link
Author

TGRCdev commented Sep 23, 2024

I understand that this is not the ideal refactor for client-side audio. But the changes do work, and the hack used to make it work in my related PR are small and relegated to the client-side JukeboxSystem file.

In that PR, I added a line to the AfterHandleAutoStateEvent handler, which would catch if the network actually dirtied and replicated the AudioComponent, and sets the proper volume again. Under that, I also set the volume of every active jukebox audio stream when the CVar is updated.

In the case that we later add properly categorized audio and proper client-side variable overrides, these can be replaced with the correct system easily.

@metalgearsloth
Copy link
Contributor

I understand that this is not the ideal refactor for client-side audio. But the changes do work, and the hack used to make it work in my related PR are small and relegated to the client-side JukeboxSystem file.

In that PR, I added a line to the AfterHandleAutoStateEvent handler, which would catch if the network actually dirtied and replicated the AudioComponent, and sets the proper volume again. Under that, I also set the volume of every active jukebox audio stream when the CVar is updated.

In the case that we later add properly categorized audio and proper client-side variable overrides, these can be replaced with the correct system easily.

For engine audio I would prefer it done properly instead of mispredicting and relying upon specific scenarios to avoid it breaking.

@metalgearsloth
Copy link
Contributor

This is would probably take some effort to add, but I feel like its probably better to do it properly instead of trying to hack around the problem.

I think you can mix audio together in OpenAL with some of the EFX stuff but I didn't look heaps into it.

@TGRCdev
Copy link
Author

TGRCdev commented Sep 24, 2024

My college courses start up in two days, so I don't have time to deep dive into OpenAL and refactor the engine's client-side sound functionality. I'm afraid that you'll have to ask someone else to make the correct version of this change.

@TGRCdev TGRCdev closed this Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants