GUI Perf issue

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

i have new informations but it's weird.

i tried to pinpoint the right moment where the CPU is at its highest.

I finally centered around the draw function of the big knobs.

first i used the code from Steinberg, but then i made my own as i thought it was faster.

here is Steinberg drawing code :

Code: Select all

void CDispLinearKnob::draw (CDrawContext *pContext)
{
	CPoint where (0, 0);
	if (value >= 0.f) 
	{
		CCoord tmp = heightOfOneImage * (subPixmaps - 1);
		
		where_.v = (CCoord)(value * (float)tmp);

		for (CCoord realY = 0; realY <= tmp; realY += heightOfOneImage) 
		{
			if (where.v < realY) 
			{
				where.v = realY - heightOfOneImage;
				if (where.v < 0)
					where.v = 0;
				break;
			}
		}
	}

	if (pBackground)
	{
		if (bTransparencyEnabled)
			pBackground->drawTransparent (pContext, size, where_);
		else
			pBackground->draw (pContext, size, where_);
	}
	

	valueToPoint (lastDrawnPoint);
	setDirty (false);
}
and here is mine :

Code: Select all

void CDispLinearKnob::draw (CDrawContext *pContext)
{
	CPoint where (0, 0);
	
	where.v = int(value * (subPixmaps -1)) *heightOfOneImage;

	if (pBackground)
	{
		if (bTransparencyEnabled)
			pBackground->drawTransparent (pContext, size, where);
		else
			pBackground->draw (pContext, size, where);
	}
	
	valueToPoint (lastDrawnPoint);
	setDirty (false);
}
the very disturbing thing is that if i change all the knobs and put them to their maximum, the CPU use is 100%, but if i put them to 0, the cpu use drops to normal.

this i so weird, has anyone an answer to this ?...

thanks

EDIT : as i said earlier, i use 4 big animKnobs (86x86) and 3 little ones (53x53) for this plugin

Post

hi

so i continued my exploration of the vst system and i started a fresh project with only VST base objects. I created 4 animknobs and i have the same issue as before, when i set the knobs to the maximum i have 100% cpu, if not i have a drop in the cpu.

it seems to be a VST issue not on my side.

does using an array with bitmaps of all the knobs would be better for performance that using one big bitmap an seeking though it?

Jeff

Post

Are these animKnobs connected to any parameter?
"Until you spread your wings, you'll have no idea how far you can walk." Image

Post

arakula wrote:Are these animKnobs connected to any parameter?
no they are not they are just VSTGUI-sided CControls.

thanks for your help

Post

so i tried with an array of CBitmaps (CBitmap* img = new CBitmap[91]) and i have 0% CPU!! yeah! so that's from Steinberg's side, or am i not using the controls properly ? anyway it works now.

the only issue is that i have to declare each image of the animknob with one line each in the resource folder. so it's a lot of work for nothing

Does anyone knows a way to divide one big image with all the subimages of the animknob into n CBitmaps automatically ? i don't know how to do that.

thanks for your help

Jeff

Post

While I'm pretty sure that this is not the real problem -

To create single images from a combined one, ImageMagick can do that, with a command line like

Code: Select all

convert combined.png -crop 1x91@ +repage +adjoin -alpha set single_%d.png
it should convert a single image named combined.png, which holds 91 vertical subpictures, into 91 single .png files with numerically ascending file names, keeping the alphalevel intact.

[Edit:] hmm, on second reading, I think that this is precisely the opposite of what you want...
"Until you spread your wings, you'll have no idea how far you can walk." Image

Post

arakula wrote:While I'm pretty sure that this is not the real problem -

To create single images from a combined one, ImageMagick can do that, with a command line like

Code: Select all

convert combined.png -crop 1x91@ +repage +adjoin -alpha set single_%d.png
it should convert a single image named combined.png, which holds 91 vertical subpictures, into 91 single .png files with numerically ascending file names, keeping the alphalevel intact.

[Edit:] hmm, on second reading, I think that this is precisely the opposite of what you want...
haha

what i want is to separate a big image into several smaller images within Visual Studio, so that i don't have to write 91 lines of codes in the resource file.

thanks

Post

please a little bit of help would be nice

as a reminder, i'd like to cut one big image into several smaller, how do i do that ?

thanks

Post Reply

Return to “DSP and Plugin Development”