Tone.js icon indicating copy to clipboard operation
Tone.js copied to clipboard

allow worklet-based effects to be used with native contexts

Open marcelblum opened this issue 2 years ago • 2 comments

This is a fix for the following bug which occurs when trying to instantiate any effect node that uses an AudioWorklet (BitCrusher, JCReverb, etc.) if using Tone with a native context (non-Standardized Audio Context):

Screenshot 2022-10-15 015036

If there's any better way than this to check if a context is from Standardized Audio Context or not, let me know! ~~This is using context.constructor.name.includes("AudioContext") which catches native online & offline contexts consistently AFAICT, whereas with those created by Standardized Audio Context context.constructor.name is always an empty string.~~ Now using context instanceof window.BaseAudioContext per @chrisguttandin's suggestion.

marcelblum avatar Oct 15 '22 06:10 marcelblum

Codecov Report

Attention: Patch coverage is 50.00000% with 1 lines in your changes are missing coverage. Please review.

:exclamation: No coverage uploaded for pull request base (dev@56fea7c). Click here to learn what that means.

:exclamation: Current head 843870c differs from pull request most recent head fbd1135. Consider uploading reports for the commit fbd1135 to get more accurate results

Files Patch % Lines
Tone/core/context/AudioContext.ts 50.00% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@          Coverage Diff           @@
##             dev    #1131   +/-   ##
======================================
  Coverage       ?   98.43%           
======================================
  Files          ?      184           
  Lines          ?     7724           
  Branches       ?      681           
======================================
  Hits           ?     7603           
  Misses         ?       34           
  Partials       ?       87           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 15 '22 06:10 codecov[bot]

Dang I wasn't seeing those tests fail locally, will investigate soon.

marcelblum avatar Oct 15 '22 14:10 marcelblum

🙏🏻 @marcelblum and @chrisguttandin

tambien avatar May 06 '24 15:05 tambien