Ingreso rápido:  

Forum: Spanish Forum

Tema: dmc2 Numark Inigualable

Este tópico es antiguo y puede contener información incorrecta para la nueva versión.

Hola amigos después de probar muchos creo que descubrí que el controlador exacto para el mejor software de mezcla es el DMC2 , sin dudas Numark lo creo específicamente para nuestro VDJ Amado.
Solo falta algo , poder mapear a nuestro gusto sus controles ,para eso necesitamos el Dmc2.cpp ya que el Dmc2Mapper.h ya esta publicado en http://www.virtualdj.com/developers/ , solo debemos desarrollar el archivo fuente.
Yo he comenzado pero tengo problemas con el display .
Estaría bueno que desarrolladores en español se conectaran a esta idea.
Esto es lo que he logrado hasta el momento:
#define WIN32_LEAN_AND_MEAN
#define _CRT_SECURE_NO_DEPRECATE

#include <windows.h>
#include <stdio.h>

#include "DMC2Mapper.h"
#include "VdjPlugin.h"
#include "vdjDevice.h"


// Mapper class
class CDMC2DefaultMapper : public IVdjPluginDevice
{
public:
CDMC2DefaultMapper();

HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPluginInfo *infos);

HRESULT __stdcall OnButton(int chan,int button,int down);
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
HRESULT __stdcall OnScratch(int chan,int *value);

HRESULT __stdcall OnTimer();
private:
bool shift[2],cpdown[2],folder[2],realtime[2];
bool keylock[2],beatlock[2],scratchlock[2],file[2];
bool BEAT2[2],BEAT3[2],BEAT4[2],BEAT5[2],BEAT6[2],BEAT7[2],BEAT8[2];
int display[2],pitchvalue[2],shiftloop[2];


int ts;
int tt;
int video_xfade;
};


// Initialisation
CDMC2DefaultMapper::CDMC2DefaultMapper()
{
for(int loop = 0; loop < 2; loop++) {
shift[loop] = false;
cpdown[loop] = false;
folder[loop] = false;
file[loop] = false;
BEAT2[loop] = false;
BEAT3[loop] = false;
BEAT4[loop] = false;
BEAT5[loop] = false;
BEAT6[loop] = false;
BEAT7[loop] = false;
BEAT8[loop] = false;

display[loop] = 0;
realtime[loop] = true;
shiftloop[loop] = 0;

keylock[loop] = false;
beatlock[loop] = false;
scratchlock[loop] = false;

pitchvalue[loop] = 127;

ts=1;
tt=1;
video_xfade = 0;
}
}


// Inline functions
inline char *IntToStr(int v,char *st) {sprintf(st,"%i",v);return st;}
inline char *IntToStrRelative(int v,char *st) {sprintf(st,"%s%i",v>=0?"+":"",v);return st;}
inline char *CharStr(const char *val,char *str) { strcpy(str,val); return(str); }


// Beat loop button loop lengths
const char looplengths[10] = {125,25,50,1,2,4,8,16,32,64};


