예제 #1
0
static void load_enabled_from_config (void)
{
    int count = aud_get_int ("ladspa", "plugin_count");

    for (int i = 0; i < count; i ++)
    {
        char key[32];

        snprintf (key, sizeof key, "plugin%d_path", i);
        char * path = aud_get_string ("ladspa", key);

        snprintf (key, sizeof key, "plugin%d_label", i);
        char * label = aud_get_string ("ladspa", key);

        PluginData * plugin = find_plugin (path, label);
        if (plugin)
        {
            LoadedPlugin * loaded = enable_plugin_locked (plugin);

            int ccount = index_count (loaded->plugin->controls);
            for (int ci = 0; ci < ccount; ci ++)
            {
                snprintf (key, sizeof key, "plugin%d_control%d", i, ci);
                loaded->values[ci] = aud_get_double ("ladspa", key);
            }
        }

        g_free (path);
        g_free (label);
    }
}
예제 #2
0
static void load_enabled_from_config (void)
{
    int count = aud_get_int ("ladspa", "plugin_count");

    for (int i = 0; i < count; i ++)
    {
        char key[32];

        snprintf (key, sizeof key, "plugin%d_path", i);
        char * path = aud_get_str ("ladspa", key);

        snprintf (key, sizeof key, "plugin%d_label", i);
        char * label = aud_get_str ("ladspa", key);

        PluginData * plugin = find_plugin (path, label);
        if (plugin)
        {
            LoadedPlugin * loaded = enable_plugin_locked (plugin);

            snprintf (key, sizeof key, "plugin%d_controls", i);

            int ccount = index_count (loaded->plugin->controls);
            double temp[ccount];

            char * controls = aud_get_str ("ladspa", key);

            if (str_to_double_array (controls, temp, ccount))
            {
                for (int ci = 0; ci < ccount; ci ++)
                    loaded->values[ci] = temp[ci];
            }
            else
            {
                /* migrate from old config format */
                for (int ci = 0; ci < ccount; ci ++)
                {
                    snprintf (key, sizeof key, "plugin%d_control%d", i, ci);
                    loaded->values[ci] = aud_get_double ("ladspa", key);
                    aud_set_str ("ladspa", key, "");
                }
            }

            str_unref (controls);
        }

        str_unref (path);
        str_unref (label);
    }
}
예제 #3
0
static void enable_selected (void)
{
    pthread_mutex_lock (& mutex);

    int count = index_count (plugins);
    for (int i = 0; i < count; i ++)
    {
        PluginData * plugin = index_get (plugins, i);
        if (plugin->selected)
            enable_plugin_locked (plugin);
    }

    pthread_mutex_unlock (& mutex);

    if (loaded_list)
        update_loaded_list (loaded_list);
}