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

soundManager.getOutputLevelForCategory always returns undefined #136

Closed
pixelzoom opened this issue Apr 15, 2021 · 2 comments
Closed

soundManager.getOutputLevelForCategory always returns undefined #136

pixelzoom opened this issue Apr 15, 2021 · 2 comments

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 15, 2021

Noted while working on phetsims/fourier-making-waves#55.

soundManager.getOutputLevelForCategory always returns undefined. It's also missing a @returns annotation.

Here's the current implementation:

  /**
   * get the output level for the specified sound generator category
   * @param {String} categoryName - name of category to which this invocation applies
   * @public
   */
  getOutputLevelForCategory( categoryName ) {

    // Check if initialization has been done.  This is not an assertion because the sound manager may not be
    // initialized if sound is not enabled for the sim.
    if ( !this.initialized ) {
      console.warn( 'an attempt was made to get the output level for a sound category on an uninitialized sound manager, returning 0' );
      return 0;
    }

    // verify that the specified category exists
    assert && assert( this.gainNodesForCategories[ categoryName ], `no category with name = ${categoryName}` );

    return this.gainNodesForCategories[ categoryName ].value;
  }
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Apr 15, 2021

Done in the above commits. Note that I also did a little doc cleanup, and factored out:

const gainNode = this.gainNodesForCategories[ categoryName ];

@jbphet please review.

@jbphet
Copy link
Contributor

jbphet commented Apr 21, 2021

Looks good to me, thanks @pixelzoom. Closing.

@jbphet jbphet closed this as completed Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants