Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Custom bitmaps missing
No permission to create posts
March 9, 2016
11:52 pm
Avatar
Derek
Member
Members
Forum Posts: 41
Member Since:
November 19, 2015
sp_UserOfflineSmall Offline

Hi all,

I'm trying to add my own bitmaps (.pngs) to a project. I've added them into the project's resource folder, copied them into Visual Studio, add new entries in RackAFX.uidesc and the MyProject.rc file.

Using the GUI editor in RAFX the graphics show up and I can assign and use them as controls (knobs, switches, etc.)

However, when using the custom GUI VSTGUIController to load the bitmaps, they don't show up. Tracing through my code I see that if I use a built in RAFX bitmap (e.g. "greymetal.png") after calling getBitmap to get the CBitmap * everything is filled out including the pointer platformBitmap inside CBitmap.

When I load my own bitmaps, the getBitmap call returns a valid pointer but the platformBitmap is NULL. So it goes through all the steps to assign the bitmap to a view but it's never drawn on screen. Same thing trying to use the "knobvst.png" that is included in each project, it doesn't have a valid platformBitmap and doesn't draw.

I couldn't find a tutorial on this using the custom GUI, but maybe I'm missing an extra step somewhere?

Any ideas?

thanks,
Derek

March 10, 2016
1:18 am
Avatar
W Pirkle
Admin
Forum Posts: 140
Member Since:
January 28, 2017
sp_UserOnlineSmall Online

Hi Derek

A user did report this and I updated the CustomViewsFive project accordingly, however I did not release a patch for RackAFX, 1) because no one had started using this yet and 2) because VSTGUI has rev-ed to v4.3 and I am rebuilding RackAFX to use v4.3 instead, which changes a bunch of things. Bottom line is that I don't want to get into some kind of "intermediate state" with this.

The reason you don't see the imported graphics has to do with the fact that when you use your own custom GUI, there are multiple resource streams in your DLL (the resource streams contain the graphics files, among other things). The resource streams are identified by instance handles. To fix this (until v6.7 of RAFX is released), do the following:

In VSTGUIController.cpp at the top of the file, add the two lines below the #include:

#include "VSTGUIController.h"
extern void* hInstance; // Sock2VST3 LIB module handle
extern void* g_hModule; // DLL module handle

Swap out the old loadTiledBitmap( ) and loadBitmap( ) functions with these functions which check the instance handles - there's nothing else to do, and the instance handle values are set externally so you don't need to worry about setting or maintaing them:

CNinePartTiledBitmap* CVSTGUIController::loadTiledBitmap(const CResourceDescription& desc, CCoord left, CCoord top, CCoord right, CCoord bottom)
{

#if defined _WINDOWS || defined _WINDLL
// --- save
void* pInstance = hInstance;

HRSRC rsrc = FindResourceA((HMODULE)hInstance, desc.u.name, "PNG");
if (!rsrc)
hInstance = g_hModule;

CNinePartTiledBitmap* pBM = new CNinePartTiledBitmap(desc, (CNinePartTiledBitmap::PartOffsets(left, top, right, bottom)));

// --- restore
hInstance = pInstance;

return pBM;

#else

CNinePartTiledBitmap* pBM = new CNinePartTiledBitmap(desc, (CNinePartTiledBitmap::PartOffsets(left, top, right, bottom)));
return pBM;

#endif

}

CBitmap* CVSTGUIController::loadBitmap(const CResourceDescription& desc)
{
#if defined _WINDOWS || defined _WINDLL
// --- save
void* pInstance = hInstance;

// --- choose the proper resource stream
HRSRC rsrc = FindResourceA((HMODULE)hInstance, desc.u.name, "PNG");
if (!rsrc)
hInstance = g_hModule;

CBitmap* pBM = new CBitmap(desc);

// --- restore
hInstance = pInstance;

return pBM;

#else

CBitmap* pBM = new CBitmap(desc);
return pBM;

#endif
}

Let me know if you have any issues - this should fix your problem though.

- Will

March 10, 2016
1:34 am
Avatar
Derek
Member
Members
Forum Posts: 41
Member Since:
November 19, 2015
sp_UserOfflineSmall Offline

Thanks Will,

works great!

Looking forward to the new RAFX with the unlimited controls too.

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online: W Pirkle
3 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 47

Derek: 41

Peter: 41

clau_ste: 39

Frodson: 38

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

Jorge: 17

Member Stats:

Guest Posters: 1

Members: 478

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 29

Topics: 479

Posts: 1870

Newest Members:

certvalue111, sobhana s, sam, annaharris, Marie Weaver, kev, Steven, Mr Anderson, mguy, omelc

Moderators: W Pirkle: 140

Administrators: Tom: 65, JD Young: 80, Will Pirkle: 0, W Pirkle: 140