int luab_Music_play(lua_State *L) { Music *music = luaL_tomusic(L, 1); check(music != NULL, "Music required"); Music_play(music); return 1; error: return 0; }
Music *Music_load(char *filename, char *loop) { Music *music = malloc(sizeof(Music)); music->volume = 1; #ifdef DABES_IOS music->bridge = calloc(1, sizeof(struct AudioBridge)); AudioBridge_load(music->bridge, filename); if (loop != NULL) { AudioBridge_loop(music->bridge, loop); } #else music->mix_music = Mix_LoadMUS(filename); if (music->mix_music == NULL) { printf("Mix_LoadMUS: %s\n", Mix_GetError()); } #endif Music_play(music); return music; }