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

Sound plays at 0 volume #166

Open
gregmax17 opened this issue Jun 11, 2021 · 1 comment
Open

Sound plays at 0 volume #166

gregmax17 opened this issue Jun 11, 2021 · 1 comment

Comments

@gregmax17
Copy link

gregmax17 commented Jun 11, 2021

On random occasions when I play a sound the volume will be set at 0. I'm not setting the volume anywhere in my project.

The default value should be 1 right? So why is a sound playing muted? (I did check the muted property and that is set to false, but again, the volume is set to 0)

I forgot to mention, I did this little snippet of code:

var src = PIXI.sound.find("audio");
var sound = src.play();

setInterval(function() {
    sound.volume = 1;
}, 100);

And this would result hearing blips of the audio being played. It seems somewhere and somehow the audio is being reverted to a volume of 0.

@bigtimebuddy
Copy link
Member

Could you provide a reproduction of this? I cannot reproduce.

Here is the logic for the volume when playing an instance:

// Update the volume
const globalVolume = global.volume * (global.muted ? 0 : 1);
const soundVolume = sound.volume * (sound.muted ? 0 : 1);
const instanceVolume = this._volume * (this._muted ? 0 : 1);
WebAudioUtils.setParamValue(this._gain.gain, instanceVolume * soundVolume * globalVolume);

// Update the volume
const globalVolume = global.volume * (global.muted ? 0 : 1);
const soundVolume = sound.volume * (sound.muted ? 0 : 1);
const instanceVolume = this._volume * (this._muted ? 0 : 1);
this._source.volume = instanceVolume * globalVolume * soundVolume;

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