Exemplo n.º 1
0
static void v_mk_lim_run(
        PYFX_Handle instance, int sample_count,
        struct ShdsList * midi_events,
        t_pydaw_seq_event *atm_events, int atm_event_count)
{
    t_mk_lim *plugin_data = (t_mk_lim*)instance;

    t_pydaw_seq_event **events = (t_pydaw_seq_event**)midi_events->data;
    int event_count = midi_events->len;

    int f_i = 0;
    int midi_event_pos = 0;
    t_lim_limiter * f_lim = &plugin_data->mono_modules->limiter;
    plugin_data->midi_event_count = 0;

    for(f_i = 0; f_i < event_count; ++f_i)
    {
        v_mk_lim_process_midi_event(plugin_data, events[f_i]);
    }

    v_plugin_event_queue_reset(&plugin_data->atm_queue);

    for(f_i = 0; f_i < atm_event_count; ++f_i)
    {
        v_plugin_event_queue_add(
            &plugin_data->atm_queue, atm_events[f_i].type,
            atm_events[f_i].tick, atm_events[f_i].value, atm_events[f_i].port);
    }

    f_i = 0;

    while(f_i < sample_count)
    {
        while(midi_event_pos < plugin_data->midi_event_count &&
                plugin_data->midi_event_ticks[midi_event_pos] == f_i)
        {
            if(plugin_data->midi_event_types[midi_event_pos] ==
                    PYDAW_EVENT_CONTROLLER)
            {
                v_cc_map_translate(
                    &plugin_data->cc_map, plugin_data->descriptor,
                    plugin_data->port_table,
                    plugin_data->midi_event_ports[midi_event_pos],
                    plugin_data->midi_event_values[midi_event_pos]);
            }
            ++midi_event_pos;
        }

        v_plugin_event_queue_atm_set(
            &plugin_data->atm_queue, f_i, plugin_data->port_table);

        v_lim_set(f_lim,
            *plugin_data->threshold * 0.1f, *plugin_data->ceiling * 0.1f,
            *plugin_data->release);

        v_lim_run(f_lim, plugin_data->output0[f_i], plugin_data->output1[f_i]);

        plugin_data->output0[f_i] = f_lim->output0;
        plugin_data->output1[f_i] = f_lim->output1;
        ++f_i;
    }

    if((int)(*plugin_data->peak_meter))
    {
        if(f_lim->peak_tracker.dirty)
        {
            sprintf(plugin_data->ui_msg_buff, "%i|gain|%f",
                plugin_data->plugin_uid, f_lim->peak_tracker.gain_redux);
            plugin_data->queue_func("ui", plugin_data->ui_msg_buff);
            v_pkm_redux_lin_reset(&f_lim->peak_tracker);
        }
    }
}
Exemplo n.º 2
0
static void v_scc_run(
        PYFX_Handle instance, int sample_count,
        struct ShdsList * midi_events, struct ShdsList * atm_events)
{
    t_scc *plugin_data = (t_scc*)instance;

    t_pydaw_seq_event **events = (t_pydaw_seq_event**)midi_events->data;
    int event_count = midi_events->len;

    t_scc_sidechain_comp * f_cmp = &plugin_data->mono_modules->sidechain_comp;

    int f_i = 0;
    int midi_event_pos = 0;
    plugin_data->midi_event_count = 0;

    for(f_i = 0; f_i < event_count; ++f_i)
    {
        v_scc_process_midi_event(plugin_data, events[f_i]);
    }

    v_plugin_event_queue_reset(&plugin_data->atm_queue);

    t_pydaw_seq_event * ev_tmp;
    for(f_i = 0; f_i < atm_events->len; ++f_i)
    {
        ev_tmp = (t_pydaw_seq_event*)atm_events->data[f_i];
        v_plugin_event_queue_add(
            &plugin_data->atm_queue, ev_tmp->type,
            ev_tmp->tick, ev_tmp->value, ev_tmp->port);
    }

    f_i = 0;

    while(f_i < sample_count)
    {
        while(midi_event_pos < plugin_data->midi_event_count &&
                plugin_data->midi_event_ticks[midi_event_pos] == f_i)
        {
            if(plugin_data->midi_event_types[midi_event_pos] ==
                    PYDAW_EVENT_CONTROLLER)
            {
                v_cc_map_translate(
                    &plugin_data->cc_map, plugin_data->descriptor,
                    plugin_data->port_table,
                    plugin_data->midi_event_ports[midi_event_pos],
                    plugin_data->midi_event_values[midi_event_pos]);
            }
            ++midi_event_pos;
        }

        v_plugin_event_queue_atm_set(
            &plugin_data->atm_queue, f_i, plugin_data->port_table);

        v_scc_set(f_cmp,
            *plugin_data->threshold, (*plugin_data->ratio) * 0.1f,
            *plugin_data->attack * 0.001f, *plugin_data->release * 0.001f,
            *plugin_data->wet * 0.01f);

        v_scc_run_comp(f_cmp,
            plugin_data->sc_input0[f_i], plugin_data->sc_input1[f_i],
            plugin_data->output0[f_i], plugin_data->output1[f_i]);

        plugin_data->output0[f_i] = f_cmp->output0;
        plugin_data->output1[f_i] = f_cmp->output1;
        ++f_i;
    }

    if((int)(*plugin_data->peak_meter))
    {
        if(f_cmp->peak_tracker.dirty)
        {
            sprintf(plugin_data->ui_msg_buff, "%i|gain|%f",
                plugin_data->plugin_uid, f_cmp->peak_tracker.gain_redux);
            plugin_data->queue_func("ui", plugin_data->ui_msg_buff);
            v_pkm_redux_lin_reset(&f_cmp->peak_tracker);
        }
    }
}