Add sync audio for emscripten

This commit is contained in:
Varun Patil 2020-05-04 17:39:00 +05:30
parent ee39e65061
commit 9b531afb0c
9 changed files with 149 additions and 73 deletions

View file

@ -27,7 +27,7 @@
#define DEF_PLAY_STOP(entity) \
MRB_FUNCTION(audio_##entity##Play) \
{ \
return mrb_nil_value();char *filename; \
char *filename; \
mrb_int volume = 100; \
mrb_int pitch = 100; \
mrb_get_args(mrb, "z|ii", &filename, &volume, &pitch); \
@ -36,7 +36,7 @@
} \
MRB_FUNCTION(audio_##entity##Stop) \
{ \
return mrb_nil_value();MRB_FUN_UNUSED_PARAM; \
MRB_FUN_UNUSED_PARAM; \
shState->audio().entity##Stop(); \
return mrb_nil_value(); \
}
@ -44,7 +44,7 @@
#define DEF_FADE(entity) \
MRB_FUNCTION(audio_##entity##Fade) \
{ \
return mrb_nil_value();mrb_int time; \
mrb_int time; \
mrb_get_args(mrb, "i", &time); \
shState->audio().entity##Fade(time); \
return mrb_nil_value(); \

View file

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