Jump to content

Mute/Volume=0 Not working


jorge.graca
 Share

Recommended Posts

Hi all,

 

I am using sound sprites to make tiny button sounds, however when I place the mute=true on the sound manager the button still plays the first time (not the following) after the system was muted. Is this a know bug?

preload: function() {    this.load.audio('button_press', 'button_press.wav');},create: function() {    this.clickSound = new Phaser.Sound(this.game, 'button_press');    this.clickSound.play();//plays sound    this.game.sound.mute = true;    this.clickSound.play();//also plays sound (only the first few moments)}						

Thanks.

phaser mute issue.zip

Link to comment
Share on other sites

I am not a Phaser guy... but it doesn't seem obvious to me that this should be a bug. I mean it seems reasonable to me that sound could take a few milliseconds to go silent after muting is enabled (eg. to allow event handling*, perhaps to fade the volume out to prevent a hard clip**)

 

Why not do something like:

if (this.game.sound.mute !true)

  this.clickSound.play();

 

 

 

*nb: I suspect this might be the actual reason

**  Not saying Phaser necessarily does this, but in a perfect world it might and thus I feel it is still a valid counterexample

Link to comment
Share on other sites

As is illustrated in the example attached the issue is not the fadeout, the issue is that the next sound that is played with mute on always plays.

That is clearly an issue, why would there be a fadeout on a new sound after the mute has been switched?

 

I could do the "if" you mention, in all sounds I play in the entire game... I rather that "if" to be inside the play function at least. Hence, the Phaser issue.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...