SDK v6

VdjDsp.h wrote :
// VirtualDJ / Cue
// Plugin SDK
// (c)Atomix Productions 2006
// This file defines the sound effect plugins.
// In addition to all the elements supported from the base IVdjPlugin class,
// it defines additional DSP-specific functions and variables:

#ifndef VdjDspH
#define VdjDspH

#include "VdjPlugin.h"

// DSP plugin class

class IVdjPluginDsp : public IVdjPlugin
// called when the plugin is started or stopped
virtual HRESULT VDJ_API OnStart(int pos,int deck) {return 0;}
virtual HRESULT VDJ_API OnStop() {return 0;}

// This function will be called each time VirtualDJ needs your plugin
// to be applied on a new sound buffer
// NOTE: samples are stereo, so you need to process up to buffer[2*nb]
virtual HRESULT VDJ_API OnProcessSamples(short *buffer,int nb,int pos)=0;
// This function let you take specific action once a particular point has been reached
virtual HRESULT VDJ_API OnPosition(int actualpos) {return 0;}

// If your plugin needs to access an other sound buffer than the one at the
// position provided, you can get it with this function
HRESULT (VDJ_API *GetSongSamples)(int pos,int nb,short **buffer);
// Call this function if you need to stop your plugin automatically
// Call this function if you want to change the current reading position displayed
HRESULT (VDJ_API *ChangePosition)(int newpos);

// Some useful variables
int SongBpm; // number of samples between two consecutive beats
int SongPhase; // number of samples between the start of the song and the first beat

// flags used in OnGetPluginInfo()
#define VDJPLUGINFLAG_INPLACE 0x00 // normal behavior
#define VDJPLUGINFLAG_NOTINPLACE 0x01 // set if you don't need buffer to contain song's data on input (if you call GetSongSamples)
#define VDJPLUGINFLAG_CACHE 0x00 // if set, OnProcessSamples will be called as linearly as possible (default behavior)
#define VDJPLUGINFLAG_NOCACHE 0x02 // if set, OnProcessSamples might be called in every direction, and with nb as low as 1
#define VDJPLUGINFLAG_FIXED512 0x04 // if set, OnProcessSamples will received only 512 samples buffers
#define VDJPLUGINFLAG_PROCESSSONG 0x00 // apply the plugin on the song (default behavior)
#define VDJPLUGINFLAG_PROCESSSCRATCH 0x08 // apply the plugin on the desk output (useful for scratch plugins)
#define VDJPLUGINFLAG_PROCESSMASTER 0x10 // apply the plugin on the master output
#define VDJPLUGINFLAG_PROCESSMIC 0x20 // apply the plugin on the microhpone intput (DJConsole RMX)

// Sound processing
#define SAMPLING_RATE 44100
#define LEFTCHAN(v) ((short)(v&0xFFFF))
#define RIGHTCHAN(v) ((short)(v>>16))
#define MAKECHAN(l,r) ((r<<16)+(l&0xFFFF))
#define LIMITER(x) {if(x<-32768) x=-32768; else if(x>32767) x=32767;}

// GUID definitions

static const GUID IID_IVdjPluginDsp = { 0x41dbff5, 0x55d4, 0x47ee, { 0x9d, 0x32, 0xd3, 0xc8, 0xa2, 0x0, 0x61, 0xff } };
extern static const GUID IID_IVdjPluginDsp;



Back to Developer page