Exemple #1
0
bool Delay_pstate_set_max_delay(
        Device_state* dstate, const Key_indices indices, double value)
{
    assert(dstate != NULL);
    ignore(indices);
    ignore(value);

    Delay_pstate* dpstate = (Delay_pstate*)dstate;

    const Proc_delay* delay = (const Proc_delay*)dstate->device->dimpl;

    const int32_t delay_buf_size = delay->max_delay * dstate->audio_rate + 1;

    for (int i = 0; i < KQT_BUFFERS_MAX; ++i)
    {
        Work_buffer* buf = dpstate->bufs[i];

        if (!Work_buffer_resize(buf, delay_buf_size))
            return false;

        Work_buffer_clear(buf, 0, Work_buffer_get_size(buf));
    }

    dpstate->buf_pos = 0;

    return true;
}
Exemple #2
0
static bool Delay_pstate_set_audio_rate(Device_state* dstate, int32_t audio_rate)
{
    assert(dstate != NULL);
    assert(audio_rate > 0);

    Delay_pstate* dpstate = (Delay_pstate*)dstate;

    const Proc_delay* delay = (const Proc_delay*)dstate->device->dimpl;

    const int32_t delay_buf_size = delay->max_delay * audio_rate + 1;

    for (int i = 0; i < KQT_BUFFERS_MAX; ++i)
    {
        Work_buffer* buf = dpstate->bufs[i];

        if (!Work_buffer_resize(buf, delay_buf_size))
            return false;

        Work_buffer_clear(buf, 0, Work_buffer_get_size(buf));
    }

    dpstate->buf_pos = 0;

    return true;
}
Exemple #3
0
bool Work_buffers_resize(Work_buffers* buffers, int32_t new_size)
{
    rassert(buffers != NULL);
    rassert(new_size >= 0);
    rassert(new_size <= WORK_BUFFER_SIZE_MAX);

    for (int i = 0; i < WORK_BUFFER_COUNT_; ++i)
    {
        if (!Work_buffer_resize(buffers->buffers[i], new_size))
            return false;
    }

    return true;
}
Exemple #4
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;
}