Fix audio on emscripten

This commit is contained in:
tovjemam 2026-01-10 12:51:53 +01:00
parent 421fbdd710
commit 1794e52cf1
4 changed files with 9 additions and 6 deletions

View File

@ -170,6 +170,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL Emscripten)
target_link_options(${MAIN_NAME} PRIVATE target_link_options(${MAIN_NAME} PRIVATE
"-lwebsocket.js" "-lwebsocket.js"
"-lopenal"
"-sUSE_SDL=2" "-sUSE_SDL=2"
"-sASYNCIFY" "-sASYNCIFY"
"-sUSE_WEBGL2=1" "-sUSE_WEBGL2=1"

View File

@ -2,9 +2,6 @@
#include <iostream> #include <iostream>
#include <AL/al.h>
#include <AL/alc.h>
#include "defs.hpp" #include "defs.hpp"
#include "sound_source.hpp" #include "sound_source.hpp"
#include "source.hpp" #include "source.hpp"

View File

@ -4,11 +4,12 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "utils/defs.hpp" #include <AL/al.h>
#include <AL/alc.h>
#include <glm/glm.hpp> #include <glm/glm.hpp>
class ALCdevice; #include "utils/defs.hpp"
class ALCcontext;
namespace audio namespace audio
{ {

View File

@ -11,7 +11,11 @@ App::App()
{ {
std::cout << "Initializing App..." << std::endl; std::cout << "Initializing App..." << std::endl;
#ifndef EMSCRIPTEN
audiomaster_.SetMasterVolume(0.2f); audiomaster_.SetMasterVolume(0.2f);
#else
audiomaster_.SetMasterVolume(2.0f);
#endif
} }
void App::Frame() void App::Frame()