Instance::~Instance() noexcept { if(m_ptr && m_count && --(*m_count) == 0) { Pd::lock(); releaseDsp(); delete m_count; pdinstance_free(reinterpret_cast<t_pdinstance *>(m_ptr)); Pd::unlock(); m_ptr = nullptr; m_count =nullptr; } }
void cpd_clear() { if(c_sample_ins) { freebytes(c_sample_ins, (sys_inchannels ? sys_inchannels : 2) * (DEFDACBLKSIZE * sizeof(t_sample))); } if(c_sample_outs) { freebytes(c_sample_outs, (sys_outchannels ? sys_outchannels : 2) * (DEFDACBLKSIZE * sizeof(t_sample))); } if(c_first_instance) { pdinstance_free(c_first_instance); } cpd_mutex_destroy(&c_mutex); }
Instance& Instance::operator=(Instance const& other) noexcept { if(m_ptr && m_count && --(*m_count) == 0) { Pd::lock(); releaseDsp(); delete m_count; pdinstance_free(reinterpret_cast<t_pdinstance *>(m_ptr)); Pd::unlock(); m_ptr = nullptr; m_count =nullptr; } if(other.m_ptr && other.m_count) { ++(*m_count); m_ptr = other.m_ptr; m_count = other.m_count; } return *this; }
void freeContext() { pdinstance_free(pdContext.thisPdInstance); }