Repository navigation
Tone context migration - #111
Merged
Merged
Conversation
p5soundNode built its input/output from a raw AudioContext, which left Firefox missing AudioParam.cancelAndHoldAtTime() and the AudioParam-based AudioListener properties. Both were patched locally. Build the graph on the Tone.js Context instead: input/output are now Tone Gain nodes and connections go through Tone's own connect(), so the fixes come from the standardized-audio-context layer Tone already bundles and the two polyfills are deleted. Keep getAudioContext() returning the plain AudioContext it always did. Returning the Tone Context breaks ordinary Web Audio code, because createGain() yields a bare node while destination is a Tone wrapper; the private getToneContext() serves the graph. Expose the bundled Tone.js as p5.Tone. Two copies of Tone.js cannot share an audio graph whichever context they are handed, since each bundles its own standardized-audio-context whose type checks reject the other's nodes, so example 020 now uses the bundled copy rather than a CDN script. Also fixes, all surfaced by the migration: - Delay.process() threw on setValueAtTime when its optional delayTime and feedback arguments were omitted, and now applies both immediately rather than through a ramp that cannot advance while the context is suspended. - Amplitude.setInput(), Delay.process() and Panner3D.process() connected a source's input gain instead of its output. - Three example sketches touched a sound file before loadSound() resolved. Example suite (Playwright, chromium + firefox): 59 passing before, 66 now. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.