示例#1
0
static int inp_debug_init (VisPluginData *plugin)
{
    DebugPriv *priv;
    VisParamEntry *param;
    VisParamContainer *paramcontainer = visual_plugin_get_params (plugin);

    static VisParamEntry params[] = {
        VISUAL_PARAM_LIST_ENTRY_FLOAT ("frequency",  DEFAULT_FREQUENCY),
        VISUAL_PARAM_LIST_ENTRY_FLOAT ("ampltitude", DEFAULT_AMPLITUDE),
        VISUAL_PARAM_LIST_END
    };

    priv = visual_mem_new0 (DebugPriv, 1);
    visual_object_set_private (VISUAL_OBJECT (plugin), priv);

    priv->frequency	 = DEFAULT_FREQUENCY;
    priv->ampltitude = DEFAULT_AMPLITUDE;
    setup_wave (priv);

    visual_param_container_add_many (paramcontainer, params);

    param = visual_param_container_get (paramcontainer, "frequency");
    visual_param_entry_min_set_float (param, 0.0);
    visual_param_entry_max_set_float (param, 22000.0);

    param = visual_param_container_get (paramcontainer, "ampltitude");
    visual_param_entry_min_set_float (param, 0.0);
    visual_param_entry_max_set_float (param, 1.0);

    return 0;
}
示例#2
0
/**
 * Clones the source VisParamContainer into the destination VisParamContainer. When an entry with a certain name
 * already exists in the destination container, it will be overwritten with a new value.
 *
 * @param destcont A pointer to the VisParamContainer in which the VisParamEntry values are copied.
 * @param srccont A pointer to the VisParamContainer from which the VisParamEntry values are copied.
 *
 * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_CONTAINER_NULL, on failure.
 */
int visual_param_container_copy (VisParamContainer *destcont, VisParamContainer *srccont)
{
	VisListEntry *le = NULL;
	VisParamEntry *destparam;
	VisParamEntry *srcparam;
	VisParamEntry *tempparam;

	visual_log_return_val_if_fail (destcont != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL);
	visual_log_return_val_if_fail (srccont != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL);

	while ((srcparam = visual_list_next (&srccont->entries, &le)) != NULL) {
		tempparam = visual_param_container_get (destcont, visual_param_entry_get_name (srcparam));

		/* Already exists, overwrite */
		if (tempparam != NULL) {
			visual_param_entry_set_from_param (tempparam, srcparam);

			continue;
		}

		/* Does not yet exist, create a new entry */
		destparam = visual_param_entry_new (visual_param_entry_get_name (srcparam));
		visual_param_entry_set_from_param (destparam, srcparam);

		visual_param_container_add (destcont, destparam);
	}

	return VISUAL_OK;
}
示例#3
0
/**
 * generate a new config-string from current config
 */
void config_string_genstring(BlurskPrivate *priv) 
{
    char *string = paste_genstring();

    VisParamContainer *paramcontainer = visual_plugin_get_params(priv->plugin);
    
    VisParamEntry *param = visual_param_container_get(paramcontainer, "config_string");

    /* don't set if it has already been set */
    if(strcmp(string, visual_param_entry_get_string(param)) != 0)
        visual_param_entry_set_string(param, string);
    
    priv->update_config_string = 0;
}
示例#4
0
/**
 * Copies matching VisParamEntry elements from srccont into destcont, matching on the name.
 *
 * @param destcont A pointer to the VisParamContainer in which the VisParamEntry values are copied.
 * @param srccont A pointer to the VisParamContainer from which the VisParamEntry values are copied.
 *
 * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_CONTAINER_NULL, on failure.
 */
