Ingreso rápido:  

Forum: VirtualDJ Plugins

Tema: Compiling a new VDJ C++ project in MS Visual Studio - Page: 2

Este tópico es antiguo y puede contener información incorrecta para la nueva versión.

Thx I got it debugging now. I was just tired late last night and forgot to click the + to show the plugin interface so like you said that is why it didn't reach my breakpoint.

Anyhow this is what it looks like



but maybe I'm just reading this part of the code wrong:

HRESULT VDJ_API CMyPlugin8::OnGetUserInterface(TVdjPluginInterface8 *pluginInterface)
{

pluginInterface->Type = VDJINTERFACE_SKIN;

// this following code is just an example and needs to be adapted to your project.
TRESOURCEREF rcXML;
TRESOURCEREF rcPNG;

#if (defined(VDJ_WIN))
rcXML.id = IDR_SKINXML; // as defined in resource.h
rcPNG.id = IDR_SKINPNG; // as defined in resource.h
rcXML.type = "XML";
rcPNG.type = "PNG";
#elif (defined(VDJ_MAC))
rcXML.name = "FX_GUI.xml";
rcPNG.name = "FX_GUI.png";
#endif

DWORD xmlsize=0;
void* xmldata=NULL;
LoadFileFromResource( rcXML, xmlsize, xmldata);
pluginInterface->Xml = static_cast<char*>(xmldata);

DWORD pngsize=0;
void* pngdata=NULL;
LoadFileFromResource( rcPNG, pngsize,pngdata);
pluginInterface->ImageBuffer = pngdata;
pluginInterface->ImageSize = pngsize;

return S_OK;


Now where does it show it changing the style of the knob or anything else. I see the PNG and XML file loaded as a resource but no direction as to what happens after the 2 files are loaded.

Is that part of the code missing? Let's say I just want to change the knob style or font style?
 

Mensajes Tue 28 Feb 17 @ 12:52 am
SBDJPRO Infinity Member since 2006
Where exactly did you set your breakpoint?

Probably worth posting up the code for the entire project so we can see what else is going on. If your plugin class overrides the OnGetUserInterface method correctly then it will be called by VDJ when appropriate.
 

Mensajes Tue 28 Feb 17 @ 1:11 pm
So the code I used is exactly posted in http://www.virtualdj.com/wiki/Plugins_SDKv8_Example4.html if you would like the whole project zipped up with the above files with no extra changes besides just setting both ID's in the rc section IDR_SKINPNG and IDR_SKINXML :
https://dl.dropboxusercontent.com/u/7907335/PluginGUI.zip

It compiles and activates the built-in GUI display but nothing from the PNG file shows up. The knob in the example doesn't look anything like the knobs in the PNG.

I set three breakpoints inside

two inside OnGetUserInterface
where LoadFileFromResource was called



the third was inside LoadFileFromResource
on the calling of LoadResource


Probably the biggest question right now is:
Is VDJ supposed to just load up the top portion of the PNG file provided in the example as the GUI for the plugin
or
is the .PNG file (and .XML file) a reference file that isn't actually used in the example project and we have to write and add code more code (if so what code) to just make a simple change to that one provided knob.
Like so (notice the heading on top and the little white line markers around the knob)

Provided in automix virtualdj plugin example FX_GUI.png file
 

Mensajes Tue 28 Feb 17 @ 3:11 pm
SBDJPRO Infinity Member since 2006
nassausky wrote :
Is VDJ supposed to just load up the top portion of the PNG file provided in the example as the GUI for the plugin


VDJ doesn't load the PNG file at all. That is what you are doing in your plugin - you load the file and then pass the data from that file to VDJ.

Unfortunately I'm currently stuck in hospital and only have a Mac with me. I test compiled your project and it worked fine, including the GUI, so I suspect it's something related to the resources. A quick look at the RC file shows that you added your XML file with the type HTML:

IDR_SKINXML             HTML                    "FX_GUI.xml"


but it's still specified as XML in your VDJ plugin source:

rcXML.type = "XML";


This means your XML file would fail to load and thus VDJ would fall back to the inbuilt plugin GUI.

I suspect your breakpoints aren't being triggered hence you not thinking that code has been executed.
 

Mensajes Tue 28 Feb 17 @ 3:54 pm
Oh I'm sorry, I hope you get better fast. Nobody likes being in a hospital even if it's something not major.


SBDJ wrote :
nassausky wrote :
A quick look at the RC file shows that you added your XML file with the type HTML:

IDR_SKINXML             HTML                    "FX_GUI.xml"


but it's still specified as XML in your VDJ plugin source:

rcXML.type = "XML";


This means your XML file would fail to load and thus VDJ would fall back to the inbuilt plugin GUI.


I know time is always precious. When you feel better and get a moment can you give me an idea of what I should have put in the VDJ plugin source instead of
[quote]rcXML.type = "XML";



Thanks, feel better.
 

Mensajes Tue 28 Feb 17 @ 4:50 pm
SBDJPRO Infinity Member since 2006
Sadly it's not me, my son had both femurs cut, shut and plated yesterday (femoral osteotomy).

Change

rcXML.type = "XML";


to

rcXML.type = "HTML";


as thats the type you specified when you imported the XML file as a resource.

Alternatively open the .rc file and change the type in there from HTML to XML. Basically they need to match :)
 

