static int act_jakdaw_events (VisPluginData *plugin, VisEventQueue *events)
{
	JakdawPrivate *priv = visual_object_get_private (VISUAL_OBJECT (plugin));
	VisEvent ev;
	VisParamEntry *param;

	while (visual_event_queue_poll (events, &ev)) {
		switch (ev.type) {
			case VISUAL_EVENT_RESIZE:
				act_jakdaw_resize (plugin, ev.event.resize.width, ev.event.resize.height);
				break;

			case VISUAL_EVENT_PARAM:
				param = ev.event.param.param;

				visual_log (VISUAL_LOG_DEBUG, "Param changed: %s", param->name);

				if (visual_param_entry_is (param, "zoom mode")) {
					visual_log (VISUAL_LOG_DEBUG, "New value for the zoom mode param: %d",
							param->numeric.integer);

					priv->zoom_mode = visual_param_entry_get_integer (param);

					_jakdaw_feedback_reset (priv, priv->xres, priv->yres);
				}
				else if (visual_param_entry_is (param, "plotter trigger")) {
					visual_log (VISUAL_LOG_DEBUG, "New value for the plotter trigger param: %d",
							param->numeric.integer);

					priv->plotter_colortype = visual_param_entry_get_integer (param);

				}
				else if (visual_param_entry_is (param, "plotter type")) {
					visual_log (VISUAL_LOG_DEBUG, "New value for the plotter type param: %d",
							param->numeric.integer);

					priv->plotter_scopetype = visual_param_entry_get_integer (param);

					_jakdaw_feedback_reset (priv, priv->xres, priv->yres);
				}

				break;

			default: /* to avoid warnings */
				break;
		}
	}

	return 0;
}
Example #2
0
/**
 * Copies the value of the src param into the param. Also sets the param to the type of which the
 * source param is.
 *
 * @param param Pointer to the VisParamEntry to which a parameter is set.
 * @param src Pointer to the VisParamEntry from which the value is retrieved.
 *
 * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL, -VISUAL_ERROR_PARAM_INVALID_TYPE on failure.
 */
