VDJPedia



 Plugins_SDKv2

SDK v2

VdjDsp2.h wrote :
#ifndef VdjDsp2H
#define VdjDsp2H

//---------------------------------------------------------------------------
// for compatibility with old compilers
#ifndef _HRESULT_DEFINED
#define _HRESULT_DEFINED
typedef long HRESULT;
typedef unsigned long ULONG;
#endif
#ifdef STRICT
#ifndef DECLARE_HANDLE
struct HINSTANCE__ { int unused; }; typedef struct HINSTANCE__ *HINSTANCE;
struct HWND__ { int unused; }; typedef struct HWND__ *HWND;
struct HDC__ { int unused; }; typedef struct HDC__ *HDC;
struct HBITMAP__ { int unused; }; typedef struct HBITMAP__ *HBITMAP;
#endif
#else
typedef void *HINSTANCE;
typedef void *HWND;
typedef void *HDC;
typedef void *HBITMAP;
#endif

#define VDJ_EXPORT __declspec( dllexport )
#define VDJ_API __stdcall
#define VDJ_BITMAP HBITMAP
#define VDJ_HINSTANCE HINSTANCE
#define VDJ_WINDOW HWND
#define VDJ_HDC HDC

class IVdjDsp2;
enum EProcessingType;
enum EInterfaceType;
enum ENotify;
struct TPluginInfos;
struct TProvidedInterfaceInit;

//---------------------------------------------------------------------------
// Interface class. Make your own DSP class inherit from this class

class IVdjDsp2
{
public:
// Initialisation functions and variables
virtual HRESULT VDJ_API OnLoad(TPluginInfos *PluginInfos)=0; // fill in PluginInfos and make any initialization here
virtual ULONG VDJ_API Release() {delete this;return 0;}
virtual HRESULT VDJ_API OnStart(int pos) {return 0;}
virtual HRESULT VDJ_API OnStop(int pos) {return 0;}

// Functions and variables for normal samples processing
virtual HRESULT VDJ_API OnComputeNewSamples(int pos,int nb,short *buffer) {return 0;}
HRESULT (VDJ_API *GetSongSamples)(int pos,int nb,short **buffer);
// Functions and variables for fixed-width samples processing
virtual HRESULT VDJ_API OnProcessSamples(int pos,int nb,short *buffer) {return 0;}
// Functions and variables for frequency-domain processing
virtual HRESULT VDJ_API OnProcessFFT(int pos,int nb,float *fft) {return 0;}
// Receive notifications (new song loaded, buffer refilled, etc...)
virtual HRESULT VDJ_API OnNotify(ENotify notify,int param1,int param2) {return 0;}

// Other useful variables and functions
int SongBpm; // number of samples between two consecutive beats
int SongPhase; // number of samples between the start of the song and the first beat
HRESULT (VDJ_API *ClearCommands)();
HRESULT (VDJ_API *SendCommand)(int desk,int when,char *action);
HRESULT (VDJ_API *GetParam)(int desk,char *param,void *result);
VDJ_HINSTANCE hInstance;
VDJ_WINDOW hWndParent;

// Functions and variables for provided interface
virtual HRESULT VDJ_API OnProvidedInterfaceInit(TProvidedInterfaceInit *Init) {return 0;}
virtual HRESULT VDJ_API OnButton(int button,bool down) {return 0;}
virtual HRESULT VDJ_API OnSlider(int slider,int value) {return 0;}
HRESULT (VDJ_API *DisplayText)(char *text);
int SliderValue[5];

// Functions and variables for custom interface
virtual HRESULT VDJ_API OnCustomInterfaceInit() {return 0;} // this is called each time a new skin is loaded
virtual HRESULT VDJ_API OnShow(bool visible) {return 0;}
virtual HRESULT VDJ_API OnMouseDown(int x,int y,int button) {return 0;}
virtual HRESULT VDJ_API OnMouseUp(int x,int y,int button) {return 0;}
virtual HRESULT VDJ_API OnMouseMove(int x,int y) {return 0;}
virtual HRESULT VDJ_APIOnMouseWheel(int x,int y,int delta) {return 0;}
HRESULT (VDJ_API *StartDraw)(VDJ_HDC *hDC,bool EraseBackround);
HRESULT (VDJ_API *EndDraw)();
HRESULT (VDJ_API *Invalidate)();
int Width,Height;

};

//---------------------------------------------------------------------------
// Plugin info struct

