#include "web_opts.h" #include "comp.h" #include #include #include #include int delay_ms = 1000; void opts_init() { EM_ASM(readOpts()); char buf[64]; sprintf(buf, "%d", delay_ms); EM_ASM({elemSetValue($0, $1)}, "#delay", buf); int len = sprintf(buf, "%4.2f", horizontal_stdev); char *dot = strchr(buf, '.'); if (dot) { for (char *ptr = buf + len - 1; ptr >= dot; --ptr) { if (*ptr != '0' && *ptr != '.') break; *ptr = 0; } } EM_ASM({elemSetValue($0, $1)}, "#stdev", buf); } EMSCRIPTEN_KEEPALIVE void set_delay(int delay) { delay_ms = delay; } EMSCRIPTEN_KEEPALIVE void set_stdev(float stdev) { if (!isnan(stdev)) horizontal_stdev = vertical_stdev = stdev; }