int visual_param_entry_set_from_param (VisParamEntry *param, VisParamEntry *src)
{
	visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL);
	visual_log_return_val_if_fail (src != NULL, -VISUAL_ERROR_PARAM_NULL);

	switch (src->type) {
		case VISUAL_PARAM_ENTRY_TYPE_NULL:

			break;

		case VISUAL_PARAM_ENTRY_TYPE_STRING:
			visual_param_entry_set_string (param, visual_param_entry_get_string (src));
			break;

		case VISUAL_PARAM_ENTRY_TYPE_INTEGER:
			visual_param_entry_set_integer (param, visual_param_entry_get_integer (src));
			
			break;

		case VISUAL_PARAM_ENTRY_TYPE_FLOAT:
			visual_param_entry_set_float (param, visual_param_entry_get_float (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_DOUBLE:
			visual_param_entry_set_double (param, visual_param_entry_get_double (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_COLOR:
			visual_param_entry_set_color_by_color (param, visual_param_entry_get_color (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_PALETTE:
			visual_param_entry_set_palette (param, visual_param_entry_get_palette (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_OBJECT:
			visual_param_entry_set_object (param, visual_param_entry_get_object (src));

			break;
		
		default:
			visual_log (VISUAL_LOG_CRITICAL, _("param type is not valid"));

			return -VISUAL_ERROR_PARAM_INVALID_TYPE;

			break;
	}
	
	return VISUAL_OK;
}
static void show_options (AVSElement *element)
{
        return;
        VisParamEntry *param;
        VisHashmapChainEntry *mentry;
        VisCollectionIter *iter;

        if (element == NULL)
                return;

        printf ("Element options of element type: %d\n", element->type);

        iter = visual_collection_get_iter (VISUAL_COLLECTION (&element->pcont->entries));

        while (visual_collection_iter_has_more (iter)) {
            printf("Bleh\n");
                mentry = visual_collection_iter_get_data (iter);
                param = mentry->data;

                switch (param->type) {
                        case VISUAL_PARAM_ENTRY_TYPE_NULL:
                                printf ("\t%s: Type NULL\n",
                                                visual_param_entry_get_name (param));

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_STRING:
                                printf ("\t%s: Type STRING: %s\n",
                                                visual_param_entry_get_name (param),
                                                visual_param_entry_get_string (param));

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_INTEGER:
                                printf ("\t%s: Type INTEGER: %d\n",
                                                visual_param_entry_get_name (param),
                                                visual_param_entry_get_integer (param));

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_FLOAT:
                                printf ("\t%s: Type FLOAT: %f\n",
                                                visual_param_entry_get_name (param),
                                                visual_param_entry_get_float (param));

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_DOUBLE:
                                printf ("\t%s: Type DOUBLE: %f\n",
                                                visual_param_entry_get_name (param),
                                                visual_param_entry_get_double (param));

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_COLOR:
                                printf ("\t%s: Type COLOR: %d %d %d\n",
                                                visual_param_entry_get_name (param),
                                                param->color.r, param->color.g, param->color.b);

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_PALETTE:
                                {
                                        int i;

                                        printf ("\t%s: Type PALETTE:\n",
                                                        visual_param_entry_get_name (param));

                                        for (i = 0; i < param->pal.ncolors; i++) {
                                                printf ("\t\tcolor[%d] %d %d %d\n", i,
                                                                param->pal.colors[i].r,
                                                                param->pal.colors[i].g,
                                                                param->pal.colors[i].b);
                                        }
                                }
                                break;

            default:
                break;
                }
        }

        printf ("\n");
}
Example #4
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;
            }
        }
    }
char *avs_serialize_container_deserialize (AVSSerializeContainer *scont, char *section)
{
	AVSSerializeEntry *sentry;
	VisListEntry *le = NULL;

	while ((sentry = visual_list_next (&scont->layout, &le)) != NULL) {
		switch (sentry->type) {
			case AVS_SERIALIZE_ENTRY_TYPE_BYTE:
				if (sentry->param != NULL) {
					visual_param_entry_set_integer (sentry->param, AVS_SERIALIZE_GET_BYTE (section));

					if (visual_param_entry_get_integer (sentry->param) > sentry->boundry && sentry->boundry > 0) {
						visual_log (VISUAL_LOG_WARNING, "A serialized entry did hit the upper value boundry");

						visual_param_entry_set_integer (sentry->param, 0);
					}
				}

				AVS_SERIALIZE_SKIP_BYTE (section);

				break;

			case AVS_SERIALIZE_ENTRY_TYPE_BYTE_WITH_INT_SKIP:
				if (sentry->param != NULL) {
					visual_param_entry_set_integer (sentry->param, AVS_SERIALIZE_GET_BYTE (section));

					if (visual_param_entry_get_integer (sentry->param) > sentry->boundry && sentry->boundry > 0) {
						visual_log (VISUAL_LOG_WARNING, "A serialized entry did hit the upper value boundry");

						visual_param_entry_set_integer (sentry->param, 0);
					}
				}

				AVS_SERIALIZE_SKIP_INT (section);

				break;

			case AVS_SERIALIZE_ENTRY_TYPE_INT:
				if (sentry->param != NULL) {
					// use get_int here... instead of get_byte
					visual_param_entry_set_integer (sentry->param, AVS_SERIALIZE_GET_BYTE (section));

					if (visual_param_entry_get_integer (sentry->param) > sentry->boundry && sentry->boundry > 0) {
						visual_log (VISUAL_LOG_WARNING, "A serialized entry did hit the upper value boundry");

						visual_param_entry_set_integer (sentry->param, 0);
					}
				}

				AVS_SERIALIZE_SKIP_INT (section);

				break;

			case AVS_SERIALIZE_ENTRY_TYPE_STRING:

				section = avs_serialize_retrieve_string_from_preset_section (section, sentry->param);

				break;

			case AVS_SERIALIZE_ENTRY_TYPE_COLOR:

				section = avs_serialize_retrieve_color_from_preset_section (section, sentry->param);

				break;

			case AVS_SERIALIZE_ENTRY_TYPE_PALETTE:

				section = avs_serialize_retrieve_palette_from_preset_section (section, sentry->param);

				break;

			default:
				printf ("INVALID SERIALIZE TYPE, BAILING OUT VERY HARDLY\n");
				return NULL;

				break;

		}

	}

	return section;
}