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

Consider pausing all sound generators that support it when sim goes inactive #51

Open
jbphet opened this issue Oct 1, 2018 · 2 comments

Comments

@jbphet
Copy link
Contributor

jbphet commented Oct 1, 2018

Issue phetsims/john-travoltage#309 describes a problem where sound could keep playing when the sim is paused in the LoL framework. To resolve that issue, I added code that essentially disabled sound generation when the sim is not active. A more complete, but also more complex, solution would be to pause all sound generators that support it when the sim becomes inactive, and then resume then if and when the sim becomes active again. The pause functionality is not yet implemented for sound clips (see #40), but once it is, we should consider using it for a more complete pause behavior.

@pixelzoom
Copy link
Contributor

pixelzoom commented Feb 5, 2019

I see "when the sim is paused in the LoL framework" and "when the sim is not active" in the above paragraph. Are "paused" and "not active" synonymous?

And out of curiosity, how does the LoL framework pause a sim?

@samreid
Copy link
Member

samreid commented Feb 14, 2019

LOL support is implemented in LegendsOfLearningSupport:

    // Respond to pause/resume commands from the Legends of Learning platform
    window.addEventListener( 'message', function( message ) {
      if ( message.data.messageName === 'pause' ) {
        sim.stepOneFrame();
        sim.activeProperty.value = false;
      }
      else if ( message.data.messageName === 'resume' ) {
        sim.activeProperty.value = true;
      }
    } );
  }

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

3 participants