You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[AUDIO_WORKLET] Added API for getting the buffer's quantum size (#22681)
The Web Audio API defines the processed sample size as always being
`128`, which is hardcoded in both the test code and docs. The upcoming
Web Audio API has the option to set this to a user defined setting or
request the machine's preference, so in preparation the Audio Worklet is
extended with a function to query the context's _quantum_ at creation
time (and before the worklet is created), and also the processing
callback contains a field with the same value.
For the simplest uses transitioning to the processing callback's field
value will mean future changes will simply work.
Once the 1.1 version of the Web Audio API is supported, the context
creation can be amended to accept a quantum hint, and any code written
again these PR's changes will still work.
assert(EmAudio[contextHandle],`Called emscripten_audio_context_quantum_size() with an invalid Web Audio Context handle ${contextHandle}`);
315
+
assert(EmAudio[contextHandle]instanceof(window.AudioContext||window.webkitAudioContext),`Called emscripten_audio_context_quantum_size() on handle ${contextHandle} that is not an AudioContext, but of type ${EmAudio[contextHandle]}`);
// userData3: A custom userdata pointer to pass to the callback function. This value will be passed on to the call to the given EmscriptenWorkletProcessorCreatedCallback callback function.
// Returns the number of samples processed per channel in an AudioSampleFrame, fixed at 128 in the Web Audio API 1.0 specification, and valid for the lifetime of the audio context.
99
+
// For this to change from the default 128, the context would need creating with a yet unexposed WebAudioWorkletProcessorCreateOptions renderSizeHint, part of the 1.1 Web Audio API.
0 commit comments