Connexion rapide:  

Forum: VirtualDJ Plugins

Sujet How to load a created plugin?

Ce topic est ancien et peut contenir des informations obselètes ou incorrectes.

alou83Home userMember since 2013
Hey all,

I am a newbie here. I just managed to create and compile a basic plugin in a form of dll. My problem is how to load it on the actual software (Virtual DJ) in order to test whether or not it works.

Many thanks,
Alou
 

Posté Fri 06 Sep 13 @ 1:54 pm
/users/username/my documents/virtualdj/plugins

pick which type of plugin fron those folder displayed.
 

Posté Fri 06 Sep 13 @ 2:55 pm
alou83Home userMember since 2013
Hi,
Thanks for the help. I ve tried to put the DLL in the all those folders but seems like it is not working. A text file is supposed to be created when I load a track, if I understood right. Here is my class. It s quite simple, just for testing:

#include "vdjPlugin.h"
#include <stdio.h>

class PluginTest : public IVdjPlugin
{
public:
HRESULT __stdcall OnLoad();

};


HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
*ppObject=new PluginTest();
return NO_ERROR;
}

HRESULT __stdcall PluginTest::OnLoad()
{
FILE * pFile;

pFile = fopen ("C:\\test.txt","a");
if (pFile!=NULL)
{
fputs ("Blablabla\n",pFile);
fclose (pFile);
}

return S_OK;
}

Thanks again
 

Posté Sat 07 Sep 13 @ 9:38 am
SBDJPRO Infinity Member since 2006
A couple of things:

* VDJ Pro Full is required for use of the IVdjPlugin class rather than a subclass.
* These types of plugin go into Plugins\Other and show up under Effects > Others in VDJ.
* Your OLE COM entry point (DllGetClassObject) does not check the CLSID or IID.
* You need to implement the Release method to clean up after the memory allocation you made in DllGetClassObject.
* You really should implement OnGetPluginInfo to provide information about your plugin to VDJ.

Something more like this would be a minimum IMHO:

#include "vdjPlugin.h"

class PluginTest : public IVdjPlugin
{
public:
HRESULT __stdcall OnLoad();
HRESULT __stdcall OnGetPluginInfo(TVdjPluginInfo *infos);
ULONG __stdcall Release();
};


HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
if (memcmp(&rclsid,&CLSID_VdjPlugin6,sizeof(GUID))==0 && memcmp(&riid,&IID_IVdjPluginBasic,sizeof(GUID))==0)
*ppObject=new PluginTest();
else
return CLASS_E_CLASSNOTAVAILABLE;
return NO_ERROR;
}

HRESULT __stdcall PluginTest::OnGetPluginInfo(TVdjPluginInfo *infos)
{
infos->Author=(char*)"alou83";
infos->PluginName=(char*)"PluginTest";
infos->Description=(char*)"Test Plugin";
infos->Flag=0x00;
return S_OK;
}

HRESULT __stdcall PluginTest::OnLoad()
{
return S_OK;
}

ULONG __stdcall PluginTest::Release()
{
delete this;
}
 

Posté Sat 07 Sep 13 @ 12:19 pm
alou83Home userMember since 2013
Many thanks for the correction and example.

If I understand well the use of any subclass of IVdjPlugin (e.g. IVdjPluginVideoFx ) from the SDK would work with the trial version? Could I just replace IVdjPlugin from my class with IVdjPluginVideoFx, or would I have to extend some other methods?

One other thing is that I am using DevCpp. I don t know if I am doing right or not but the projects compiles and I get the dll without error. I have a main dll file where I include my class and it looks like:

<code>

BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
return TRUE;
break;

case DLL_PROCESS_DETACH:
break;

case DLL_THREAD_ATTACH:
break;

case DLL_THREAD_DETACH:
break;
}

/* Returns TRUE on success, FALSE on failure */
return TRUE;
}

</code>

Thanks,
Alou

 

Posté Sat 07 Sep 13 @ 3:01 pm
SBDJPRO Infinity Member since 2006
Yup, change subclass, IID in entry point and implement any required methods.

Never had any success with GCC and windows VDJ due to name mangling issues.
 

Posté Sun 08 Sep 13 @ 6:01 am
alou83Home userMember since 2013
Still not working. The plugin infos are even not showing on VDJ. I think it is deployment problem as the dll compiles without trouble. Please if someone has managed to compile a plugin in Windows using DevCpp and Mingw, help!

So far this is my class. Many thanks


#include "vdjDsp.h"
#include <stdio.h>

class PluginTest : public IVdjPluginDsp
{
public:
HRESULT __stdcall OnLoad();
HRESULT __stdcall OnProcessSamples(short*, int, int);
HRESULT __stdcall OnGetPluginInfo(TVdjPluginInfo *infos);
HRESULT __stdcall OnStart(int, int);

};


HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
if (memcmp(&rclsid,&CLSID_VdjPlugin6,sizeof(GUID))==0 && memcmp(&riid,&IID_IVdjPluginDsp,sizeof(GUID))==0)
*ppObject=new PluginTest();
else
return CLASS_E_CLASSNOTAVAILABLE;
return NO_ERROR;
}

HRESULT __stdcall PluginTest::OnGetPluginInfo(TVdjPluginInfo *infos)
{
infos->Author=(char*)"alou83";
infos->PluginName=(char*)"PluginTest";
infos->Description=(char*)"Test Plugin";
infos->Flag=0x00;
return S_OK;
}


HRESULT __stdcall PluginTest::OnLoad()
{
FILE * pFile;

pFile = fopen ("C:\\testje_timer.txt","a");
if (pFile!=NULL)
{
fputs ("Blablabla\n",pFile);
fclose (pFile);
}

return S_OK;
}

HRESULT __stdcall PluginTest::OnProcessSamples(short *buffer,int nb,int pos){
return 0;
}

HRESULT __stdcall PluginTest::OnStart(int pos,int deck) {
FILE * pFile;

pFile = fopen ("C:\\testje_timer.txt","a");
if (pFile!=NULL)
{
fputs ("Blablabla\n",pFile);
fclose (pFile);
}
return 0;
}




 

Posté Sun 08 Sep 13 @ 8:41 am
SBDJPRO Infinity Member since 2006
SBDJ wrote :
Never had any success with GCC and windows VDJ due to name mangling issues.


C++ name mangling is compiler specific. Use the MS compiler.

 

Posté Mon 09 Sep 13 @ 10:36 am
alou83Home userMember since 2013
It is working now after compiling with VS. Thank you guys very much.
Alou
 

Posté Mon 09 Sep 13 @ 6:37 pm


(Les anciens sujets et forums sont automatiquement fermés)