Hello!
I want to write an "other" plugin in c++ 2010 that is checking some variables in VirtualDJ and executing commands. And this Needs to be done every time.
I if i make a "soundeffect" plugin and i put this sequence at "OnPosition(int pos)" it is working verry fine if the effect is active, but not if it is not active.
I tried executing a timer inside of the plugin but it did not work.
I found this plugin on the database:
http://www.virtualdj.com/forums/135599/Virtual_DJ_Plugins/SBDJ_Notepad.html
that opens a Notepad if you set a variable.
How can i manage this?
Best regards,
C.Hackl
I want to write an "other" plugin in c++ 2010 that is checking some variables in VirtualDJ and executing commands. And this Needs to be done every time.
I if i make a "soundeffect" plugin and i put this sequence at "OnPosition(int pos)" it is working verry fine if the effect is active, but not if it is not active.
I tried executing a timer inside of the plugin but it did not work.
I found this plugin on the database:
http://www.virtualdj.com/forums/135599/Virtual_DJ_Plugins/SBDJ_Notepad.html
that opens a Notepad if you set a variable.
How can i manage this?
Best regards,
C.Hackl
Inviato Sun 07 Oct 12 @ 5:10 pm
Greetings, I would like to congratulate you in advance for the excellent job you did with slip scratch, and I wonder if you could make a call FX Loop SlipMode that is present in the new Pioneer CDJ 2000 nexus ...
Inviato Sun 07 Oct 12 @ 11:13 pm
Chackl wrote :
Hello!
I want to write an "other" plugin in c++ 2010 that is checking some variables in VirtualDJ and executing commands. And this Needs to be done every time.
How can i manage this?
Best regards,
C.Hackl
I want to write an "other" plugin in c++ 2010 that is checking some variables in VirtualDJ and executing commands. And this Needs to be done every time.
How can i manage this?
Best regards,
C.Hackl
I have created such a plug-in (Watchdog) in the past.
I don't have the full source code available right now, but here's a snippet of how you could do this:
class SkinCompanion : public IVdjPlugin
{
public:
HRESULT __stdcall OnLoad();
HRESULT __stdcall OnGetPluginInfo(TVdjPluginInfo *infos);
ULONG __stdcall Release();
BOOL bRun;
private:
HANDLE hThread;
unsigned uThreadId;
};
unsigned __stdcall SCThread(void *ArgList)
{
SkinCompanion* pSC = (SkinCompanion*) ArgList;
while (pSC->bRun)
{
//// Declare GetInfo result structure
struct TVdjQueryResult qRes;
//// Initialise structure. I like to do this before every GetInfo call.
qRes.type=0;
qRes.vint=0;
qRes.vfloat=0;
qRes.string=NULL;
qRes.flag=0;
//
////Perform query
pSC->GetInfo("get activedeck",&qRes);
int iActiveDeck=qRes.vint;
pSC->SendCommand("cycle '$SC_T2' 2 & cycle '$SC_T3' 3 & cycle '$SC_T4' 4 & cycle '$SC_T5' 5",0);
Sleep(500);
}
return 0;
}
HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
if(memcmp(&rclsid,&CLSID_VdjPlugin6,sizeof(GUID))!=0) return CLASS_E_CLASSNOTAVAILABLE;
*ppObject=new SkinCompanion();
return NO_ERROR;
}
HRESULT __stdcall SkinCompanion::OnLoad()
{
bRun=TRUE;
hThread=(HANDLE)_beginthreadex(NULL,0,SCThread,this,0,&uThreadId);
return S_OK;
}
HRESULT __stdcall SkinCompanion::OnGetPluginInfo(TVdjPluginInfo *infos)
{
infos->Author="PhantomDj";
infos->PluginName="Skin Companion";
infos->Description="Version 1.0 Alpha";
infos->Flag=0x00;
return S_OK;
}
ULONG __stdcall SkinCompanion::Release()
{
if (bRun)
{
bRun=FALSE;
if (hThread)
{
WaitForSingleObject(hThread,INFINITE);
CloseHandle(hThread);
hThread=NULL;
}
}
delete this;
return 0;
}
This is a simple example that will query the active deck every 500ms and it will also send some (irrelevant to the active deck) commands.
If you need more help I can find the entire source code of watchdog later this evening...
Inviato Mon 08 Oct 12 @ 12:50 am
Well thanks for those lines PhantomDeejay!
I got it working with some extra lines. But it runs Global over all decks.
The scripts i have made is one for all deck that is found in OnPosition(int pos).
Well would there be an option, that GetInfo and SendCommand will only query a specific deck?
Best regards ;)
I got it working with some extra lines. But it runs Global over all decks.
The scripts i have made is one for all deck that is found in OnPosition(int pos).
Well would there be an option, that GetInfo and SendCommand will only query a specific deck?
Best regards ;)
Inviato Mon 08 Oct 12 @ 6:32 am
The code I posted above can do anything YOU want. It is deck independent and runs all the time. However you can use it to query a single deck if you wish, or more:
unsigned __stdcall SCThread(void *ArgList)
{
SkinCompanion* pSC = (SkinCompanion*) ArgList;
while (pSC->bRun)
{
struct TVdjQueryResult qRes1;
struct TVdjQueryResult qRes2;
qRes1.type=0;
qRes1.vint=0;
qRes1.vfloat=0;
qRes1.string=NULL;
qRes1.flag=0;
qRes2.type=0;
qRes2.vint=0;
qRes2.vfloat=0;
qRes2.string=NULL;
qRes2.flag=0;
pSC->GetInfo("deck 1 get position",&qRes1);
pSC->GetInfo("deck 2 get position",&qRes2);
float fDeck1Pos=qRes1.vfloat;
float fDeck2Pos=qRes2.vfloat;
if (fDeck1Pos>= 0.9) {
pSC->SendCommand("deck 2 play & deck 1 stop",0);
}
if (fDeck2Pos>= 0.9) {
pSC->SendCommand("deck 1 play & deck 2 stop",0);
}
Sleep(500);
}
return 0;
}
That's a typical example. Of course you can change the query to "deck left get position" for instance if you want to get the left deck ;)
unsigned __stdcall SCThread(void *ArgList)
{
SkinCompanion* pSC = (SkinCompanion*) ArgList;
while (pSC->bRun)
{
struct TVdjQueryResult qRes1;
struct TVdjQueryResult qRes2;
qRes1.type=0;
qRes1.vint=0;
qRes1.vfloat=0;
qRes1.string=NULL;
qRes1.flag=0;
qRes2.type=0;
qRes2.vint=0;
qRes2.vfloat=0;
qRes2.string=NULL;
qRes2.flag=0;
pSC->GetInfo("deck 1 get position",&qRes1);
pSC->GetInfo("deck 2 get position",&qRes2);
float fDeck1Pos=qRes1.vfloat;
float fDeck2Pos=qRes2.vfloat;
if (fDeck1Pos>= 0.9) {
pSC->SendCommand("deck 2 play & deck 1 stop",0);
}
if (fDeck2Pos>= 0.9) {
pSC->SendCommand("deck 1 play & deck 2 stop",0);
}
Sleep(500);
}
return 0;
}
That's a typical example. Of course you can change the query to "deck left get position" for instance if you want to get the left deck ;)
Inviato Mon 08 Oct 12 @ 6:50 am
unsigned __stdcall SCThread(void *ArgList)
{
SkinCompanion* pSC = (SkinCompanion*) ArgList;
while (pSC->bRun)
{
struct TVdjQueryResult qRes;
qRes.type=0;
qRes.vint=0;
qRes.vfloat=0;
qRes.string=NULL;
qRes.flag=0;
pSC->GetInfo("deck 1 get position",&qRes);
float fDeck1Pos=qRes.vfloat;
qRes.type=0;
qRes.vint=0;
qRes.vfloat=0;
qRes.string=NULL;
qRes.flag=0;
pSC->GetInfo("deck 2 get position",&qRes);
float fDeck2Pos=qRes.vfloat;
if (fDeck1Pos>= 0.9) {
pSC->SendCommand("deck 2 play & deck 1 stop",0);
}
if (fDeck2Pos>= 0.9) {
pSC->SendCommand("deck 1 play & deck 2 stop",0);
}
Sleep(500);
}
return 0;
}
I believe that the above code is better (it declares TVdjQueryResult only once)
{
SkinCompanion* pSC = (SkinCompanion*) ArgList;
while (pSC->bRun)
{
struct TVdjQueryResult qRes;
qRes.type=0;
qRes.vint=0;
qRes.vfloat=0;
qRes.string=NULL;
qRes.flag=0;
pSC->GetInfo("deck 1 get position",&qRes);
float fDeck1Pos=qRes.vfloat;
qRes.type=0;
qRes.vint=0;
qRes.vfloat=0;
qRes.string=NULL;
qRes.flag=0;
pSC->GetInfo("deck 2 get position",&qRes);
float fDeck2Pos=qRes.vfloat;
if (fDeck1Pos>= 0.9) {
pSC->SendCommand("deck 2 play & deck 1 stop",0);
}
if (fDeck2Pos>= 0.9) {
pSC->SendCommand("deck 1 play & deck 2 stop",0);
}
Sleep(500);
}
return 0;
}
I believe that the above code is better (it declares TVdjQueryResult only once)
Inviato Mon 08 Oct 12 @ 6:54 am