Exemplo n.º 1
0
void del_Work_buffers(Work_buffers* buffers)
{
    if (buffers == NULL)
        return;

    for (int i = 0; i < WORK_BUFFER_COUNT_; ++i)
        del_Work_buffer(buffers->buffers[i]);

    memory_free(buffers);

    return;
}
Exemplo n.º 2
0
static void del_Delay_pstate(Device_state* dstate)
{
    assert(dstate != NULL);

    Delay_pstate* dpstate = (Delay_pstate*)dstate;

    for (int i = 0; i < KQT_BUFFERS_MAX; ++i)
    {
        if (dpstate->bufs[i] != NULL)
        {
            del_Work_buffer(dpstate->bufs[i]);
            dpstate->bufs[i] = NULL;
        }
    }

    memory_free(dpstate);

    return;
}
Exemplo n.º 3
0
static bool Device_thread_state_add_buffer(
        Device_thread_state* ts,
        Device_buffer_type buf_type,
        Device_port_type port_type,
        int port)
{
    rassert(ts != NULL);
    rassert(buf_type < DEVICE_BUFFER_TYPES);
    rassert(port_type < DEVICE_PORT_TYPES);
    rassert(port >= 0);
    rassert(port < KQT_DEVICE_PORTS_MAX);

    if (Etable_get(ts->buffers[buf_type][port_type], port) != NULL)
        return true;

    Work_buffer* wb = new_Work_buffer(ts->audio_buffer_size);
    if ((wb == NULL) || !Etable_set(ts->buffers[buf_type][port_type], port, wb))
    {
        del_Work_buffer(wb);
        return false;
    }

    return true;
}