Esempio n. 1
0
static void Device_thread_state_clear_buffers(
        Device_thread_state* ts,
        Device_buffer_type buf_type,
        int32_t buf_start,
        int32_t buf_stop)
{
    rassert(ts != NULL);
    rassert(buf_type < DEVICE_BUFFER_TYPES);
    rassert(buf_start >= 0);
    rassert(buf_stop >= buf_start);

    for (Device_port_type port_type = DEVICE_PORT_TYPE_RECV;
            port_type < DEVICE_PORT_TYPES; ++port_type)
    {
        Etable* bufs = ts->buffers[buf_type][port_type];
        const int cap = Etable_get_capacity(bufs);
        for (int port = 0; port < cap; ++port)
        {
            Work_buffer* buffer = Etable_get(bufs, port);
            if (buffer != NULL)
                Work_buffer_clear(buffer, buf_start, buf_stop);
        }
    }

    Bit_array_clear(ts->in_connected);

    return;
}
Esempio n. 2
0
DSP* DSP_table_get_dsp(const DSP_table* table, int index)
{
    assert(table != NULL);
    assert(index >= 0);
    assert(index < table->size);

    return Etable_get(table->dsps, index);
}
Esempio n. 3
0
Pattern* Pat_table_get(Pat_table* table, int index)
{
    rassert(table != NULL);
    rassert(index >= 0);
    rassert(index < table->size);

    return Etable_get(table->pats, index);
}
Esempio n. 4
0
void DSP_table_set_existent(DSP_table* table, int index, bool existent)
{
    assert(table != NULL);
    assert(index >= 0);
    assert(index < table->size);

    Bit_array_set(table->existents, index, existent);

    DSP* dsp = Etable_get(table->dsps, index);
    if (dsp != NULL)
        Device_set_existent((Device*)dsp, existent);

    return;
}
Esempio n. 5
0
static Work_buffer* Device_thread_state_get_buffer(
        const 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 ((port_type == DEVICE_PORT_TYPE_RECV) &&
            !Device_thread_state_is_input_port_connected(ts, port))
        return NULL;

    return Etable_get(ts->buffers[buf_type][port_type], port);
}
Esempio n. 6
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;
}
Esempio n. 7
0
bool Device_thread_state_set_audio_buffer_size(Device_thread_state* ts, int size)
{
    rassert(ts != NULL);
    rassert(size >= 0);

    for (Device_buffer_type buf_type = DEVICE_BUFFER_MIXED;
            buf_type < DEVICE_BUFFER_TYPES; ++buf_type)
    {
        for (Device_port_type port_type = DEVICE_PORT_TYPE_RECV;
                port_type < DEVICE_PORT_TYPES; ++port_type)
        {
            Etable* bufs = ts->buffers[buf_type][port_type];
            const int cap = Etable_get_capacity(bufs);
            for (int port = 0; port < cap; ++port)
            {
                Work_buffer* buffer = Etable_get(bufs, port);
                if ((buffer != NULL) && !Work_buffer_resize(buffer, size))
                    return false;
            }
        }
    }

    return true;
}