int visual_param_container_copy_match (VisParamContainer *destcont, VisParamContainer *srccont)
{
	VisListEntry *le = NULL;
	VisParamEntry *destparam;
	VisParamEntry *srcparam;

	visual_log_return_val_if_fail (destcont != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL);
	visual_log_return_val_if_fail (srccont != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL);

	while ((destparam = visual_list_next (&destcont->entries, &le)) != NULL) {
		srcparam = visual_param_container_get (srccont, visual_param_entry_get_name (destparam));

		if (srcparam != NULL)
			visual_param_entry_set_from_param (destparam, srcparam);
	}

	return VISUAL_OK;
}
示例#5
0
AVSContainer *avs_parse_main (AVSTree *avstree)
{
        AVSContainer *avsmain;
        AVSSerializeContainer *scont;
        VisParamContainer *pcont;

        static VisParamEntry params[] = {
                VISUAL_PARAM_LIST_ENTRY ("clearscreen"),
                VISUAL_PARAM_LIST_END
        };

        pcont = visual_param_container_new ();

        visual_param_container_add_many (pcont, params);

        avsmain = visual_mem_new0 (AVSContainer, 1);

        /* Do the VisObject initialization */
        visual_object_initialize (VISUAL_OBJECT (avsmain), TRUE, avs_container_dtor);

        AVS_ELEMENT (avsmain)->pcont = pcont;
        AVS_ELEMENT (avsmain)->type = AVS_ELEMENT_TYPE_MAIN;

        AVS_CONTAINER (avsmain)->members = visual_list_new (visual_object_collection_destroyer);

        scont = avs_serialize_container_new ();
        avs_serialize_container_add_byte (scont, visual_param_container_get (pcont, "clearscreen"));

        avs_element_connect_serialize_container (AVS_ELEMENT (avsmain), scont);

        avs_element_deserialize (AVS_ELEMENT (avsmain), avstree);

        avstree->main = avsmain;

        return avsmain;
}
示例#6
0
AVSElement *avs_parse_trans_movement (AVSTree *avstree)
{
        AVSElement *movement;
        int len = avstree->cur_section_length;
        int pos=0;

        int effect;
        int rectangular;
        int blend;
        int sourcemapped;
        int subpixel;
        int wrap;
        int REFFECT_MAX = 23;
        int effect_exp_ch;

        char buf[257];

        VisParamContainer *pcont;

        static VisParamEntry params[] = {
                VISUAL_PARAM_LIST_ENTRY_INTEGER ("effect", 0),
                VISUAL_PARAM_LIST_ENTRY_INTEGER ("rectangular", 0),
                VISUAL_PARAM_LIST_ENTRY_INTEGER ("blend", 0),
                VISUAL_PARAM_LIST_ENTRY_INTEGER ("sourcemapped", 0),
                VISUAL_PARAM_LIST_ENTRY_INTEGER ("subpixel", 0),
                VISUAL_PARAM_LIST_ENTRY_INTEGER ("wrap", 0),
                VISUAL_PARAM_LIST_ENTRY_STRING ("code", ""),
                VISUAL_PARAM_LIST_END
        };

        visual_mem_set (buf, 0, sizeof (buf));

        pcont = visual_param_container_new ();

        visual_param_container_add_many(pcont, params);

        movement = visual_mem_new0 (AVSElement, 1);

        /* Do the VisObject initialization */
        visual_object_initialize (VISUAL_OBJECT (movement), TRUE, avs_element_dtor);

        AVS_ELEMENT (movement)->pcont = pcont;
        AVS_ELEMENT (movement)->type = AVS_ELEMENT_TYPE_TRANS_MOVEMENT;

        /* Deserialize without using the container, too complex (borked) serialization */
        if (len - pos >= 4) {
                effect=AVS_SERIALIZE_GET_INT (avstree->cur);
                AVS_SERIALIZE_SKIP_INT (avstree->cur);
                pos += 4;
        }
        if (effect == 32767)
        {
                if (!memcmp(avstree->cur,"!rect ",6))
                {
                        AVS_SERIALIZE_SKIP_LENGTH (avstree->cur, 6);
                        rectangular=1;
                }
                if (AVS_SERIALIZE_GET_BYTE (avstree->cur) == 1)
                {
                        AVS_SERIALIZE_SKIP_BYTE (avstree->cur);
                        pos++;

                        int l=AVS_SERIALIZE_GET_INT(avstree->cur); AVS_SERIALIZE_SKIP_INT (avstree->cur); pos += 4;
                        if (l > 0 && len-pos >= l)
                        {
//                              effect_exp.resize(l);
                                memcpy(buf, avstree->cur, l);
                                buf[l] = 0;

//                              memcpy(effect_exp.get(), data+pos, l);
                                AVS_SERIALIZE_SKIP_LENGTH (avstree->cur, l);
                                pos+=l;
                        }
                        else
                        {
//                              effect_exp.resize(1);
//                              effect_exp.get()[0]=0;
                        }
                }
                else if (len-pos >= 256)
                {
                        int l = 256 - (rectangular ? 6 : 0);
                        memcpy(buf,avstree->cur,l);
                        buf[l]=0;
//                      effect_exp.assign(buf);
                        AVS_SERIALIZE_SKIP_LENGTH (avstree->cur, l);
                        pos+=l;
                        printf ("trans_movement buf %s\n", buf);
                }
        }
        if (len-pos >= 4) { blend=AVS_SERIALIZE_GET_INT(avstree->cur); AVS_SERIALIZE_SKIP_INT (avstree->cur);pos+=4; }
        if (len-pos >= 4) { sourcemapped=AVS_SERIALIZE_GET_INT(avstree->cur); AVS_SERIALIZE_SKIP_INT (avstree->cur);pos+=4; }
        if (len-pos >= 4) { rectangular=AVS_SERIALIZE_GET_INT(avstree->cur); AVS_SERIALIZE_SKIP_INT (avstree->cur);pos+=4; }
        if (len-pos >= 4) { subpixel=AVS_SERIALIZE_GET_INT(avstree->cur); AVS_SERIALIZE_SKIP_INT (avstree->cur);pos+=4; }
        else subpixel=0;
        if (len-pos >= 4) { wrap=AVS_SERIALIZE_GET_INT(avstree->cur); AVS_SERIALIZE_SKIP_INT (avstree->cur);pos+=4; }
        else wrap=0;
        if (!effect && len-pos >= 4)
        {
                effect=AVS_SERIALIZE_GET_INT(avstree->cur); AVS_SERIALIZE_SKIP_INT (avstree->cur);pos+=4;
        }

        if (effect != 32767 && (effect > REFFECT_MAX || effect < 0))
                effect=0;
        effect_exp_ch=1;

        visual_param_entry_set_integer (visual_param_container_get (pcont, "effect"), effect);
        visual_param_entry_set_integer (visual_param_container_get (pcont, "rectangular"), rectangular);
        visual_param_entry_set_integer (visual_param_container_get (pcont, "blend"), blend);
        visual_param_entry_set_integer (visual_param_container_get (pcont, "sourcemapped"), sourcemapped);
        visual_param_entry_set_integer (visual_param_container_get (pcont, "subpixel"), subpixel);
        visual_param_entry_set_integer (visual_param_container_get (pcont, "wrap"), wrap);
        visual_param_entry_set_string (visual_param_container_get (pcont, "code"), buf);

        printf ("effect: %d, rectangular: %d, blend %d, sourcemapped %d, subpixel %d, wrap %d\n",
                        effect, rectangular, blend, sourcemapped, subpixel, wrap);

        return movement;
}
示例#7
0
static VisUIWidget *make_userinterface ()
{
	VisUIWidget *vbox;
	VisUIWidget *hbox1;
	VisUIWidget *hbox2;
	VisUIWidget *hbox3;
	VisUIWidget *label1;
	VisUIWidget *label2;
	VisUIWidget *label3;
	VisUIWidget *label4;
	VisUIWidget *checkbox1;
	VisUIWidget *checkbox2;
	VisUIWidget *numeric1;
	VisUIWidget *numeric2;
	VisUIWidget *numeric3;

	vbox = visual_ui_box_new (VISUAL_ORIENT_TYPE_VERTICAL);
	hbox1 = visual_ui_box_new (VISUAL_ORIENT_TYPE_HORIZONTAL);
	hbox2 = visual_ui_box_new (VISUAL_ORIENT_TYPE_HORIZONTAL);
	hbox3 = visual_ui_box_new (VISUAL_ORIENT_TYPE_HORIZONTAL);

	label1 = visual_ui_label_new (_("Show info for"), FALSE);
	label2 = visual_ui_label_new (_("seconds"), FALSE);
	label3 = visual_ui_label_new (_("cover art width"), FALSE);
	label4 = visual_ui_label_new (_("cover art height"), FALSE);

	checkbox1 = visual_ui_checkbox_new (_("Show song information"), TRUE);
	visual_ui_mutator_set_param (VISUAL_UI_MUTATOR (checkbox1),
			visual_param_container_get (__lv_paramcontainer, "songinfo show"));

	checkbox2 = visual_ui_checkbox_new (_("Show song information in plugins"), TRUE);
	visual_ui_mutator_set_param (VISUAL_UI_MUTATOR (checkbox2),
			visual_param_container_get (__lv_paramcontainer, "songinfo in plugin"));

	numeric1 = visual_ui_numeric_new ();
	visual_ui_mutator_set_param (VISUAL_UI_MUTATOR (numeric1),
			visual_param_container_get (__lv_paramcontainer, "songinfo timeout"));
	visual_ui_range_set_properties (VISUAL_UI_RANGE (numeric1), 1, 60, 1, 0);

	numeric2 = visual_ui_numeric_new ();
	visual_ui_mutator_set_param (VISUAL_UI_MUTATOR (numeric2),
			visual_param_container_get (__lv_paramcontainer, "songinfo cover size x"));
	visual_ui_range_set_properties (VISUAL_UI_RANGE (numeric2), 32, 256, 2, 0);

	numeric3 = visual_ui_numeric_new ();
	visual_ui_mutator_set_param (VISUAL_UI_MUTATOR (numeric3),
			visual_param_container_get (__lv_paramcontainer, "songinfo cover size y"));
	visual_ui_range_set_properties (VISUAL_UI_RANGE (numeric3), 32, 256, 2, 0);

	visual_ui_box_pack (VISUAL_UI_BOX (hbox1), label1);
	visual_ui_box_pack (VISUAL_UI_BOX (hbox1), numeric1);
	visual_ui_box_pack (VISUAL_UI_BOX (hbox1), label2);

	visual_ui_box_pack (VISUAL_UI_BOX (hbox2), label3);
	visual_ui_box_pack (VISUAL_UI_BOX (hbox2), numeric2);

	visual_ui_box_pack (VISUAL_UI_BOX (hbox3), label4);
	visual_ui_box_pack (VISUAL_UI_BOX (hbox3), numeric3);

	visual_ui_box_pack (VISUAL_UI_BOX (vbox), checkbox1);
	visual_ui_box_pack (VISUAL_UI_BOX (vbox), checkbox2);
	visual_ui_box_pack (VISUAL_UI_BOX (vbox), hbox1);
	visual_ui_box_pack (VISUAL_UI_BOX (vbox), hbox2);
	visual_ui_box_pack (VISUAL_UI_BOX (vbox), hbox3);

	return vbox;
}
示例#8
0
/**
 * reflect the new values.
 */