Mensajes Tue 28 Feb 17 @ 8:45 pm
Great the website is up again!

@SBDJ THANKSSSSSSSSSSSSS

Got it. So much came together with that comment. First and foremost important is I would paste this rc file with the example to make life so much easier.

Here lies the problem.
First my experience with Visual Studio. I haven't used VS in years since it got so bloated and never had a real need to compile C++ for years. So I know so many programming languages without expertise in one. Something like a jack of all trades.
So when I had a problem with figuring out how to get the rc working in CODE::BLOCKS my other option was to install, Microsoft made Studio. Version 2015 was being pushed to the user as the main IDE available. Can't believe how bloated it is and then I was informed 2017 is not resource intensive and modular so I tried that out which was Release Candidate 1 and it's so very much smaller with ability to just install the core C++ modules without everything else. Turns out it crashes a bit and I went back to VS 2015 stable community.

Second my experience with resource files. Haven't worked with them for a long time so when the example code was all loaded into the project, using VS gui, I added the .png resource easily which had an option for importing a bitmap and then I 'attempted' to add the .xml which there wasn't a simple option to do so.

{Website still isn't working right. It had a problem attaching images. I tried attaching a small png then jpg image of the resource picker in VS2015}
I first tried HTML but that didn't work. Then I tried custom but that required creating a new file all together and wasn't sure how to do so. Don't know what else I tried with that but I didn't realize in the solution explorer in VS you can right click on the .rc file and find that hidden option to view code and then manually type in XML directly into the code. I guess I could have done that in a text editor too but thought the .rc setup was only IDE GUI based

Anyhow as you can see below all it required was to adjust the line:
IDR_SKINXML             XML                    "FX_GUI.xml"

since everything else in the file was good


Here is the final myplugin.rc file

// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource.h\0"
END

2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END

3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END

#endif // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// PNG
//

IDR_SKINPNG PNG "FX_GUI.png"


/////////////////////////////////////////////////////////////////////////////
//
// XML
//

IDR_SKINXML XML "FX_GUI.xml"

#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED





Now after that compiled I looked at the XML file carefully and I can see exactly how it works. The full fancy GUI loads up great. Each xml component loads up grabbing it's perspective item from the png file using x,y coordinates with certain items accepting actions to events.

Yay!!!

Funny thing is that I think this answered another question I had earlier that nobody replied to:
Determine deck effect was activated on.
which is get_deck that I brushed over while looking at VDJ commands. I never thought it actually returned the deck the effect was activated on. I thought that just displayed the deck that was playing but my first test works. I noticed this after looking at the the XML file in for the sample plugin has a similar feature.

 

Mensajes Tue 28 Feb 17 @ 9:09 pm
lincol2PRO InfinityMember since 2011
SBDJ wrote :
my son had both femurs cut, shut and plated yesterday (femoral osteotomy)


Wishing him God speed recovery.

 

Mensajes Wed 01 Mar 17 @ 12:17 am
@SBDJ Oh man I'm sorry I missed your message about your son. Definitely wish for a speedy recovery for him and strength for the family.
 

Mensajes Wed 01 Mar 17 @ 10:33 pm


(Los tópicos y foros antiguos son automáticamente cerrados)