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

Setting the volume on an AudioInstance instead of PlayAudioCommand doesn't set it relative to a channel. #110

Open
Selene-Amanita opened this issue Sep 16, 2023 · 1 comment

Comments

@Selene-Amanita
Copy link

Selene-Amanita commented Sep 16, 2023

Follow up of #103 / #106

If you have an AudioChannel called my_audio_channel with volume 0.5 let's say.

The fix works if you do my_audio_channel.play(my_handle_audio_source).with_volume(0.2);, it would set the volume to 0.1, as expected.

But if you do:

    let my_handle_audio_instance = my_audio_channel.play(my_handle_audio_source).looped().paused().handle()
    ///...

/// Then in another system
fn other_system (
    mut audio_instances: ResMut<Assets<AudioInstance>>,
    //...
) {
    //... get my_handle_audio_instance somehow
    let sound = audio_instances.get_mut(my_handle_audio_instance).unwrap();
    sound.resume(AudioTween::default());
    sound.set_volume(0.2, AudioTween::default());
}

then the volume will be set to 0.2 instead, I think, I do basically that and when the volume of the channel is 0. I still hear the sound.

@NiklasEi
Copy link
Owner

Yes you are right, this was an oversight on my end in #106. Thanks for the issue, I will adapt the behavior for setting the volume on an instance.

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

No branches or pull requests

2 participants