void play_bgmusic(void) { uint16_t i; for (;;) { for (i = 0; i < SONG; i += 2) { play_tone(bgmusic[i], (float) bgmusic[i+1]); while (is_sound_playing()); delay(100); } } }
static duk_ret_t js_Sound_isPlaying(duk_context* ctx) { sound_t* sound; duk_push_this(ctx); duk_get_prop_string(ctx, -1, "\xFF" "ptr"); sound = duk_get_pointer(ctx, -1); duk_pop(ctx); duk_pop(ctx); duk_push_boolean(ctx, is_sound_playing(sound)); return 1; }