What is KVR Audio? | Submit News | Advertise | Developer Account

Options (Affects News & Product results only):

OS:
Format:
Include:
Quick Search KVR

"Quick Search" KVR Audio's Product Database, News Items, Developer Listings, Forum Topics and videos here. For advanced Product Database searching please use the full product search. For the forum you can use the phpBB forum search.

To utilize the power of Google you can use the integrated Google Site Search.

Products 0

Developers 0

News 0

Forum 0

Videos 0

Search  

Slow alpha blending with VSTGUI 3.6

DSP, Plug-in and Host development discussion.

Moderator: Moderators (Main)

roazhondsp
KVRist
 
39 posts since 13 Feb, 2014

Postby roazhondsp; Sun Mar 02, 2014 9:01 am Slow alpha blending with VSTGUI 3.6

Hello,

I have published my freeware VSTi few weeks ago and I have a problem with PNG knobs using alpha blending (I'm using VSTGUI 3.6). The knob drawing is very slow, and moving knobs continuously is cpu demanding. I've replaced the PNG by BMP, the problem has gone but there is no alpha blending. I have the same problem on Note Expression Synth sample from the SDK. Does anyone have met the same problem and managed to solve it?

Thanks,
kv331
KVRAF
 
4924 posts since 14 Nov, 2006, from Ankara, Turkey

Postby kv331; Sun Mar 02, 2014 9:18 am Re: Slow alpha blending with VSTGUI 3.6

If there is no scaling of images involved when drawing, please use GDI not GDI+. That will fix the performance issues :)

Bülent
roazhondsp
KVRist
 
39 posts since 13 Feb, 2014

Postby roazhondsp; Mon Mar 03, 2014 1:42 am Re: Slow alpha blending with VSTGUI 3.6

Thanks for the tip ;) I've tried to replace GDI+ by GDI by doing the following steps:
- start from the last VSTSDK revision and work on the again sample project
- set GDIPLUS=0
- set VSTGUI_USES_UTF8=0 to get rid of wchar / char issues since it sets UNICODE=0
- in vstcontrols.cpp, cast from void* to HBITMAP the CBitmap handle for the MENUITEMINFO hbmpItem (line 3168)

Now it compiles fine but it looks like the PNG/BMP are not displayed. Am I doing something wrong ?

I see you suggested another way to do this in that topic : viewtopic.php?t=353908&view=previous . Should I do that way ?

Thanks,

Olivier.
kv331
KVRAF
 
4924 posts since 14 Nov, 2006, from Ankara, Turkey

Postby kv331; Tue Mar 04, 2014 5:01 am Re: Slow alpha blending with VSTGUI 3.6

Not that's not what I meant.

Just replace the code that draws images (so they draw with GDI when there is NO scaling involved)
roazhondsp
KVRist
 
39 posts since 13 Feb, 2014

Postby roazhondsp; Tue Mar 04, 2014 6:59 am Re: Slow alpha blending with VSTGUI 3.6

Thanks! Works really good now :D
roazhondsp
KVRist
 
39 posts since 13 Feb, 2014

Postby roazhondsp; Wed Mar 12, 2014 6:11 am Re: Slow alpha blending with VSTGUI 3.6

I just tested that change on Win XP and I can't manage to display a picture. It works perfectly on Win 7. Is there something tricky with HBITMAP / GDI drawing on Win XP ?

Thanks,
mystran
KVRAF
 
4155 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Wed Mar 12, 2014 6:53 am Re: Slow alpha blending with VSTGUI 3.6

roazhondsp wrote:I just tested that change on Win XP and I can't manage to display a picture. It works perfectly on Win 7. Is there something tricky with HBITMAP / GDI drawing on Win XP ?


No.. not really, unless you use GDI AlphaBlend(), which if I recall is basically just broken (as in MSDN example code doesn't work) on x64 Windows (at least XP and Vista, can't remember if I ever tested on Win7) at least for 32-bit software. On 32-bit XP everything should work though.
Image <- plugins | forum
roazhondsp
KVRist
 
39 posts since 13 Feb, 2014

Postby roazhondsp; Thu Mar 13, 2014 7:20 am Re: Slow alpha blending with VSTGUI 3.6

Thanks for the info, I then found that something was wrong in my changes. I've tested my synth on XP, Vista, 7, 8 and it works fine for 32 and 64 bits OS versions ;) On XP 64 the knobs are sometimes flickering while moving, but I was trying on a VM with SP2.
mystran
KVRAF
 
4155 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Thu Mar 13, 2014 8:28 am Re: Slow alpha blending with VSTGUI 3.6

roazhondsp wrote:Thanks for the info, I then found that something was wrong in my changes. I've tested my synth on XP, Vista, 7, 8 and it works fine for 32 and 64 bits OS versions ;) On XP 64 the knobs are sometimes flickering while moving, but I was trying on a VM with SP2.


Normally Windows will clear the window are to be repainted. Since there's no double buffering, this can lead to flickering. To avoid the automatic clears, either set the window class hbrBackground to NULL, or intercept WM_ERASEBKGND message and return non-zero (by default it goes to DefWindowProc that does the clear). This might or might not already be the case with VSTGUI, but it's easy to double check.

Then you might want to do the painting into a DIBSection (or something) and copy the whole repaint area to screen with a single BitBLT [obviously only an issue if you do multipass drawing, say copy the knob image on top of a separate background, or something], so you never have to clear the visible window. Otherwise the system could end up drawing the partially completed redraw and you would again get flickering.
Image <- plugins | forum
roazhondsp
KVRist
 
39 posts since 13 Feb, 2014

Postby roazhondsp; Sat Mar 15, 2014 12:32 am Re: Slow alpha blending with VSTGUI 3.6

Interesting inputs ;) VSTGUI seems to have the settings to avoid automatic clears. But indeed having double buffering, drawing to back buffer and updating front buffer partially seems to be the best path.

Moderator: Moderators (Main)

Return to DSP and Plug-in Development