Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Audio effects state for clones #891

Conversation

ericrosenbaum
Copy link
Contributor

@ericrosenbaum ericrosenbaum commented Jan 9, 2018

Resolves

Resolves scratchfoundation/scratch-audio#50

Depends on scratchfoundation/scratch-audio#71

Proposed Changes

  • Each clone has its own AudioPlayer (reverting the change here), so that they can apply audio effects (volume, pitch and pan) independently.
  • When a sprite or clone is deleted, its AudioPlayer is disposed, disconnecting its webaudio nodes. This prevents the bug where audio drops out after too many AudioPlayers have been created (Audio quality will degrade over time until it eventually fails scratch-audio#27).
  • Clones get a copy of the audio effects state from their parent sprite, and sync their own AudioPlayer to it.

Reason for Changes

If clones didn't have their own AudioPlayers, they couldn't have independent audio effects settings.

Test Coverage

Let me know if you have suggestions for tests.

Copy link
Contributor

@cwillisf cwillisf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nitpick / discussion point, but otherwise this looks good.

*/
_onTargetCreated (newTarget, sourceTarget) {
if (sourceTarget) {
const soundState = this._getSoundState(sourceTarget);

This comment was marked as abuse.

This comment was marked as abuse.

@ericrosenbaum ericrosenbaum merged commit 115184a into scratchfoundation:develop Jan 23, 2018
@ericrosenbaum ericrosenbaum deleted the bugfix/audioplayer-clone-state branch January 23, 2018 16:55
stefania11 pushed a commit to mitmedialab/cognimates-vm that referenced this pull request Mar 31, 2018
…est-renderer-16.1.1

Update react-test-renderer to the latest version 🚀
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants