コード例 #1
0
ファイル: SoundDecoder.c プロジェクト: darkf/almixer
void SoundDecoder_Quit()
{
    size_t i;	
	if(0 == s_isInitialized)
	{
		return;
	}

	/* 
	 * SDL_sound actually embeds the linked list in the internal data structure.
	 * So any sample can potentially reach any other sample.
	 * But I'm keeping my own separate list.
	 */
	while(LinkedList_Size(s_listOfLoadedSamples) > 0)
	{
		SoundDecoder_Sample* sound_sample = (SoundDecoder_Sample*)LinkedList_PopBack(s_listOfLoadedSamples);
		SoundDecoder_FreeSample(sound_sample);
	}
	LinkedList_Free(s_listOfLoadedSamples);
	s_listOfLoadedSamples = NULL;

	
    for(i = 0; s_linkedDecoders[i].funcs != NULL; i++)
    {
        if (s_linkedDecoders[i].available)
        {
            s_linkedDecoders[i].funcs->quit();
            s_linkedDecoders[i].available = 0;
        }
    }

    if(NULL != s_availableDecoders)
	{
        free(s_availableDecoders);
	}
	s_availableDecoders = NULL;


	/* Remember: ALmixer_SetError/GetError calls will not work while this is gone. */
	TError_FreeErrorPool(s_errorPool);
	s_errorPool = NULL;

	s_isInitialized = 0;	
}
コード例 #2
0
ファイル: SoundDecoder.c プロジェクト: ewmailing/MyAppleBugs
void SoundDecoder_Quit()
{
    size_t i;	
	if(0 == s_isInitialized)
	{
		return;
	}

	/* This is a little tricky.
	 * SDL_sound actually embeds the linked list in the internal data structure.
	 * So any sample can potentially reach any other sample.
	 * So s_listOfLoadedSamplesHead just needs to point to any sample.
	 * When FreeSample is called, s_listOfLoadedSamplesHead is changed
	 * to point to another valid node in the list, so it is always valid
	 * until the last sample is deleted.
	 */
	while(NULL != s_listOfLoadedSamplesHead)
	{
		SoundDecoder_FreeSample(s_listOfLoadedSamplesHead);
	}

	
    for(i = 0; s_linkedDecoders[i].funcs != NULL; i++)
    {
        if (s_linkedDecoders[i].available)
        {
            s_linkedDecoders[i].funcs->quit();
            s_linkedDecoders[i].available = 0;
        }
    }

    if(NULL != s_availableDecoders)
	{
        free(s_availableDecoders);
	}
	s_availableDecoders = NULL;


	/* Remember: ALmixer_SetError/GetError calls will not work while this is gone. */
	TError_FreeErrorPool(s_errorPool);
	s_errorPool = NULL;

	s_isInitialized = 0;	
}