// Button pressed/released
HRESULT CDMC2DefaultMapper::OnButton(int chan,int button,int down)
{
char *channel=chan?"2":"1";
char st[64];


char buffer[128];

switch(button)
{


break;
case DMC2_TIMEDISPLAY:
if(down) display[chan]=(display[chan]+1)&3;
break;

case DMC2_MIXVIDEO1:
video_xfade = -1;
break;
case DMC2_MIXVIDEO2:
video_xfade = +1;
break;
case DMC2_PITCHADJUST:
SendAction("pitch_reset",channel,NULL,down);
break;

case DMC2_KEYLOCK:

if(down) keylock[chan] = !keylock[chan];
SendAction("key_lock",channel,IntToStrRelative(keylock[chan]?1:-1,st),down);
break;

case DMC2_SYNC:
SendAction("sync",channel,"temporary",down);
break;

case DMC2_PITCHPLUS:
SendAction("pitch_bend",channel,CharStr("temporary +512",buffer),down);
break;
case DMC2_PITCHMINUS:
SendAction("pitch_bend",channel,CharStr("temporary -512",buffer),down);
break;
case DMC2_BEAT1:
if(shift[chan]) SendAction("sample",channel,CharStr("1",buffer),true);
else SendAction("loop",channel,CharStr("125",buffer),down);
break;
case DMC2_BEAT2:
if (shift[chan]) SendAction("sample",channel,CharStr("1",buffer),true);
else BEAT2[chan] = 1,
SendAction("loop",channel,CharStr("125",buffer),down);
break;
case DMC2_BEAT3:
if(shift[chan]) SendAction("sample",channel,CharStr("3",buffer),true);
else BEAT3[chan] = 1,
SendAction("loop",channel,CharStr("25",buffer),down);
break;
case DMC2_BEAT4:
if(shift[chan]) SendAction("sample",channel,CharStr("4",buffer),true);
else SendAction("loop",channel,CharStr("50",buffer),down);
break;
case DMC2_BEAT5:
if(shift[chan]) SendAction("sample",channel,CharStr("5",buffer),true);
else SendAction("loop",channel,CharStr("1",buffer),down);
break;
case DMC2_BEAT6:
if(shift[chan]) SendAction("sample",channel,CharStr("6",buffer),true);
else SendAction("loop",channel,CharStr("2",buffer),down);
break;
case DMC2_BEAT7:
if(shift[chan]) SendAction("sample",channel,CharStr("7",buffer),true);
else SendAction("loop",channel,CharStr("4",buffer),down);
break;
case DMC2_BEAT8:
if(shift[chan]) SendAction("sample",channel,CharStr("8",buffer),true);
else SendAction("loop",channel,CharStr("8",buffer),down);
break;

case DMC2_LOOPIN:
SendAction("effect_select",channel,CharStr("3",buffer),down);
SendAction("effect",channel,NULL,down);

break;
case DMC2_LOOPOUT:
SendAction("kill_bass",channel,NULL,down);
break;
case DMC2_BACK:
SendAction("effect_select",channel,CharStr("16",buffer),down);
SendAction("effect",channel,NULL,down);


break;
case DMC2_HOT1:
if(shift[chan]) SendAction("delete_cue",channel,CharStr("1",buffer),down);
else SendAction("hotcue",channel,CharStr("1",buffer),down);

break;

case DMC2_HOT2:
if(shift[chan]) SendAction("delete_cue",channel,CharStr("2",buffer),down);
else SendAction("hotcue",channel,CharStr("2",buffer),down);

break;
case DMC2_PUSH:
SendAction("browser_open",channel,NULL,down);

break;
case DMC2_FILE:
file[chan] = 1;
SendAction("browser_switch",NULL,CharStr("2",buffer),true);
folder[chan] = 0;
break;

case DMC2_FOLDER:
folder[chan] = 1;
SendAction("browser_switch",NULL,CharStr("1",buffer),true);
file[chan] = 0;
break;

case DMC2_CUE:
SendAction("cue_stop",channel,NULL,down);
break;
case DMC2_PAUSE:
SendAction("pause",channel,NULL,down);
cpdown[chan]=(down!=0);
tt=0;
break;
case DMC2_PLAY:
SendAction("play_stutter",channel,NULL,down);
break;
case DMC2_WHEELMODE:
shift[chan]=(down!=0);
break;
case DMC2_MIXAUTO:
SendAction("browser_open",NULL,NULL,down);


}
return S_OK;
}

