Quick Sign In:  

Forum: General Discussion

Topic: What type of plugin do i need for a browser plugin?

This topic is old and might contain outdated or incorrect information.

Hi there,

after days of try and error (there is still no step by step manual how to create the first plugin) i was able to generate following plugin:
https://de.virtualdj.com/wiki/Plugins_SDKv8_Example.html

Ive put it into the folder C:\Users\<username>\Documents\VirtualDJ\Plugins64\SoundEffect and i can see it in the list of audio effects. Hurraaa :c)

Now i need to start with my main project. This plugin should not be a audio plugin type. It should be triggered by a custom button and should read the ID3 tag from selected songs at the browser, manipulate the "comment" field and write it back to the ID3 of the selected file.

1) Where the plugin needs to be stored? Into ..Documents\VirtualDJ\Plugins64\Autostart?
2) what syntax do i need on the custom button to trigger it?
3) How can i transfer the result of "get_browsed_song 'comment'" to the plugin?

Thank you so much for your help...
 

Posted Sat 11 Jul 20 @ 7:38 am
locodogPRO InfinityModeratorMember since 2013
2 if you made it as a DSP plugin [despite not doing any dsp stuff, this is no problem] you'd just call it like an effect
effect_active 'YOURFX'
if you're going be retentive about it then you'll need to set up
effect_command

3 GetInfo,
char commentString[2048]
GetInfo("get_browsed_song 'comment'", &commentString);
 

Posted Sat 11 Jul 20 @ 8:04 am
Thank you so much, locodog, it works.

Ive put it in the audio effect section.

Yes, i need to send a variable to this plugin, but there is no documentation about the effect_command. Im trying hours with try and error, but no luck:

At the custom button ive added:
effect_command 'MyPlugin8' 'DeleteComment' 'text to delete from comment'


