Vertical Feedback Bar Graz Visualisation

Making & changing box plugins and external apps
Post Reply
csimon
Posts: 2
Joined: Tue Mar 02, 2021 8:49 am

Vertical Feedback Bar Graz Visualisation

Post by csimon »

Hello,

I am implementing a version of the Graz Visualisation box with Vertical Feedback bars. However, I am struggling to with the draw function.
I have located the graphical elements:

Code: Select all

	gint w       = gint(fabs(width * fabs(usedScale) / 2));
	w            = (w > (width / 2)) ? (width / 2) : w;
	gint x       = width / 2;
	const gint h = height / 6;
	const gint y = (height / 2) - (h / 2);

	if (m_BarScale < 0)
	{
	x -= w;
	gdk_pixbuf_render_to_drawable(m_LeftBar, m_DrawingArea->window, nullptr, gdk_pixbuf_get_width(m_LeftBar) - w, 0, x, y, w, h, GDK_RGB_DITHER_NONE, 0, 0);
	}
	else
	{
	gdk_pixbuf_render_to_drawable(m_RightBar, m_DrawingArea->window, nullptr, 0, 0, x, y, w, h, GDK_RGB_DITHER_NONE, 0, 0);
	}
Changing the variables w, h, x and y results in incomplete build later on. Therefore, I have not changed the variable names, but instead defined height as width and width as height. This should correctly change the data for vertical feedback display. As a result however, x, y, w, and h need to be switched wenn gdk_pixbuf_render_to_drawable is called, as x is now the y coordinate etc.

My solution looks like this:

Code: Select all

	if (m_BarScale < 0)
	{
		x -= w;
		gdk_pixbuf_render_to_drawable(m_LeftBar, m_DrawingArea->window, nullptr, 0, gdk_pixbuf_get_height(m_LeftBar) - w, y, x, h, w, GDK_RGB_DITHER_NONE, 0, 0);
	}
	else
	{
		gdk_pixbuf_render_to_drawable(m_RightBar, m_DrawingArea->window, nullptr, 0, 0, y, x, h, w, GDK_RGB_DITHER_NONE, 0, 0);
	}
Notice I have also switched the source-inputs from "gdk_pixbuf_get_width(m_LeftBar) - w, 0" to "0, gdk_pixbuf_get_height(m_LeftBar) - w". Again switching the height for the width input.

Unfortunately, built and tested in Openvibe this leads to the following error message in the console:

Code: Select all

(openvibe-designer.exe.22928) Gdk-CRITICAL **: gdk_drawable_real-draw_pixbuf: assertion 'src_y >= 0 && src_y + height <= gdk_pixbuf_get_height (pixbuf)' failed
So about 70% of the frames are not drawn. However, the 30% that get drawn do seem correct. Unfortunately I have no idea what this error means and how to fix it. I'd be happy about any help.

Thanks.

Best,
Colin

Thibaut
Posts: 264
Joined: Wed Oct 31, 2018 9:14 am

Re: Vertical Feedback Bar Graz Visualisation

Post by Thibaut »

HI,
I haven't reed your complete message but since OpenViBE 3.0.0. I have added a box multimodal graz (a display with vertical bar and N class not fixed by 2). Maybe you can use it or you can see the code of this for your formula.
Thibaut

Post Reply