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 Property 'volume' Is Listed Twice in API Docs #2569

Closed
LoneStranger opened this issue Jun 17, 2016 · 1 comment
Closed

Sound Property 'volume' Is Listed Twice in API Docs #2569

LoneStranger opened this issue Jun 17, 2016 · 1 comment

Comments

@LoneStranger
Copy link
Contributor

This Issue is about:

  • An error in the documentation

Sound property 'volume' is declared twice in sound/Sound.js. I'm not sure if the first one is an artifact that should have been removed when the defineProperty was added, or if it's simply being overridden.

Because of these two, the 'volume' property is listed twice in the API docs with different descriptions.

Line 44, in the constructor:

/**
* @property {number} volume - The sound or sound marker volume. A value between 0 (silence) and 1 (full volume).
*/
this.volume = volume; 

And at line 1158:

/**

  • @name Phaser.Sound#volume

  • @Property {number} volume - Gets or sets the volume of this sound, a value between 0 and 1.

  • @readonly
    */
    Object.defineProperty(Phaser.Sound.prototype, "volume", {

    get: function () {
    return this._volume;
    },

    set: function (value) {

    //  Causes an Index size error in Firefox if you don't clamp the value
    if (this.game.device.firefox && this.usingAudioTag)
    {
        value = this.game.math.clamp(value, 0, 1);
    }
    
    if (this._muted)
    {
        this._muteVolume = value;
        return;
    }
    
    this._tempVolume = value;
    this._volume = value;
    
    if (this.usingWebAudio)
    {
        this.gainNode.gain.value = value;
    }
    else if (this.usingAudioTag && this._sound)
    {
        this._sound.volume = value;
    }
    

    }

@photonstorm
Copy link
Collaborator

Thanks for submitting this issue. We have fixed this, and the fix has been pushed to the dev branch.

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