static void _config_load_preset(BlurskPrivate *priv, BlurskConfig *conf)
{
    struct
    {
        char *name;
        int type;
        void *val;
    }entries[] =
    {
        {"color", VISUAL_PARAM_ENTRY_TYPE_COLOR, &conf->color},
        {"color_style", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->color_style},
        {"fade_speed", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->fade_speed},
        {"signal_color", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->signal_color},
        {"contour_lines", VISUAL_PARAM_ENTRY_TYPE_INTEGER, &conf->contour_lines},
        {"hue_on_beats", VISUAL_PARAM_ENTRY_TYPE_INTEGER, &conf->hue_on_beats},
        {"background", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->background},
        {"blur_style", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->blur_style},
        {"transition_speed", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->transition_speed},
        {"blur_when", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->blur_when},
        {"blur_stencil", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->blur_stencil},
        {"slow_motion", VISUAL_PARAM_ENTRY_TYPE_INTEGER, &conf->slow_motion},
        {"signal_style", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->signal_style},
        {"plot_style", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->plot_style},
        {"thick_on_beats", VISUAL_PARAM_ENTRY_TYPE_INTEGER, &conf->thick_on_beats},
        {"flash_style", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->flash_style},
        {"overall_effect", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->overall_effect},
        {"floaters", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->floaters},
    };
    
    
    
    int i;
        
    for(i = 0; i < QTY(entries); i++)
    {
        VisParamContainer *paramcontainer = visual_plugin_get_params(priv->plugin);
        VisParamEntry *ptmp = visual_param_container_get(paramcontainer, entries[i].name);
        
        switch(entries[i].type)
        {
            case VISUAL_PARAM_ENTRY_TYPE_INTEGER:
            {
                int *integer = entries[i].val;
                
                /* only update if values differ */
                if(*integer != visual_param_entry_get_integer(ptmp))
                    visual_param_entry_set_integer(ptmp, *integer);
                break;
            }
            
            
            case VISUAL_PARAM_ENTRY_TYPE_COLOR:
            {
                VisColor *color = visual_param_entry_get_color(ptmp);
                VisColor ncolor;
                uint32_t nicolor = (((color->b)<<16) + ((color->g)<<8) + color->r);
                uint32_t *icolor = entries[i].val;
            
                /* only update if values differ */
                if(*icolor != nicolor)
                {
                    visual_color_set(&ncolor, (*icolor&0xFF0000)>>16, (*icolor&0xFF00)>>8, (*icolor&0xFF));
                    visual_param_entry_set_color_by_color(ptmp, &ncolor);
                }
                break;
            }
            
            
            case VISUAL_PARAM_ENTRY_TYPE_STRING:
            {
                char **string = entries[i].val;
            
                /* only update if values differ */
                if(strcmp(*string, visual_param_entry_get_string(ptmp)) != 0)
                    visual_param_entry_set_string(ptmp, *string);
                break;
            }
        }
    }