Repository navigation
Conversation
0b26f61 to
64763cc
Compare
|
Dropping WASM_WORKERS in light of -s AUDIO_WORKLET=1 - fixes MAIN_MODULE issues |
Cherry-picked from Jonathhhan/Emscripten-glInfoExample-fix - Wrap GL limits and file handling in #ifndef TARGET_EMSCRIPTEN - Original PR: openframeworks#7211
Cherry-picked from Jonathhhan/Emscripten_audioDeviceSelect_draft - Add library_audioDeviceSelect.js for audio device enumeration - Update library_html5audio.js - Add --post-js for audioDeviceSelect in config.emscripten.default.mk - Original PR: openframeworks#7261
Cherry-picked from Jonathhhan/Emscripten_recordVideo - Add recordVideo.js and fix-webm-duration.js for canvas recording - Update library_html5audio.js (MediaStreamAudioDestinationNode) - Add --pre-js for recordVideo/fix-webm in config.emscripten.default.mk - Original PR: openframeworks#7553
Cherry-picked from Jonathhhan/audioWorklet-3 - Update html5audio to audioWorklet (AudioContext 44100, MediaStreamAudioDestinationNode, emscriptenRegisterAudioObject) - Rewrite ofxEmscriptenSoundStream to use emscripten_create_wasm_audio_worklet_node - Update sound examples to 128 buffer, fix mutex to std::mutex - Add USE_PTHREADS, AUDIO_WORKLET, WASM_WORKERS flags for 6.x (adapted for 6.0.6) - Original PR: openframeworks#7727
WASM_WORKERS=1 + AUDIO_WORKLET=1 with MAIN_MODULE=1 fails on 6.0.6. Use MAIN_MODULE=2 (dynamic) which allows WASM_WORKERS. Keeps WASM_WORKERS perf for audioWorklet while allowing MAIN_MODULE.
The previous commit's MAIN_MODULE=2 does not help: emscripten rejects
WASM_WORKERS with any MAIN_MODULE ("dynamic linking is not supported").
Removing MAIN_MODULE exposed the problems it was hiding:
- config: drop MAIN_MODULE (EXPORT_ALL still exports every symbol for the
JS libraries), link library_html5audio.js (the html5audio_* functions
were undefined; MAIN_MODULE let that link), drop WEBAUDIO_DEBUG (its
logging calls dbg(), which only exists with ASSERTIONS), and default
EMBIND_AOT to 0 as the comment says: EMBIND_AOT fails with
"expected to find pattern <<< EMBIND_AOT_INVOKERS >>>" when there are
no EMSCRIPTEN_BINDINGS, and OF core has none.
- library_html5audio.js: html5audio_stream_create depends on $emAudio;
emscripten 6.0.11's $emscriptenGetAudioObject reads emAudio without
declaring it, so it was undefined.
- ofxEmscriptenSoundPlayer: re-enable the html5audio calls disabled in
cd463ee. ofxEmscriptenAudioContext() compiled to
"context = initialized = true", so the stream got audio context 1,
which does not exist.
- recordVideo.js / fix-webm-duration.js: --pre-js code also runs in the
audio worklet, which has no document or window. The undeclared
drawTexture__deps assignment and window.ysFixWebmDuration threw there,
so the worklet processor never started and there was no sound.
2ad406e to
afa5f09
Compare
Rebased on master and fixed: Emscripten audio now builds and playsRebase: the template typo fix is dropped, because it's already on master (#8559). The New commit
Tested: emsdk 6.0.11, headless Chrome on macOS, served with COOP/COEP headers.
Still to look at:
|
|
The empty waveform panes in |
- recordVideo.js: add OF's audio track only when an audio context exists. Apps with no sound stream / player (e.g. graphicsExample) failed with "Cannot read properties of undefined (reading 'stream')", and the stop call then failed on the undefined MediaRecorder. - recordVideo.js: stopping when not recording is a no-op, and the download is named after the recorded container (Video.webm on Chrome, it was always Video.mp4). - library_html5audio.js: restore AUDIO.contextStream (a MediaStreamAudioDestinationNode fed by the analyser) from the record video change; the audioWorklet rewrite dropped it, so recordings had no audio.
Record video tested, with fixes in
|
The 4 examples running (WebGL2, headless Chrome, emsdk 6.0.11)Built with make from this PR merged with current master (
The input example's microphone is a 330 Hz tone injected through glInfoExample audioOutputExample (mouse x pans, y sets the frequency) audioInputExample soundBufferExample |
PROJECT_EMSCRIPTEN_WASM = 32 (default) or 64 in a project's config.make, or make PROJECT_EMSCRIPTEN_WASM=64 (EMSCRIPTEN_MEMORY64 still selects 64). - libs come from libs/*/lib/emscripten/WASM or WASM64 (ABI_PATH); the recursive lib/emscripten search linked both when both were installed - wasm64 builds the core into lib/emscripten/WASM64 and objects into their own WASM64 folders, so 32 and 64 builds don't overwrite each other; wasm32 paths are unchanged - -sMEMORY64=1 on compile, on the core's relocatable link (emcc -r) and on the app link; the old EMSCRIPTEN_MEMORY64 link flags were overwritten by the later PLATFORM_LDFLAGS assignment





Combined Emscripten PRs, cherry-picked with original author (Jonathhhan) and adapted for 6.0.6: