diff --git a/binding-mruby/graphics-binding.cpp b/binding-mruby/graphics-binding.cpp
index eeb0278..035da21 100644
--- a/binding-mruby/graphics-binding.cpp
+++ b/binding-mruby/graphics-binding.cpp
@@ -19,10 +19,6 @@
** along with mkxp. If not, see .
*/
-#ifdef __EMSCRIPTEN__
-#include "audio.h"
-#endif
-
#include "graphics.h"
#include "sharedstate.h"
#include "binding-util.h"
@@ -34,10 +30,6 @@ MRB_FUNCTION(graphicsUpdate)
shState->graphics().update();
-#ifdef __EMSCRIPTEN__
- shState->audio().update();
-#endif
-
return mrb_nil_value();
}
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 120f240..68741fe 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -47,6 +47,10 @@
#include
#include
+#ifdef __EMSCRIPTEN__
+#include "audio.h"
+#endif
+
#define DEF_SCREEN_W (rgssVer == 1 ? 640 : 544)
#define DEF_SCREEN_H (rgssVer == 1 ? 480 : 416)
#define DEF_FRAMERATE (rgssVer == 1 ? 40 : 60)
@@ -658,6 +662,10 @@ void Graphics::update()
p->checkShutDownReset();
p->checkSyncLock();
+#ifdef __EMSCRIPTEN__
+ shState->audio().update();
+#endif
+
if (p->frozen)
return;
@@ -801,6 +809,10 @@ void Graphics::transition(int duration,
GLMeta::blitEnd();
p->swapGLBuffer();
+
+#ifdef __EMSCRIPTEN__
+ shState->audio().update();
+#endif
}
glState.blend.pop();