in Myplugin8.h, after:
class CMyPlugin8 : public IVdjPlugin8
{
public:
HRESULT VDJ_API OnLoad();

ive added:
	HRESULT VDJ_API DeleteComment(char* inParam);


in vdjplugin8.h, after:
class IVdjPlugin8
{
public:
// Initialization
virtual HRESULT VDJ_API OnLoad() { return S_OK; }

ive added:
	virtual HRESULT VDJ_API DeleteComment(char* inParam) { return S_OK; }


in MyPlugin8.cpp ive added:
HRESULT VDJ_API CMyPlugin8::DeleteComment(char* inParam)
{
SendCommand("browsed_song 'comment' 'test'");
return S_OK;
}


Nothing happens, when i press the custom button...

The line:
	SendCommand("browsed_song 'comment' 'test'");

works, if i put it into the OnLoad or OnParameter section.

Can you guide me to the right direction?
 

Posted Sat 11 Jul 20 @ 12:03 pm
locodogPRO InfinityModeratorMember since 2013
...let me go digging round my sauce files

in vdjPlugin8.h
HRESULT DeclareParameterCommand(char *parameter, int id, const char *name, const char *shortName, int parameterSize) {return cb->DeclareParameter(parameter,VDJPARAM_COMMAND,id,name,shortName,parameterSize);}


a effect_command param script needs the param number [like you would with buttons||sliders]

effect_command "YOURFXNAME" 1 "YOURSTRING"
declare OnLoad, include a case in the switch statement inside OnParameter()


HRESULT VDJ_API CLocoDog4::OnLoad()
{
DeclareParameterCommand(rptCnt, LocoDog4_Param_Command1, "", "", 4);
return S_OK;
}
HRESULT VDJ_API CLocoDog4::OnParameter(int id)
{
switch (id)
{
case LocoDog4_Param_Command1:
repeats = atoi(rptCnt);
if (repeats == 0)
{
SendCommand("effect_slider 1 +0.0");
}
std::fill(rptCnt, rptCnt + 3, 0);
break;

default:
break;
}
return S_OK;
}
 

Posted Sat 11 Jul 20 @ 1:06 pm
Thank you

rptCnt is unknown, what do i need here?
 

Posted Sat 11 Jul 20 @ 1:56 pm
locodogPRO InfinityModeratorMember since 2013
rptCnt is my char array
 

Posted Sat 11 Jul 20 @ 2:10 pm
I cannot compile with rptCnt inside.
C:\Users\monty\source\repos\MyPlugin8\MyPlugin8.cpp(22,26): error C2065: "rptCnt": nichtdeklarierter Bezeichner


So ive tried with 0, i can compile now, but nothing happens if i click to the custom button. Here are my files now:

MyPlugin8.cpp:

#include "MyPlugin8.h"

//-----------------------------------------------------------------------------
HRESULT VDJ_API CMyPlugin8::OnLoad()
{
// ADD YOUR CODE HERE WHEN THE PLUGIN IS CALLED

m_Reset = 0;
m_Dry = 0.0f;
m_Wet = 0.0f;

bool bMasterFX = isMasterFX();


DeclareParameterButton(&m_Reset, ID_BUTTON_1, "Reset", "R");
DeclareParameterSlider(&m_Wet, ID_SLIDER_1, "Dry/Wet", "D/W", 1.0f);

OnParameter(ID_SLIDER_1);

DeclareParameterCommand(0, LocoDog4_Param_Command1, "", "", 4);

return S_OK;
}
//-----------------------------------------------------------------------------
HRESULT VDJ_API CMyPlugin8::OnGetPluginInfo(TVdjPluginInfo8* infos)
{
infos->PluginName = "MyPlugin8";
infos->Author = "Atomix Productions";
infos->Description = "My first VirtualDJ 8 plugin";
infos->Version = "1.0";
infos->Flags = 0x00;
infos->Bitmap = NULL;



return S_OK;
}
//---------------------------------------------------------------------------
ULONG VDJ_API CMyPlugin8::Release()
{
// ADD YOUR CODE HERE WHEN THE PLUGIN IS RELEASED

delete this;
return 0;
}
//---------------------------------------------------------------------------
HRESULT VDJ_API CMyPlugin8::OnGetUserInterface(TVdjPluginInterface8* pluginInterface)
{
pluginInterface->Type = VDJINTERFACE_DEFAULT;

return S_OK;
}
//---------------------------------------------------------------------------
HRESULT VDJ_API CMyPlugin8::OnParameter(int id)
{
switch (id)
{
case ID_BUTTON_1:
if (m_Reset == 1)
{
m_Wet = 0.5f;
//HRESULT hr;
//hr = SendCommand("effect_slider 1 50%");
}
break;

case ID_SLIDER_1:
m_Dry = 1 - m_Wet;
break;

case LocoDog4_Param_Command1:
SendCommand("browsed_song 'comment' 'test'");
break;
}

return S_OK;
}



//---------------------------------------------------------------------------
HRESULT VDJ_API CMyPlugin8::OnGetParameterString(int id, char* outParam, int outParamSize)
{
switch (id)
{
case ID_SLIDER_1:
sprintf(outParam, "+%.0f%%", m_Wet * 100);
break;
}

return S_OK;
}

//-------------------------------------------------------------------------------------------------------------------------------------
// BELOW, ADDITIONAL FUNCTIONS ONLY TO EXPLAIN SOME FEATURES (CAN BE REMOVED)
//-------------------------------------------------------------------------------------------------------------------------------------
bool CMyPlugin8::isMasterFX()
{
double qRes;
HRESULT hr = S_FALSE;

hr = GetInfo("get_deck 'master' ? true : false", &qRes);

if (qRes == 1.0f) return true;
else return false;
}


Myplugin8.h

#ifndef MYPLUGIN8_H
#define MYPLUGIN8_H

// we include stdio.h only to use the sprintf() function
// we define _CRT_SECURE_NO_WARNINGS for the warnings of the sprintf() function
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

#include "vdjPlugin8.h"

class CMyPlugin8 : public IVdjPlugin8
{
public:
HRESULT VDJ_API OnLoad();
HRESULT VDJ_API OnGetPluginInfo(TVdjPluginInfo8* infos);
ULONG VDJ_API Release();
HRESULT VDJ_API OnGetUserInterface(TVdjPluginInterface8* pluginInterface);
HRESULT VDJ_API OnParameter(int id);
HRESULT VDJ_API OnGetParameterString(int id, char* outParam, int outParamSize);

private:
int m_Reset;
float m_Dry;
float m_Wet;

bool isMasterFX(); // an example of additional function for the use of GetInfo()

protected:
typedef enum _ID_Interface
{
ID_BUTTON_1,
ID_SLIDER_1,
LocoDog4_Param_Command1
} ID_Interface;
};

#endif


custom button:
effect_command 'MyPlugin8' 3 'LocoDog4_Param_Command1'

 

Posted Sat 11 Jul 20 @ 2:17 pm
locodogPRO InfinityModeratorMember since 2013
script; it's not the 3rd effect_command, it's the first

declare the char array in private section.
it would be easier if you went the dsp route for the on/off capabilities, and then use effect_string(s) for your target string & your replacement string,
instead of having it as an autoStart plugin and using effect_command to set things into action.
but on the whole it seems like quite a long walk for a very short picnic [more work setting up the custom button than it would be to manually edit the comment]
 

Posted Sat 11 Jul 20 @ 3:48 pm
> script; it's not the 3rd effect_command, it's the first
hmmm.. for me, its the third, because the first is the button and the second is the fader, the third is the LocoDog4_Param_Command1. If this is wrong, then i need a document where i can see how it will be count.

Is there not just a working example? Why there is no documentation?

> but on the whole it seems like quite a long walk for a very short picnic [more work setting up the custom button than it would be to manually edit the comment
The problem is not to edit the comment. The Line "SendCommand("browsed_song 'comment' 'test'");" works well. The problem is that there is no working possibility to send a simple command to the plugin.
yes, ive spend already the whole day for nothing. Ive started to switch to VDJ because of the scripting possibilities. But if its not working, i do not need to switch anymore. On my old DJ software i can edit the comments manually, too, and i do not need to pay 300 bucks.

Thank you for your patience. If you will find a similar working project (not just non-working or outdated fragments), please just let me know.
 

Posted Sat 11 Jul 20 @ 4:28 pm
You need to bear in mind that VDJ is software for DJs to play music. It's not tag editing software.

It may have some convenient built in editors, but they will not replace any dedicated software.

The VDJ "video editor" cannot be compared to Adobe Premiere or Final Cut Pro. Likewise the tag editing is basic compared to software dedicated to editing tags.
 

Posted Sat 11 Jul 20 @ 4:50 pm
Then it just doesnt make sense to release a sdk. If i just want press play, im able to press play on "every" software.
 

Posted Sat 11 Jul 20 @ 4:54 pm
locodogPRO InfinityModeratorMember since 2013
VDJ Monty wrote :
> script; it's not the 3rd effect_command, it's the first
hmmm.. for me, its the third, because the first is the button and the second is the fader, the third is the LocoDog4_Param_Command1. If this is wrong, then i need a document where i can see how it will be count.


right perhaps I wasn't clear, it is the first effect_command
it might be the 3rd param but...
say your plugin has 1 slider & 1 button & 1 effect_command, the slider is effect_slider 1, the button is effect_button 1 the command is effect_command 1, you can have several effect_commands within a plugin.

I'll look at writing up an example, covering all the stuff I wasn't sure of to begin with, in a few days.
I'll have to have one of the devs check it over though, as I'm barely c++ literate [I know just enough to know I don't really know anything]


 

Posted Sat 11 Jul 20 @ 5:06 pm
Indenpentend of the results, many many many thanks to you for your patience.
 

Posted Sat 11 Jul 20 @ 5:14 pm
locodog, based on your comments a was able to find a similar project here:

https://www.virtualdj.com/forums/233464/VirtualDJ_Plugins/Help_with_calling_plugin_functions_from_vdjScript.html?search=strcmp&page=1

Together with yours and his comments i was able to work out the thing that i need.

Here is a small video with the result:
https://www.facebook.com/MontyVanHill/posts/10222846880058860

Any, yes, we really need an own forum part for SDK and an updated SDK description. Visual Studio 2005 is completeley different to VS 2019 and doesnt exists anymore.

Im going to buy a lifetime license now :c)
 

Posted Sun 12 Jul 20 @ 9:28 am
NicotuxHome userMember since 2014
"VDJ Monty": there is no working possibility to send a simple command to the plugin....?
any declared string parameter can receive string from script, this can be anything, including some specific command
(it will be effect_string 1)
DeclareParameterString(&m_string1, ID_STRING_1, "Command", "Cmd1", 2048);

DeclareParameterString : is call every time "effect_string" is used in a script
DeclareParameterCommand : is always call all the time, at every itteration, command is altered using "effect_command"

https://www.virtualdj.com/forums/action/newpost.html?topicid=236091

@locodog
an example covering all the stuff... great idea... and good luck ;)
 

Posted Sun 12 Jul 20 @ 6:44 pm
Nicotux, we just need a documentation. I dont know what you have written because there is no documentation, something with parameters and command.

Without documentation this is the result. Hours, Days of frustrating try and error.
 

Posted Sun 12 Jul 20 @ 10:25 pm


(Old topics and forums are automatically closed)