Variable/function to obtain the version of current plugin?

Hello,

Is it an easy way to get - as std::string or char[] - the (current) plugin version? I’ll “need” it to display the version of the plugin during module reset (“fake” screen during module reset - displayed for 1 second).

image

Of course, I don’t want the hardcoded version number in C+ module’s source, despite it’s the most easy way, for the lazy guys lol. However, it’s always possible to open (as text) the plugin.json file, then doing strings analysis, but it’s not user friendly and not elegant.

Above I’ve wrote I’ll “need”, but be sure it’s not vital, however! :slight_smile:

Maybe an external variable (or function) is existing?

Thanks in advance.

see VCV Rack API: rack::plugin::Plugin Struct Reference

3 Likes

Doesn’t help! In fact it’s not a help, it is just “figure out” style reply, aren’t? :roll_eyes:

It will better if you’ve replied…

std::string pluginVer = pluginInstance->version;

…or something similar - yep, I’ve found it - by chance - but elsewhere (GitHub source, another developer).

Using the VCV Rack API reference is just a nightmare as long as it doesn’t have some usages / examples.

I’m sorry, I assume that coders can read and use the API-documentation because this is the coder’s bread’n’butter. At the beginning it might look like a nightmare, but it will answer most of your questions.

3 Likes

If the API-documentation doesn’t give me the answer I’m searching for, I usually jump into the VCV source code provided at github.

3 Likes

Thanks, and don’t worries!

Be sure before asked, I’ve searched a lot on the forum.

Now it’s implemented (but it was not absolute necessary), is only a “fake screen” (for 1 second) :rofl: :

The module during reset (Ctrl + I), a kind of “self-test”…

image

and source (in widget section):

			case PAGE_ON_RESET:
				nvgFontSize(args.vg, 26);
				nvgFontFaceId(args.vg, fontAbel->handle);
				nvgTextLetterSpacing(args.vg, 0);
				nvgFillColor(args.vg, nvgTransRGBA(fgWhite, bypassMask));
				_tmpStr = "KlokSpid Mark II";
				strcpy(_tmpChar, _tmpStr.c_str());
				nvgText(args.vg, (151.5f - pxAbel26Size(_tmpStr)) / 2.f, 102.f, _tmpChar, NULL);
				_tmpStr = "Firmware v" + pluginInstance->version;
				strcpy(_tmpChar, _tmpStr.c_str());
				nvgFontSize(args.vg, 19);
				nvgText(args.vg, (151.5f - pxAbel19Size(_tmpStr)) / 2.f, 122.f, _tmpChar, NULL); // Version of plugin.

Hope this may help other coders here! :wink:

1 Like