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

allow worklet-based effects to be used with native contexts #1131

Merged
merged 3 commits into from
May 6, 2024

Conversation

marcelblum
Copy link
Contributor

@marcelblum marcelblum commented Oct 15, 2022

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.

@codecov
Copy link

codecov bot commented Oct 15, 2022

Codecov Report

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

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

❗ 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 ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##             dev    #1131   +/-   ##
======================================
  Coverage       ?   98.43%           
======================================
  Files          ?      184           
  Lines          ?     7724           
  Branches       ?      681           
======================================
  Hits           ?     7603           
  Misses         ?       34           
  Partials       ?       87           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marcelblum
Copy link
Contributor Author

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

@tambien tambien merged commit f06ff17 into Tonejs:dev May 6, 2024
7 checks passed
@tambien
Copy link
Contributor

tambien commented May 6, 2024

🙏🏻 @marcelblum and @chrisguttandin

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

Successfully merging this pull request may close these issues.

3 participants