On Friday 07 December 2007 22:54:33 Robin Sheat wrote:
> There is a patch against SVN (r1633) attached.
Try this patch instead actually, it has a bit of debugging code removed that I 
missed on my first pass.

-- 
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;
+	}
     }
 }
 
@@ -181,31 +189,35 @@
     if (iR == sizeof(struct input_event))
     {
         //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 v = (double)ev.value / 255.;
+	    //double v = (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, v is %5.3f",ev.type,ev.code,ev.value,v);
         switch(ev.type)
         {
         case EV_ABS:
-            //qDebug("code %i",ev.code);
             int iDiff;
             double dDiff;
 
             switch (ev.code)
             {
             case kiHerculesLeftTreble:
-                sendEvent(v, m_pControlObjectLeftTreble);
+                sendEvent(v*4, m_pControlObjectLeftTreble);
                 break;
             case kiHerculesLeftMiddle:
-                sendEvent(v, m_pControlObjectLeftMiddle);
+                sendEvent(v*4, m_pControlObjectLeftMiddle);
                 break;
             case kiHerculesLeftBass:
-                sendEvent(v, m_pControlObjectLeftBass);
+                sendEvent(v*4, 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(v, m_pControlObjectLeftVolume);
                 break;
             case kiHerculesLeftPitch:
                 //qDebug("");
@@ -222,24 +234,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(v*4, m_pControlObjectRightTreble);
                 break;
             case kiHerculesRightMiddle:
-                sendEvent(v, m_pControlObjectRightMiddle);
+                sendEvent(v*4, m_pControlObjectRightMiddle);
                 break;
             case kiHerculesRightBass:
-                sendEvent(v, m_pControlObjectRightBass);
+                sendEvent(v*4, 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(v, m_pControlObjectRightVolume);
                 break;
             case kiHerculesRightPitch:
-                //qDebug("");
                 sendEvent(PitchChange("Right", ev.value, m_iPitchRight, m_iPitchOffsetRight), m_pControlObjectRightPitch);
                 break;
             case kiHerculesRightJog:
@@ -257,7 +267,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(v*2.0-1.0, m_pControlObjectCrossfade);
                 break;
 //              default:
 //                  sendEvent(0., m_pControlObjectLeftJog);
@@ -287,8 +298,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:
@@ -328,8 +338,8 @@
  */
                     break;
                 case kiHerculesLeftBtnHeadphone:
-                    sendButtonEvent(true, m_pControlObjectLeftBtnHeadphone);
-                    m_bHeadphoneLeft = !m_bHeadphoneLeft;
+                    sendButtonEvent(!m_bHeadphoneLeft, m_pControlObjectLeftBtnHeadphone);
+                    //m_bHeadphoneLeft = !m_bHeadphoneLeft;
                     led_write(kiHerculesLedLeftHeadphone, m_bHeadphoneLeft);
                     break;
                 case kiHerculesRightBtnPitchBendMinus:
@@ -350,7 +360,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,8 +412,8 @@
 
                     break;
                 case kiHerculesRightBtnHeadphone:
-                    sendButtonEvent(true, m_pControlObjectRightBtnHeadphone);
-                    m_bHeadphoneRight = !m_bHeadphoneRight;
+                    sendButtonEvent(!m_bHeadphoneRight, m_pControlObjectRightBtnHeadphone);
+                    //m_bHeadphoneRight = !m_bHeadphoneRight;
                     //led_write(kiHerculesLedRightHeadphone, m_bHeadphoneRight);
                     break;
                 }
@@ -430,7 +440,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 +467,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 +487,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 +514,8 @@
                     sendButtonEvent(false, m_pControlObjectRightBtnFx);
                     break;
                 case kiHerculesRightBtnHeadphone:
-                    sendButtonEvent(false, m_pControlObjectRightBtnHeadphone);
+                    //sendButtonEvent(false, m_pControlObjectRightBtnHeadphone);
+                    break;
                 }
             }
             break;
@@ -611,7 +623,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;
 

Attachment: 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

Reply via email to