On Friday 07 December 2007 02:39:31 you wrote:
> I remember having a problem where buttons would double send (once on down
> and once again on release).
It turns out that it's not actually that, what was happening was the 'down' 
event was being caught, and setting the play state (or whatever) to true, and 
then the 'up' event was getting caught and setting the play state to false. 
I've changed it so that it only catches the down event, and that makes it 
toggle the play state.

There is a patch against SVN (r1633) attached.

What this does:
* Sliders and knobs work, but in a very non-linear fashion. It is sending 
good-seeming values to the system (0.5 for half way, etc), but mixxx treats 
0.5 as though it's more like 0.65 or something. I saw a few formulas in the 
code that look like they are supposed to deal with this, but none did to my 
satisfaction. I plan on playing with this more, although pointers are 
welcome. It looks like a conscious decision to do it like this.
* Buttons that change a state, e.g. play/pause and headphone don't only work 
when held down, they toggle correctly (and relative to the GUI).

Everything else seems to work like it did in 1.5.

After looking at the sliders etc, I might see if I can make the jog dials work 
better. Any thoughts on how to approach that?

-- 
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 1633)
+++ 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,36 @@
     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);
+            qDebug("code EV_ABS");
             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("");
@@ -225,21 +238,20 @@
                 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 +269,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);
@@ -265,6 +278,7 @@
             }
             break;
         case EV_KEY:
+	    qDebug("Code EV_KEY");
             if (ev.value==1)
             {
                 switch (ev.code)
@@ -287,8 +301,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 +341,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 +363,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 +415,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 +443,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 +470,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 +490,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 +517,8 @@
                     sendButtonEvent(false, m_pControlObjectRightBtnFx);
                     break;
                 case kiHerculesRightBtnHeadphone:
-                    sendButtonEvent(false, m_pControlObjectRightBtnHeadphone);
+                    //sendButtonEvent(false, m_pControlObjectRightBtnHeadphone);
+                    break;
                 }
             }
             break;
@@ -611,7 +626,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 1633)
+++ 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 1633)
+++ 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