Fix audio during transition

This commit is contained in:
Varun Patil 2020-05-05 10:34:57 +05:30
parent 4386a5a894
commit 40c1872245
2 changed files with 12 additions and 8 deletions

View File

@ -19,10 +19,6 @@
** along with mkxp. If not, see <http://www.gnu.org/licenses/>. ** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef __EMSCRIPTEN__
#include "audio.h"
#endif
#include "graphics.h" #include "graphics.h"
#include "sharedstate.h" #include "sharedstate.h"
#include "binding-util.h" #include "binding-util.h"
@ -34,10 +30,6 @@ MRB_FUNCTION(graphicsUpdate)
shState->graphics().update(); shState->graphics().update();
#ifdef __EMSCRIPTEN__
shState->audio().update();
#endif
return mrb_nil_value(); return mrb_nil_value();
} }

View File

@ -47,6 +47,10 @@
#include <errno.h> #include <errno.h>
#include <algorithm> #include <algorithm>
#ifdef __EMSCRIPTEN__
#include "audio.h"
#endif
#define DEF_SCREEN_W (rgssVer == 1 ? 640 : 544) #define DEF_SCREEN_W (rgssVer == 1 ? 640 : 544)
#define DEF_SCREEN_H (rgssVer == 1 ? 480 : 416) #define DEF_SCREEN_H (rgssVer == 1 ? 480 : 416)
#define DEF_FRAMERATE (rgssVer == 1 ? 40 : 60) #define DEF_FRAMERATE (rgssVer == 1 ? 40 : 60)
@ -658,6 +662,10 @@ void Graphics::update()
p->checkShutDownReset(); p->checkShutDownReset();
p->checkSyncLock(); p->checkSyncLock();
#ifdef __EMSCRIPTEN__
shState->audio().update();
#endif
if (p->frozen) if (p->frozen)
return; return;
@ -801,6 +809,10 @@ void Graphics::transition(int duration,
GLMeta::blitEnd(); GLMeta::blitEnd();
p->swapGLBuffer(); p->swapGLBuffer();
#ifdef __EMSCRIPTEN__
shState->audio().update();
#endif
} }
glState.blend.pop(); glState.blend.pop();