/* Audio_Thread::clear: free thread */ void Audio_Thread::clear() { stop(); m_kill = true; /* wait */ if(m_cond != NULL) glfwSignalCond(m_cond); if(m_mutex != NULL || m_cond != NULL || m_thread >= 0) { if(m_thread >= 0) { glfwWaitThread(m_thread, GLFW_WAIT); glfwDestroyThread(m_thread); } if(m_cond != NULL) glfwDestroyCond(m_cond); if(m_mutex != NULL) glfwDestroyMutex(m_mutex); glfwTerminate(); } if(m_alias) free(m_alias); if(m_file) free(m_file); initialize(); }
/* Audio_Manager::clear: clear */ void Audio_Manager::clear() { Audio_Link *tmp1, *tmp2; m_kill = true; /* stop and release all thread */ for(tmp1 = m_list; tmp1; tmp1 = tmp2) { tmp2 = tmp1->next; tmp1->audio_thread.stopAndRelease(); delete tmp1; } /* wait */ if(m_cond != NULL) glfwSignalCond(m_cond); if(m_mutex != NULL || m_cond != NULL || m_thread >= 0) { if(m_thread >= 0) { glfwWaitThread(m_thread, GLFW_WAIT); glfwDestroyThread(m_thread); } if(m_cond != NULL) glfwDestroyCond(m_cond); if(m_mutex != NULL) glfwDestroyMutex(m_mutex); glfwTerminate(); } Audio_EventQueue_clear(&m_bufferQueue); initialize(); }