예제 #1
0
static int allua_sample_instance_get_sample(lua_State * L)
{
   ALLUA_sample_instance si = allua_check_sample_instance(L, 1);
   ALLUA_sample s = al_get_sample(si);
   if (s)
      allua_pushsample(L, s, false);
   else
      lua_pushnil(L);
   return 1;
}
예제 #2
0
/* Stop any sample instances which are still playing a sample buffer which
 * is about to be destroyed.
 */
static void stop_sample_instances_helper(void *object, void (*func)(void *),
   void *userdata)
{
   ALLEGRO_SAMPLE_INSTANCE *splinst = object;

   /* This is ugly. */
   if (func == (void (*)(void *)) al_destroy_sample_instance
      && al_get_sample_data(al_get_sample(splinst)) == userdata
      && al_get_sample_instance_playing(splinst))
   {
      al_stop_sample_instance(splinst);
   }
}