// Pitch slider/jogwheel movement
HRESULT CDMC2DefaultMapper::OnSlider(int chan,int slider,int absvalue,int relvalue)
{
char *channel=chan?"2":"1";
char st[64];

if(slider == DMC2_PITCH) {

// Pitch slider
if(absvalue==pitchvalue[chan]) return S_FALSE;
SendAction("pitch",channel,IntToStr(absvalue,st),true);
pitchvalue[chan]=absvalue;
return S_OK;
} else if(slider == DMC2_SELECTOR) {

// selector
if(absvalue==pitchvalue[chan]) return S_FALSE;
SendAction("browser_updown",channel,IntToStrRelative(relvalue>0?1:-1,st),true);
pitchvalue[chan]=absvalue;
return S_OK;
} else if(slider == DMC2_WHEEL) {

// Jogwheel
if(shift[chan]) SendAction("skip_beat",channel,IntToStrRelative(relvalue>0?1:-1,st),true);
else if((DeckInfo[chan]->Playing != 0) && ((!cpdown[chan] && !scratchlock[chan]) || (cpdown[chan] && scratchlock[chan]))) {
if (ts==1) SendAction("scratch",channel,IntToStrRelative(relvalue * 4,st),true);
else SendAction("scratchwheel",channel,IntToStrRelative(relvalue * 8,st),true);


} else SendAction("scratchwheel",channel,IntToStrRelative(relvalue * 4 ,st),true);
return S_OK;
}
return S_FALSE;
}


HRESULT CDMC2DefaultMapper::OnScratch(int chan,int *value) {
return S_FALSE;
}