enum EProcessingType
{
PROCESSING_NORMAL=0,
PROCESSING_FIXEDWIDTH,
PROCESSING_FFT,
PROCESSING_NONE
};
enum EInterfaceType
{
INTERFACE_PROVIDED=0,
INTERFACE_CUSTOM
};
enum ENotify
{
NOTIFY_NEWSONG=0, // param1=(char*)FilePath, param2=(char*)FileName
NOTIFY_REFILLBUFFER // param1=newpos, param2=oldpos
};
struct TPluginInfos
{
int size;
unsigned int PluginVersion; // set this to VDJDSP_VERSION
char *Name;
char *Author;
EProcessingType Processing; // defines which processing function will be called
EInterfaceType Interface; // defines what kind of interface to use
VDJ_BITMAP Bitmap; // Bitmaps for the activation button
VDJ_BITMAP SelectedBitmap;
int SampleSize; // only for PROCESSING_FIXEDWIDTH and PROCESSING_FFT. Must be a power of 2 for the latest.
};
struct TProvidedInterfaceInit
{
int size;
int nbSliders;
struct {int InitialValue;char *ToolTip;} Sliders[5];
int nbButtons;
struct {char *ToolTip;} Buttons[5];
};

//---------------------------------------------------------------------------
// Other usefull defines

#define VDJDSP_VERSION 0x02000000
#define VDJDSP_BITMAP_WIDTH 100
#define VDJDSP_BITMAP_HEIGHT 75


//////////////////////////////////////////////////////////////////////////
// GUID définitions

#ifndef VDJDSPGUID_DEFINED
#define VDJDSPGUID_DEFINED
static const GUID CLSID_VdjDsp = { 0xab7a7125, 0x5dec, 0x44bc, { 0xab, 0xa9, 0xd8, 0xb, 0x2, 0xb0, 0x25, 0x49 } };
static const GUID IID_IVdjDspV1 = { 0x3936fd38, 0xec1e, 0x43d5, { 0x95, 0xc5, 0xf4, 0xa2, 0x23, 0x30, 0x35, 0x59 } };
#else
extern static const GUID CLSID_VdjDsp;
extern static const GUID IID_IVdjDspV1;
#endif

#ifndef VDJDSP2GUID_DEFINED
#define VDJDSP2GUID_DEFINED
static const GUID IID_IVdjDspV2 = { 0xb93344ff, 0xf379, 0x49d7, { 0xae, 0xf5, 0xde, 0x45, 0x8f, 0x1, 0x7f, 0x3e } };
#else
extern static const GUID IID_IVdjDspV2;
#endif

//////////////////////////////////////////////////////////////////////////
// DLL export function
// COM-like stuff (we made the plugins look like COM so that a real COM object can be used as a plugin)

#ifndef NODLLEXPORT
#ifdef __cplusplus
extern "C" {
#endif
VDJ_EXPORT HRESULT VDJ_API DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject);
#ifdef __cplusplus
}
#endif
#endif

#endif

//---------------------------------------------------------------------------
/* Small help:

Type of processing:
- normal:
Your function will need to call GetSample to get a pointer on samples to process,
and copy the processed samples in the provided buffer.
Even if in most case you will ask for nb samples starting from pos, you're not required to:
You can require how many samples you need from any pos in the song.
- fixed-width:
Vdj will send you already filled buffer of the required length,
and your function will process it in-place.
This mode is usefull for easy porting of existing code from other platform,
but is a bit slower than the normal mode.
Don't forget to set PluginInit.SampleSize to the length you want to proceed
OnNotify() function will be called with NOTIFY_REFILLBUFFER when VirtualDJ internal buffers
need to be refilled, and thus the same datas are about to be processed again.
- fft:
Vdj will pass to your function a fourrier transformation of the signal.
You can manipulate the frenquency-domain datas as you wish.
Upon return, Vdj will transform it back into PCM signal.
The function will be called with SampleSize complex datas for each channels (which makes 4*SampleSize floats).
Each fft is computer on a window of 2*SampleSize samples, overlapping each others from SampleSize samples.
The buffer provided is in the format:
Re[0].left,Re[1].left,...,Re[nb-1].left,Im[0].left,...,Im[nb-1].left,Re[0].right,Re[1].right,...,Im[nb-1].right

Actions list:
check online help or shortcut config in vdj

Params list:
- Bpm (float)
- Pitch (int)
- FilePath (char*)
- FileName (char*)
- FileSize (int)
- Author (char*)
- Title (char*)
- SongLength (int)
- Volume (int)
- Comment (char*)
- PlayPos (int)
- VdjFolder (char*)
- EffectFolder (char*)
- VdjVersion (int)
- CurrentDesk (int)
- CurrentSlot (int)
- CrossfaderVolume (int)
- Crossfader (int)

*/


vdjScratch.h wrote :
#ifndef VdjScratchH
#define VdjScratchH

#define VDJ_EXPORT __declspec( dllexport )
#define VDJ_API __stdcall

//////////////////////////////////////////////////////////////////////////
// DLL export function

#ifdef __cplusplus
extern "C" {
#endif
VDJ_EXPORT void VDJ_API VdjScratch(int *soundbuffer,float *speedbuffer,int buffsize,int desk);
#ifdef __cplusplus
}
#endif


#endif


Back to Developer page

Wiki HOME