void gaX_stream_destroy(ga_BufferedStream* in_stream) { ga_BufferedStream* s = in_stream; gaX_stream_link_kill((gaX_StreamLink*)s->streamLink); /* This must be done first, so that the stream remains valid until it killed */ gaX_stream_link_release((gaX_StreamLink*)s->streamLink); gc_mutex_destroy(s->produceMutex); gc_mutex_destroy(s->seekMutex); gc_mutex_destroy(s->readMutex); gc_mutex_destroy(s->refMutex); gc_buffer_destroy(s->buffer); gauX_tell_jump_clear(&s->tellJumps); ga_sample_source_release(s->innerSrc); gcX_ops->freeFunc(s); }
void gauX_sample_source_ogg_close(void* in_context) { gau_SampleSourceOggContext* ctx = &((gau_SampleSourceOgg*)in_context)->context; ov_clear(&ctx->oggFile); ga_data_source_release(ctx->dataSrc); gc_mutex_destroy(ctx->oggMutex); }
void gaX_sample_source_destroy(ga_SampleSource* in_sampleSrc) { tSampleSourceFunc_Close func = in_sampleSrc->closeFunc; if(func) func(in_sampleSrc); gc_mutex_destroy(in_sampleSrc->refMutex); gcX_ops->freeFunc(in_sampleSrc); }
gc_result gaX_handle_cleanup(ga_Handle* in_handle) { /* May only be called from the dispatch thread */ ga_Mixer* m = in_handle->mixer; ga_sample_source_release(in_handle->sampleSrc); gc_mutex_destroy(in_handle->handleMutex); gcX_ops->freeFunc(in_handle); return GC_SUCCESS; }
void gaX_data_source_destroy(ga_DataSource* in_dataSrc) { tDataSourceFunc_Close func = in_dataSrc->closeFunc; char* context = (char*)in_dataSrc + sizeof(ga_DataSource); assert(in_dataSrc->refCount == 0); if(func) func(context); gc_mutex_destroy(in_dataSrc->refMutex); gcX_ops->freeFunc(in_dataSrc); }
gc_result ga_mixer_destroy(ga_Mixer* in_mixer) { /* NOTE: Mixer/handles must no longer be in use on any thread when destroy is called */ ga_Mixer* m = in_mixer; gc_Link* link; link = m->dispatchList.next; while(link != &m->dispatchList) { ga_Handle* oldHandle = (ga_Handle*)link->data; link = link->next; gaX_handle_cleanup(oldHandle); } gc_mutex_destroy(in_mixer->dispatchMutex); gc_mutex_destroy(in_mixer->mixMutex); gcX_ops->freeFunc(in_mixer->mixBuffer); gcX_ops->freeFunc(in_mixer); return GC_SUCCESS; }
void ga_stream_manager_destroy(ga_StreamManager* in_mgr) { gc_Link* link; link = in_mgr->streamList.next; while(link != &in_mgr->streamList) { gaX_StreamLink* oldLink = (gaX_StreamLink*)link; link = link->next; gaX_stream_link_release(oldLink); } gc_mutex_destroy(in_mgr->streamListMutex); gcX_ops->freeFunc(in_mgr); }
void gauX_sample_source_loop_close(void* in_context) { gau_SampleSourceLoopContext* ctx = &((gau_SampleSourceLoop*)in_context)->context; ga_sample_source_release(ctx->innerSrc); gc_mutex_destroy(ctx->loopMutex); }
void gauX_sample_source_wav_close(void* in_context) { gau_SampleSourceWavContext* ctx = &((gau_SampleSourceWav*)in_context)->context; ga_data_source_release(ctx->dataSrc); gc_mutex_destroy(ctx->posMutex); }
void gauX_data_source_memory_close(void* in_context) { gau_DataSourceMemoryContext* ctx = (gau_DataSourceMemoryContext*)in_context; ga_memory_release(ctx->memory); gc_mutex_destroy(ctx->memMutex); }
void gauX_data_source_file_arc_close(void* in_context) { gau_DataSourceFileArcContext* ctx = (gau_DataSourceFileArcContext*)in_context; fclose(ctx->f); gc_mutex_destroy(ctx->fileMutex); }
void gauX_sample_source_sound_close(void* in_context) { gau_SampleSourceSoundContext* ctx = &((gau_SampleSourceSound*)in_context)->context; ga_sound_release(ctx->sound); gc_mutex_destroy(ctx->posMutex); }
void gaX_stream_link_destroy(gaX_StreamLink* in_streamLink) { gc_mutex_destroy(in_streamLink->produceMutex); gc_mutex_destroy(in_streamLink->refMutex); gcX_ops->freeFunc(in_streamLink); }