// Update displays (1/10th sec)
HRESULT CDMC2DefaultMapper::OnTimer()
{
char buffer[128];
for(int chan=0;chan<2;chan++)
{


if(video_xfade != 0)SendAction("video_crossfade","default",CharStr((video_xfade > 0) ? "+30":"-30",buffer),true);
SetLed(chan,DMC2LED_FOLDER,folder[chan]!=0);
SetLed(chan,DMC2LED_FILE,file[chan]!=0);
SetLed(chan,DMC2LED_KEYLOCK,keylock[chan]!=0);
SetLed(chan,DMC2LED_BEAT1,beatlock[chan] ? 1:(DeckInfo[chan]->BeatLed>=2048));
SetLed(chan,DMC2LED_BEAT2,BEAT2[chan]!=0);
SetLed(chan,DMC2LED_BEAT3,BEAT3[chan]!=0);
SetLed(chan,DMC2LED_LOOPIN,DeckInfo[chan]->Loop!=0);
SetLed(chan,DMC2LED_LOOPOUT,DeckInfo[chan]->LoopLength!=0);
SetLed(chan,DMC2LED_AUTOMIX,DeckInfo[chan]->AutoMix!=0);
SetLed(chan,DMC2LED_CUE,DeckInfo[chan]->CuePos==DeckInfo[chan]->Position);
SetLed(chan,DMC2LED_PLAY,DeckInfo[chan]->Playing!=0);
SetLed(chan,DMC2LED_PAUSE,DeckInfo[chan]->Status>0&&!DeckInfo[chan]->Playing);

SetLed(chan,DMC2LED_LCD_PLAY,DeckInfo[chan]->Playing!=0);
SetLed(chan,DMC2LED_LCD_PAUSE,DeckInfo[chan]->Status>0&&!DeckInfo[chan]->Playing);
SetLed(chan,DMC2LED_LCD_CUE,DeckInfo[chan]->CuePos==DeckInfo[chan]->Position);
SetLed(chan,DMC2LED_LCD_BPM ,(display[chan]&2)==0);
SetLed(chan,DMC2LED_LCD_PITCH,(display[chan]&2)==0);
SetLed(chan,DMC2LED_LCD_TIME_REMAIN,(display[chan]&1)==0);
SetLed(chan,DMC2LED_LCD_HOT1_HOT,DeckInfo[chan]->Loop!=0);
SetLed(chan,DMC2LED_LCD_SINGLE,scratchlock[chan]!=0);

SetLed(chan,DMC2DIGIT_TRACK,(display[chan]&2)==0);

SetDigit(chan,DMC2DIGIT_FRAME,DeckInfo[chan]->Length?MulDiv(DeckInfo[chan]->Position,10,DeckInfo[chan]->Length):0);

if(DeckInfo[chan]->Status<0)
{
for(int i=0;i<12;i++) SetDigit(chan,i,0x0B);
SetLed(chan,DMC2LED_LCD_COMMA1,false);
SetLed(chan,DMC2LED_LCD_COMMA2,false);
SetLed(chan,DMC2LED_LCD_PITCHDOT,false);
}
else
{
int v;

// Time elapsed/remaining
v = MulDiv((display[chan]&1) ? DeckInfo[chan]->Position:(DeckInfo[chan]->Length - DeckInfo[chan]->Position),1,(!realtime[chan] ? 441:MulDiv(441,DeckInfo[chan]->Pitch,4096)));

SetDigit(chan,7,v%10);v/=10;
SetDigit(chan,6,v%10);v/=10;
SetLed(chan,DMC2LED_LCD_COMMA2,true);
SetDigit(chan,5,v%10);v/=10;
SetDigit(chan,4,v?v%6:0x0B);v/=6;
SetLed(chan,DMC2LED_LCD_COMMA1,v!=0);
SetDigit(chan,3,v?v%10:0x0B);v/=10;
SetDigit(chan,2,v?v%10:0x0B);v/=10;
SetDigit(chan,1,v?v%10:0x0B);v/=10;
SetDigit(chan,0,v?v%10:0x0B);v/=10;

// BPM/pitch %
if(display[chan]&2) v = MulDiv(DeckInfo[chan]->Pitch,1000,4096) - 1000;
else v = MulDiv(((44100 * 60 * 10) / 32),DeckInfo[chan]->Pitch,DeckInfo[chan]->Bpm * (4096 / 32));

// +/-
if((display[chan]&2) || (v < 0)) {

} else {
SetLed(chan, DMC2LED_LCD_PITCHPLUS,false);
SetLed(chan,DMC2LED_LCD_PITCHMINUS,false);
}

if(v < 0) v = 0 - v;
SetDigit(chan,11,v%10);v/=10;
SetLed(chan,DMC2LED_LCD_PITCHDOT,true);
SetDigit(chan,2,v%10);v/=10;
SetDigit(chan,2,v?v%10:0x0B);v/=10;
SetDigit(chan,2,v?v%10:0x0B);v/=10;
}
SetDigit(chan,-1,0); // flush digit buffering
}
SetLed(0,DMC2LED_AUTOMIX,DeckInfo[0]->MixNow!=0);
return S_OK;
}


// Set device type
HRESULT CDMC2DefaultMapper::GetDeviceType(int *type) {
*type = PLUGINDEVICE_DMC2;
return(PLUGINDEVICE_DMC2);
}


// Return information about plugin
HRESULT CDMC2DefaultMapper::OnGetPluginInfo(TVdjPluginInfo *infos)
{
static char st[128];

infos->PluginName = ".";
infos->Author = ".";
infos->Description = ".";
infos->Flag = 0;

infos->Bitmap = LoadBitmap(hInstance,MAKEINTRESOURCE(100));

return S_OK;
}


HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
if(memcmp(&rclsid,&CLSID_VdjPlugin,sizeof(GUID)) != 0) return CLASS_E_CLASSNOTAVAILABLE;
if(memcmp(&riid,&IID_IVdjPluginDevice,sizeof(GUID)) != 0) return CLASS_E_CLASSNOTAVAILABLE;
*ppObject = new CDMC2DefaultMapper();
return NO_ERROR;
}
-------------------------------


GRACIAS VIRTUAL DJ Y GRACIAS J.P. Boggis (MASTER OFF THE MAPPERS) !!!!!!!!



 

Mensajes Tue 25 Sep 07 @ 5:12 am


(Los tópicos y foros antiguos son automáticamente cerrados)