On Friday 07 December 2007 23:06:48 Robin Sheat wrote: > Try this patch instead actually, it has a bit of debugging code removed > that I missed on my first pass. More replying to myself, but this is the last one for tonight :)
The attached patch is my current effort. Basically the only change is that the knobs are more linear (using the formula in herculeslinux.cpp - this can be made better, it just needs to do some kind of log or power to the value I think). Volume sliders aren't especially great, but they'll do for now. I'm curious if there's a reason for using log pot things for the EQ and various sliders? It's that that's making it behave funny. Alternately a way to say 'go to n% of your range'. Also, I managed to make the right Fx light be activated, send an event with type=EV_LED, code=0x5, value=0x1. However, I blasted the whole range of types at the thing and couldn't make any other ones light up. Pity, I thought I was onto something when I saw that one work :) Oh, and I did something at one point that seemed to make it send the state of all it's sliders and knobs back, which might be useful in initialisation to make mixxx have the same state as the controller. If I can rediscover what it was that I did. Anyway, with this patch it's quite usable again. It's just a pity the EQs aren't working so good in mixxx at the moment :) -- Robin <[EMAIL PROTECTED]> JabberID: <[EMAIL PROTECTED]> Hostes alienigeni me abduxerunt. Qui annus est? PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D
Index: src/herculeslinuxlegacy.cpp
===================================================================
--- src/herculeslinuxlegacy.cpp (revision 1640)
+++ src/herculeslinuxlegacy.cpp (working copy)
@@ -52,6 +52,14 @@
m_bLoopRight=!m_bLoopRight;
led_write(kiHerculesLedRightCueBtn, m_bLoopRight);
}
+ if (m_pControlObjectLeftBtnHeadphoneProxy->get()!=m_bHeadphoneLeft)
+ {
+ m_bHeadphoneLeft=!m_bHeadphoneLeft;
+ }
+ if (m_pControlObjectRightBtnHeadphoneProxy->get()!=m_bHeadphoneRight)
+ {
+ m_bHeadphoneRight=!m_bHeadphoneRight;
+ }
}
}
@@ -180,32 +188,41 @@
int iR = read(m_iFd, &ev, sizeof(struct input_event));
if (iR == sizeof(struct input_event))
{
+ if (ev.type == EV_SYN) {
+ // avoid unnecessary calculations
+ return;
+ }
//double v = 127.*(double)ev.value/256.;
- double v = ((ev.value+1)/(4.- ((ev.value>((7/8.)*256))*((ev.value-((7/8.)*256))*1/16.)))); // GED's formula, might need some work
+ //double v = ((ev.value+1)/(4.- ((ev.value>((7/8.)*256))*((ev.value-((7/8.)*256))*1/16.))))/62.0605; // GED's formula, might need some work
+ //v = v/255.;
+
+ // This scales the 0-255 value provided by the console to 0-1.0
+ double linv = (double)ev.value / 255.0;
+ double logv = ((0.733835252488 * tan((0.00863901501308 * ev.value) - 4.00513109039)) + 0.887988233294);
//qDebug("type %i, code %i, value %i",ev.type,ev.code,ev.value);
- //qDebug("type %i, code %i, value %i, v is %5.3f",ev.type,ev.code,ev.value,v);
-
+ qDebug("type 0x%x, code 0x%x, value 0x%x, logv %5.3f, linv %5.3f",ev.type,ev.code,ev.value,logv,linv);
switch(ev.type)
{
case EV_ABS:
- //qDebug("code %i",ev.code);
int iDiff;
double dDiff;
switch (ev.code)
{
case kiHerculesLeftTreble:
- sendEvent(v, m_pControlObjectLeftTreble);
+ qDebug("Left treble: sending %5.3f", logv);
+ sendEvent(logv, m_pControlObjectLeftTreble);
break;
case kiHerculesLeftMiddle:
- sendEvent(v, m_pControlObjectLeftMiddle);
+ sendEvent(logv, m_pControlObjectLeftMiddle);
break;
case kiHerculesLeftBass:
- sendEvent(v, m_pControlObjectLeftBass);
+ sendEvent(logv, m_pControlObjectLeftBass);
break;
case kiHerculesLeftVolume:
- m_dLeftVolumeOld = ev.value/2.;
- sendEvent(ev.value/2., m_pControlObjectLeftVolume);
+ //m_dLeftVolumeOld = ev.value/2.;
+ //sendEvent(ev.value/2., m_pControlObjectLeftVolume);
+ sendEvent(linv, m_pControlObjectLeftVolume);
break;
case kiHerculesLeftPitch:
//qDebug("");
@@ -222,24 +239,22 @@
dDiff = m_pRotaryLeft->filter((double)iDiff/16.);
//qDebug("Left Jog - ev.value %i, m_iJogLeft %i, idiff %i, dDiff %5.3f",ev.value, m_iJogLeft, iDiff, dDiff);
m_iJogLeft = ev.value;
- sendEvent(dDiff, m_pControlObjectLeftJog);
break;
case kiHerculesRightTreble:
- sendEvent(v, m_pControlObjectRightTreble);
+ sendEvent(logv, m_pControlObjectRightTreble);
break;
case kiHerculesRightMiddle:
- sendEvent(v, m_pControlObjectRightMiddle);
+ sendEvent(logv, m_pControlObjectRightMiddle);
break;
case kiHerculesRightBass:
- sendEvent(v, m_pControlObjectRightBass);
+ sendEvent(logv, m_pControlObjectRightBass);
break;
case kiHerculesRightVolume:
- m_dRightVolumeOld = ev.value/2.;
+ //m_dRightVolumeOld = ev.value/2.;
//qDebug("R Volume %5.3f",ev.value/2.);
- sendEvent(ev.value/2., m_pControlObjectRightVolume);
+ sendEvent(linv, m_pControlObjectRightVolume);
break;
case kiHerculesRightPitch:
- //qDebug("");
sendEvent(PitchChange("Right", ev.value, m_iPitchRight, m_iPitchOffsetRight), m_pControlObjectRightPitch);
break;
case kiHerculesRightJog:
@@ -257,7 +272,8 @@
break;
case kiHerculesCrossfade:
//qDebug("(ev.value+1)/2.0f: %f", (ev.value+1)/2.0f);
- sendEvent((ev.value+1)/2.0f, m_pControlObjectCrossfade);
+ //sendEvent((ev.value+1)/2.0f, m_pControlObjectCrossfade);
+ sendEvent(linv*2.0-1.0, m_pControlObjectCrossfade);
break;
// default:
// sendEvent(0., m_pControlObjectLeftJog);
@@ -287,8 +303,7 @@
//led_write(kiHerculesLedLeftCueBtn, m_bCueLeft);
break;
case kiHerculesLeftBtnPlay:
- sendButtonEvent(true, m_pControlObjectLeftBtnPlay);
-// m_bPlayLeft = !m_bPlayLeft;
+ sendButtonEvent(!m_bPlayLeft, m_pControlObjectLeftBtnPlay);
// led_write(kiHerculesLedLeftPlay, m_bPlayLeft);
break;
case kiHerculesLeftBtnAutobeat:
@@ -303,16 +318,19 @@
break;
case kiHerculesLeftBtn1:
m_iLeftFxMode = 0;
+ qDebug("Jog mode 1");
changeJogMode(m_iLeftFxMode,m_iRightFxMode);
sendButtonEvent(true, m_pControlObjectLeftBtn1);
break;
case kiHerculesLeftBtn2:
m_iLeftFxMode = 1;
+ qDebug("Jog mode 2");
changeJogMode(m_iLeftFxMode,m_iRightFxMode);
sendButtonEvent(true, m_pControlObjectLeftBtn2);
break;
case kiHerculesLeftBtn3:
m_iLeftFxMode = 2;
+ qDebug("Jog mode 3");
changeJogMode(m_iLeftFxMode,m_iRightFxMode);
sendButtonEvent(true, m_pControlObjectLeftBtn3);
break;
@@ -328,9 +346,9 @@
*/
break;
case kiHerculesLeftBtnHeadphone:
- sendButtonEvent(true, m_pControlObjectLeftBtnHeadphone);
- m_bHeadphoneLeft = !m_bHeadphoneLeft;
- led_write(kiHerculesLedLeftHeadphone, m_bHeadphoneLeft);
+ sendButtonEvent(!m_bHeadphoneLeft, m_pControlObjectLeftBtnHeadphone);
+ //m_bHeadphoneLeft = !m_bHeadphoneLeft;
+ //led_write(kiHerculesLedLeftHeadphone, m_bHeadphoneLeft);
break;
case kiHerculesRightBtnPitchBendMinus:
sendButtonEvent(true, m_pControlObjectRightBtnPitchBendMinus);
@@ -350,7 +368,7 @@
//led_write(kiHerculesLedRightCueBtn, m_bCueRight);
break;
case kiHerculesRightBtnPlay:
- sendButtonEvent(true, m_pControlObjectRightBtnPlay);
+ sendButtonEvent(!m_bPlayRight, m_pControlObjectRightBtnPlay);
// m_bPlayRight = !m_bPlayRight;
// led_write(kiHerculesLedRightPlay, m_bPlayRight);
break;
@@ -402,9 +420,9 @@
break;
case kiHerculesRightBtnHeadphone:
- sendButtonEvent(true, m_pControlObjectRightBtnHeadphone);
- m_bHeadphoneRight = !m_bHeadphoneRight;
- //led_write(kiHerculesLedRightHeadphone, m_bHeadphoneRight);
+ sendButtonEvent(!m_bHeadphoneRight, m_pControlObjectRightBtnHeadphone);
+ //m_bHeadphoneRight = !m_bHeadphoneRight;
+ led_write(kiHerculesLedRightHeadphone, m_bHeadphoneRight);
break;
}
}
@@ -430,7 +448,7 @@
sendButtonEvent(false, m_pControlObjectLeftBtnCue);
break;
case kiHerculesLeftBtnPlay:
- sendButtonEvent(false, m_pControlObjectLeftBtnPlay);
+ //sendButtonEvent(false, m_pControlObjectLeftBtnPlay);
break;
case kiHerculesLeftBtnAutobeat:
sendButtonEvent(false, m_pControlObjectLeftBtnAutobeat);
@@ -457,7 +475,8 @@
sendButtonEvent(false, m_pControlObjectLeftBtnFx);
break;
case kiHerculesLeftBtnHeadphone:
- sendButtonEvent(false, m_pControlObjectLeftBtnHeadphone);
+ //sendButtonEvent(false, m_pControlObjectLeftBtnHeadphone);
+ break;
case kiHerculesRightBtnPitchBendMinus:
sendButtonEvent(false, m_pControlObjectRightBtnPitchBendMinus);
break;
@@ -476,7 +495,7 @@
sendButtonEvent(false, m_pControlObjectRightBtnCue);
break;
case kiHerculesRightBtnPlay:
- sendButtonEvent(false, m_pControlObjectRightBtnPlay);
+ //sendButtonEvent(false, m_pControlObjectRightBtnPlay);
break;
case kiHerculesRightBtnAutobeat:
sendButtonEvent(false, m_pControlObjectRightBtnAutobeat);
@@ -503,7 +522,8 @@
sendButtonEvent(false, m_pControlObjectRightBtnFx);
break;
case kiHerculesRightBtnHeadphone:
- sendButtonEvent(false, m_pControlObjectRightBtnHeadphone);
+ //sendButtonEvent(false, m_pControlObjectRightBtnHeadphone);
+ break;
}
}
break;
@@ -544,15 +564,15 @@
struct input_event ev;
memset(&ev, 0, sizeof(struct input_event));
- //ev.type = EV_LED;
- ev.type = 0x0000;
+ ev.type = EV_LED;
+ //ev.type = 0x0000;
ev.code = iLed;
if (bOn)
ev.value = 3;
else
ev.value = 0;
- //qDebug("Hercules: led_write(iLed=%d, bOn=%d)", iLed, bOn);
+ qDebug("Hercules: led_write(iLed=%d, bOn=%d)", iLed, bOn);
if (write(m_iFd, &ev, sizeof(struct input_event)) != sizeof(struct input_event))
qDebug("Hercules: write(): %s", strerror(errno));
@@ -611,7 +631,7 @@
m_iPitchPrevious = ev_value;
// qDebug("%s ADJUSTED m_iPitchOffset %i, m_iPitchPrevious %i, Resulting Pitch %5.3f", ControlSide.data(), m_iPitchOffset, m_iPitchPrevious, (((m_iPitchPrevious + m_iPitchOffset)-.5)/2.));
- return (((m_iPitchPrevious + m_iPitchOffset)-.5)/2.);
+ return (((m_iPitchPrevious + m_iPitchOffset)-.5)/128.)-1.0;
}
Index: src/hercules.cpp
===================================================================
--- src/hercules.cpp (revision 1640)
+++ src/hercules.cpp (working copy)
@@ -58,6 +58,10 @@
m_pControlObjectRightBeatLoop = new ControlObjectThread(ControlObject::getControl(ConfigKey("[Channel2]","beatloop")));
Q_ASSERT(m_pControlObjectRightBeatLoop!=0);
+ m_pControlObjectLeftBtnHeadphoneProxy = new ControlObjectThread(ControlObject::getControl(ConfigKey("[Channel1]","pfl")));
+ m_pControlObjectRightBtnHeadphoneProxy = new ControlObjectThread(ControlObject::getControl(ConfigKey("[Channel2]","pfl")));
+
+
selectMapping(kqInputMappingHerculesStandard);
m_pRotaryLeft = new Rotary();
Index: src/hercules.h
===================================================================
--- src/hercules.h (revision 1640)
+++ src/hercules.h (working copy)
@@ -79,7 +79,7 @@
*m_pControlObjectRightBtnTrackNext, *m_pControlObjectRightBtnCue, *m_pControlObjectRightBtnPlay,
*m_pControlObjectRightBtnAutobeat, *m_pControlObjectRightBtnMasterTempo, *m_pControlObjectRightBtn1,
*m_pControlObjectRightBtn2, *m_pControlObjectRightBtn3, *m_pControlObjectRightBtnFx;
- ControlObjectThread *m_pControlObjectCrossfade;
+ ControlObjectThread *m_pControlObjectCrossfade;
protected:
@@ -97,7 +97,8 @@
#endif
ControlObjectThread *m_pControlObjectLeftBtnPlayProxy, *m_pControlObjectRightBtnPlayProxy,
- *m_pControlObjectLeftBtnLoopProxy, *m_pControlObjectRightBtnLoopProxy;
+ *m_pControlObjectLeftBtnLoopProxy, *m_pControlObjectRightBtnLoopProxy,
+ *m_pControlObjectLeftBtnHeadphoneProxy, *m_pControlObjectRightBtnHeadphoneProxy;
Rotary *m_pRotaryLeft, *m_pRotaryRight;
ControlObjectThread *m_pControlObjectLeftBeatLoop, *m_pControlObjectRightBeatLoop;
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php
_______________________________________________ Mixxx-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mixxx-devel
