int trap_FreeMusic(lua_State *s) { MUSIC *m; trap_args(s, "FreeMusic", "p", &m); music_free(m); return 0; }
/** * @brief Exits the music subsystem. */ void music_exit (void) { if (music_disabled) return; /* Free the music. */ music_free(); /* Exit the subsystem. */ music_sys_exit(); /* Destroy the lock. */ if (music_lock != NULL) { SDL_DestroyMutex(music_lock); music_lock = NULL; } }
/** * @brief Loads the music by name. * * @param name Name of the file to load. */ int music_load( const char* name ) { SDL_RWops *rw; char filename[PATH_MAX]; if (music_disabled) return 0; /* Free current music if needed. */ music_free(); /* Load new music. */ music_name = strdup(name); music_start = SDL_GetTicks(); snprintf( filename, PATH_MAX, MUSIC_PREFIX"%s"MUSIC_SUFFIX, name); rw = ndata_rwops( filename ); if (rw == NULL) { WARN("Music '%s' not found.", filename); return -1; } music_sys_load( name, rw ); return 0; }