/* Internal function: _al_kcm_destroy_sample
 */
void _al_kcm_destroy_sample(ALLEGRO_SAMPLE_INSTANCE *spl, bool unregister)
{
   if (spl) {
      if (unregister) {
         _al_kcm_unregister_destructor(spl);
      }

      _al_kcm_detach_from_parent(spl);
      stream_free(spl);
   }
}
Exemple #2
0
/* Function: al_destroy_voice
 */
void al_destroy_voice(ALLEGRO_VOICE *voice)
{
   if (voice) {
      _al_kcm_unregister_destructor(voice);

      al_detach_voice(voice);
      voice->driver->deallocate_voice(voice);
      al_destroy_mutex(voice->mutex);

      free(voice);
   }
}
Exemple #3
0
/* Function: al_destroy_sample
 */
void al_destroy_sample(ALLEGRO_SAMPLE *spl)
{
   if (spl) {
      _al_kcm_foreach_destructor(stop_sample_instances_helper,
         al_get_sample_data(spl));
      _al_kcm_unregister_destructor(spl);

      if (spl->free_buf && spl->buffer.ptr) {
         al_free(spl->buffer.ptr);
      }
      spl->buffer.ptr = NULL;
      spl->free_buf = false;
      al_free(spl);
   }
}
Exemple #4
0
/* Function: al_destroy_voice
 */
void al_destroy_voice(ALLEGRO_VOICE *voice)
{
   if (voice) {
      _al_kcm_unregister_destructor(voice);

      al_detach_voice(voice);
      ASSERT(al_get_voice_playing(voice) == false);

      /* We do NOT lock the voice mutex when calling this method. */
      voice->driver->deallocate_voice(voice);
      al_destroy_mutex(voice->mutex);
      al_destroy_cond(voice->cond);

      al_free(voice);
   }
}