Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5b78dda

Browse files
Restore basic working condition.
1 parent 35f7b2d commit 5b78dda

File tree

3 files changed

+43
-26
lines changed

3 files changed

+43
-26
lines changed

‎CMakeLists.txt‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
2+
3+
project(projectM_Emscripten)
4+
5+
message(STATUS "${CMAKE_PREFIX_PATH}")
6+
7+
find_package(libprojectM REQUIRED CONFIG)
8+
9+
# Setting the suffix to .html also creates an HTML file in addition to the .js and .wasm outputs.
10+
set(CMAKE_EXECUTABLE_SUFFIX ".html")
11+
12+
add_executable(projectM_SDL_emscripten
13+
projectM_SDL_emscripten.cpp
14+
)
15+
16+
target_link_libraries(projectM_SDL_emscripten
17+
PRIVATE
18+
libprojectM::static
19+
)
20+
21+
target_compile_options(projectM_SDL_emscripten
22+
PRIVATE
23+
"SHELL:-s USE_SDL=2"
24+
)
25+
26+
target_link_options(projectM_SDL_emscripten
27+
PRIVATE
28+
"SHELL:-s USE_SDL=2"
29+
"SHELL:-s MIN_WEBGL_VERSION=2"
30+
"SHELL:-s MAX_WEBGL_VERSION=2"
31+
"SHELL:-s FULL_ES2=1"
32+
"SHELL:-s ALLOW_MEMORY_GROWTH=1"
33+
"SHELL:--preload-file ${PRESETS_DIR}@/presets"
34+
)

‎src/projectM-emscripten/projectM_SDL_emscripten.cpp‎ renamed to ‎projectM_SDL_emscripten.cpp‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
*
55
*/
66

7-
#include <math.h>
8-
#include <projectM.h>
9-
#include <sdltoprojectM.h>
7+
#include <libprojectM/projectM.h>
108

119
#include <emscripten.h>
10+
1211
#include <GL/gl.h>
12+
1313
#include <SDL.h>
1414

15+
#include <cmath>
1516
#include <string>
1617

1718
const int FPS = 60;
@@ -36,11 +37,11 @@ void audioInputCallbackF32(void* userdata, unsigned char* stream, int len)
3637
{
3738
if (app.audioChannelsCount == 1)
3839
{
39-
projectm_pcm_add_float_1ch_data(app.pm, reinterpret_cast<float*>(stream), len / sizeof(float));
40+
projectm_pcm_add_float(app.pm, reinterpret_cast<float*>(stream), len / sizeof(float), PROJECTM_MONO);
4041
}
4142
else if (app.audioChannelsCount == 2)
4243
{
43-
projectm_pcm_add_float_2ch_data(app.pm, reinterpret_cast<float*>(stream), len / sizeof(float));
44+
projectm_pcm_add_float(app.pm, reinterpret_cast<float*>(stream), len / sizeof(float), PROJECTM_STEREO);
4445
}
4546
}
4647

@@ -168,10 +169,12 @@ void keyHandler(const SDL_Event& sdl_evt)
168169
}
169170

170171
// translate into projectM codes and perform default projectM handler
172+
/*
171173
evt = sdl2pmEvent(&sdl_evt);
172174
mod = sdl2pmModifier(sdl_mod);
173175
key = sdl2pmKeycode(sdl_keycode, sdl_mod);
174176
projectm_key_handler(app.pm, evt, key, mod);
177+
*/
175178
}
176179

177180
void presetSwitchedEvent(bool isHardCut, unsigned int index, void* context)
@@ -203,7 +206,7 @@ void generateRandomAudioData()
203206
}
204207
}
205208

206-
projectm_pcm_add_16bit_2ch_512(app.pm, pcm_data);
209+
projectm_pcm_add_int16(app.pm, &pcm_data[0][0], 512, PROJECTM_STEREO);
207210
}
208211

209212
void renderFrame()

‎src/projectM-emscripten/CMakeLists.txt‎

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /