Quick Sign In:  

Forum: VirtualDJ Plugins

Topic: Help with understanding vdjDsp8 (IVdjPluginPositionDsp8 and derivated)

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

NicotuxHome userMember since 2014
Some inconsistencies in SDK8 or vdj really convert buffers multiple times for every plugin ?
or really don't figure out how to use it ^^


//////////////////////////////////////////////////////////////////////////
// DSP plugin class

class IVdjPluginDsp8 : public IVdjPlugin8
{
...
buffer is pointing to float
**************************
virtual HRESULT VDJ_API OnProcessSamples(float *buffer, int nb)=0;
...
};

//////////////////////////////////////////////////////////////////////////
// Buffer plugin class

class IVdjPluginBufferDsp8 : public IVdjPlugin8
{
...
buffer must point to short, songPos is int
*******************************************
// NOTE: samples are stereo, so you need to process up to buffer[2*nb]
virtual short * VDJ_API OnGetSongBuffer(int songPos, int nb)=0;
************* songPos looks more as a pointer (value match buffer, not position) when function is call

// Call this to get the buffer at the specified position
HRESULT GetSongBuffer(int pos, int nb, short **buffer) {return cb->GetSongBuffer(pos, nb, buffer);}
...
int SongPos; // number of samples from beginning of song
...
};

class IVdjPluginPositionDsp8 : public IVdjPluginBufferDsp8
{
public:
buffer is unknown, can get it as pointing to short from IVdjPluginBufferDsp8, songPos is double
**************************************************************************************************
virtual HRESULT VDJ_API OnTransformPosition(double *songPos, double *videoPos)=0;

buffer must be a pointer to short, songPos is int
**************************************************************************************************
virtual short * VDJ_API OnGetSongBuffer(int songPos, int nb) override { return NULL; }
};

can't ProcessSamples from IVdjPluginPositionDsp8 : public IVdjPluginBufferDsp8
can't GetSongBuffer from IVdjPluginBufferDsp8
 

Posted Wed 22 Jul 20 @ 1:00 pm
AdionPRO InfinityCTOMember since 2006
A dsp plugin processes the live audio that is about to be mixed. It uses the OnProcessSamples callback to do that, and is indeed working on 32-bit float values.

A buffer plugin processes the original decoded audio as it is needed, before any processing is applied. It uses the OnGetSongBuffer callback to do that, and you can use GetSongBuffer to get the original audio at that (or different) positions to prepare the final buffer. It indeed works on 16-bit integer values.
 

Posted Wed 22 Jul 20 @ 2:03 pm
NicotuxHome userMember since 2014
Ok, So that as IVdjPluginDsp8 and IVdjPluginPositionDsp8 / IVdjPluginBufferDsp8 are exclusive classes this exclude the simultaneous use of them both

How can a IVdjPluginDsp8 Get Song Samples other than the ones passed to buffer within OnProcessSamples ?
i.e. get access to get access to previous or future samples (far after buffer ones) ? (in any know format)
Is there a "big buffer of floats" for the whole converted song and a way to get it ?
Or get access to the (strangely) downsampled to 16 bit one or the real original one (16, 24, 32bit int/float) in a way to get these samples ?

(porting TexZK flangerHQ to SDK8 is not something so simple ^^, sdk6 was able to give an easy access to both buffers)


(downsampling 24bits or 32bit tracks to 16bit is not top)
 

Posted Wed 22 Jul 20 @ 5:32 pm
djcelPRO InfinityModeratorMember since 2004
You can use GetSongBuffer() or a circular buffer.
 

Posted Wed 22 Jul 20 @ 8:18 pm
NicotuxHome userMember since 2014
AH YES cb->GetSongBuffer() is exactly what is needed
 

Posted Wed 22 Jul 20 @ 10:54 pm
AdionPRO InfinityCTOMember since 2006
Unless you just want to use it for some analysis it will be quite hard to properly incorporate the audio from GetSongBuffer into a dsp plugin. You not only have to do the conversion from short to float but also pitch, mastertempo and key.

For echo/flanger etc you typically keep a small circular buffer yourself from the dsp output directly.
 

Posted Thu 23 Jul 20 @ 5:07 am


(Old topics and forums are automatically closed)