-
Notifications
You must be signed in to change notification settings - Fork 1
Update Emscripten example to work with the new 4.0 API. #1
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
base: master
Are you sure you want to change the base?
Update Emscripten example to work with the new 4.0 API. #1
Conversation
projectM_SDL_emscripten.cpp
Outdated
projectm_set_aspect_correction(app.projectM, true); | ||
projectm_set_easter_egg(app.projectM, 0); | ||
|
||
projectm_set_preset_switch_failed_event_callback(app.projectM, &presetSwitchFailedEvent, nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I'm redirecting the preset switch failed event to the app itself to prevent the playlist from spamming preset switches. The playlist manager will then only handle preset switch requests once.
A similar thing could be done by setting retries to 0, but can't properly log the failure then.
Having some trouble building this branch. I followed the install steps here https://emscripten.org/docs/getting_started/downloads.html
Then followed the build steps in the Readme here
I think the Readme needs to be updated. Those commands are missing
I am not seeing these artifacts. Should I
Then should I build the example?
I tried a few things to for presets in the build but no luck. |
Also tried against https://github.com/kblaschke/projectm/tree/gles-fixes and same errors...
|
Aha! Hardcoding presets got me further noah@studio build % git diff emscripten
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c5b406d..cd48bc5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,5 +30,5 @@ target_link_options(projectM_SDL_emscripten
"SHELL:-s MAX_WEBGL_VERSION=2"
"SHELL:-s FULL_ES2=1"
"SHELL:-s ALLOW_MEMORY_GROWTH=1"
- "SHELL:--preload-file ${PRESETS_DIR}@/presets"
+ "SHELL:--preload-file /Users/noah/src/projectM/projectm/presets"
)
|
Still not able to get this to work. Builds are going well with
However loading the resulting build is giving errors in the javascript console:
I tweaked the html a little bit to wait for user interaction before trying to use the audio context but that hasn't helped. I did actually get this running once, but I don't recall the exact emscripten or projectm versions. |
This works against projectm version projectM-visualizer/projectm@8461bb9 So something in projectM-visualizer/projectm#741 broke it |
There's something going wrong when switching/loading presets as far as I could tell. I sadly didn't found the time yet between Christmas parties and curing a bad flu to look further into it or even merge my other open PRs. Hopefully will get this resolved in early January. If you can find out more until then, that's highly appreciated. |
@nzoschke Got further? |
On the emcmake command, I modified it to include |
@fucksophie The proper variable to pass to CMake would be
I'm also a bit confused about the |
Noticed I had a few changes lying around for a while, pushed them. Build works with latest libprojectM dev versions. Here's the build result for demonstration purposes. Audio capturing is still wonky, sometimes it works, sometimes not. Guess this is a browser thing, or some issue with the web audio API and emscripten. @blaquewithaq You expertise with browser audio capturing might come in handy in that regard! |
Basically replaced everything which was renewed with the API update and used the emscripten main loop with argument to pass in the static app object.