=== modified file 'mixxx/res/midi/midi-mappings-scripts.js'
--- mixxx/res/midi/midi-mappings-scripts.js	2009-03-30 02:49:44 +0000
+++ mixxx/res/midi/midi-mappings-scripts.js	2009-03-31 04:55:00 +0000
@@ -30,17 +30,18 @@
    Output:  Value for a "rate" control, or false if the input MIDI
             message was not a Pitch message (0xE#)
    -------- ------------------------------------------------------ */
-script.pitch = function (channel, device, LSB, MSB, category) {
-    script.debug(channel, device, LSB, MSB, category);
-    if (category != (0xE0 + channel-1)) {
-        print("Script.Pitch: Error, not a MIDI pitch command: "+category);
+script.pitch = function (LSB, MSB, category) {
+    script.debug("none", "none", LSB, MSB, category);
+    if ((category & 0xF0) != 0xE0) {    // Mask the upper nybble so we can check the opcode regardless of the channel
+        print("Script.Pitch: Error, not a MIDI pitch message: "+category);
         return false;
     }
-    var hexValue = (MSB << 7) | LSB;  // Construct the 14-bit number
-    var intValue = parseInt("0x"+hexValue);
-    print("Script.Pitch: MSB="+MSB+", LSB="+LSB+", combined="+hexValue+", as Int="+intValue);
+    var value = (MSB << 7) | LSB;  // Construct the 14-bit number
+    var rate = (value-8192)/8192;
+    //     var intValue = parseInt("0x"+hexValue);
+    print("Script.Pitch: MSB="+MSB+", LSB="+LSB+", value="+value+", rate="+rate);
     // Range is 0x0000..0x3FFF center @ 0x2000, i.e. 0..16383 center @ 8192
-    return (intValue-8192)/8192;
+    return rate;
 }
 
 // ----------------- Scratching functions ---------------------
@@ -185,4 +186,4 @@
 
     return scratch.variables["scratch"];
 }
-// ----------------- END Scratching functions ---------------------
\ No newline at end of file
+// ----------------- END Scratching functions ---------------------

=== modified file 'mixxx/src/midiinputmapping.h'
--- mixxx/src/midiinputmapping.h	2009-02-10 23:42:19 +0000
+++ mixxx/src/midiinputmapping.h	2009-03-31 04:10:09 +0000
@@ -1,7 +1,7 @@
 
 #include <QtCore>
 
-class MidiInputMapping : public QMap<MidiMessage, MixxxControl>
+class MidiInputMapping : public QHash<MidiMessage, MixxxControl>
 {
 	public:
 		MidiInputMapping() {};

=== modified file 'mixxx/src/midimapping.cpp'
--- mixxx/src/midimapping.cpp	2009-03-24 04:16:26 +0000
+++ mixxx/src/midimapping.cpp	2009-03-31 04:21:52 +0000
@@ -552,7 +552,7 @@
 #endif
 
     //Iterate over all of the command/control pairs in the input mapping
-     QMapIterator<MidiMessage, MixxxControl> it(m_inputMapping);
+     QHashIterator<MidiMessage, MixxxControl> it(m_inputMapping);
      while (it.hasNext()) {
          it.next();
          QDomElement controlNode;
@@ -570,7 +570,7 @@
      }
 
      //Iterate over all of the control/command pairs in the OUTPUT mapping
-     QMapIterator<MixxxControl, MidiMessage> outIt(m_outputMapping);
+     QHashIterator<MixxxControl, MidiMessage> outIt(m_outputMapping);
      while (outIt.hasNext()) {
          outIt.next();
          QDomElement outputNode;

=== modified file 'mixxx/src/midimessage.cpp'
--- mixxx/src/midimessage.cpp	2009-03-03 08:07:28 +0000
+++ mixxx/src/midimessage.cpp	2009-03-31 04:42:22 +0000
@@ -133,3 +133,14 @@
     QString hooah = channel + type + midino;
     return hooah;
 }
+
+uint qHash(const MidiMessage& key)
+{
+    if (key.getMidiType() == MIDI_PITCH) { 
+        //Ignore midino for pitch bend messages because those bits are actually part of the 14-bit pitch bend payload.
+        return (key.getMidiType() << 8) | (key.getMidiChannel() << 4); 
+    }
+    else
+        return (key.getMidiType() << 8) | (key.getMidiChannel() << 4) | key.getMidiNo();
+}

=== modified file 'mixxx/src/midimessage.h'
--- mixxx/src/midimessage.h	2009-03-03 08:07:28 +0000
+++ mixxx/src/midimessage.h	2009-03-31 05:41:43 +0000
@@ -23,7 +23,7 @@
         int getMidiByte2Off() const { return m_midiByte2Off; };
         void serializeToXML(QDomElement& parentNode, bool isOutputNode=false) const;
         QString toString() const;
-        bool operator==(MidiMessage& other) {
+        bool operator==(const MidiMessage& other) const {
             return ((m_midiType == other.getMidiType()) &&
                     (m_midiNo == other.getMidiNo()) &&
                     (m_midiChannel == other.getMidiChannel()));
@@ -42,12 +42,16 @@
 
 };
 
+/*
 inline bool operator<(const MidiMessage &first, const MidiMessage &second)
 {
      int firstval = (first.getMidiChannel() * 128) + (int)first.getMidiType() * (128*16) + first.getMidiNo();
      int secondval = (second.getMidiChannel() * 128) + (int)second.getMidiType() * (128*16) + second.getMidiNo();
      return firstval < secondval;
-}
+} */
+
+/** Hash function so we can use MidiMessage in a QHash table */
+uint qHash(const MidiMessage& key);
 
 inline QDataStream& operator<<(QDataStream & stream, const MidiMessage &first)
 {

=== modified file 'mixxx/src/midiobject.h'
--- mixxx/src/midiobject.h	2009-03-28 02:57:41 +0000
+++ mixxx/src/midiobject.h	2009-03-31 04:48:32 +0000
@@ -21,7 +21,7 @@
 #include <QtCore>
 #include "defs.h"
 #include "configobject.h"
-#include "midimessage.h"
+#include "midimessage.h" //MOC doesn't like incomplete type definitions in signals. :(
 
 #ifdef __MIDISCRIPT__
 class MidiScriptEngine;     // Forward declaration

=== modified file 'mixxx/src/midioutputmapping.h'
--- mixxx/src/midioutputmapping.h	2009-02-10 23:42:19 +0000
+++ mixxx/src/midioutputmapping.h	2009-03-31 04:10:19 +0000
@@ -1,7 +1,7 @@
 
 #include <QtCore>
 
-class MidiOutputMapping : public QMap<MixxxControl, MidiMessage>
+class MidiOutputMapping : public QHash<MixxxControl, MidiMessage>
 {
 	public:
 		MidiOutputMapping() {};

=== modified file 'mixxx/src/mixxxcontrol.cpp'
--- mixxx/src/mixxxcontrol.cpp	2009-02-28 22:20:46 +0000
+++ mixxx/src/mixxxcontrol.cpp	2009-03-31 04:41:16 +0000
@@ -156,3 +156,9 @@
         parentNode.appendChild(tagNode);
     }
 }
+
+
+uint qHash(const MixxxControl& key)
+{
+    return (qHash(key.getControlObjectGroup() + key.getControlObjectValue()));
+}

=== modified file 'mixxx/src/mixxxcontrol.h'
--- mixxx/src/mixxxcontrol.h	2009-03-14 18:55:52 +0000
+++ mixxx/src/mixxxcontrol.h	2009-03-31 05:40:50 +0000
@@ -24,7 +24,7 @@
         float getThresholdMinimum() const { return m_thresholdMinimum; };
         float getThresholdMaximum() const { return m_thresholdMaximum; };
         void serializeToXML(QDomElement& parentNode, bool isOutputNode=false) const;
-        bool operator==(MixxxControl& other) {
+        bool operator==(const MixxxControl& other) const {
             return ((m_strCOGroup == other.getControlObjectGroup()) &&
                     (m_strCOValue == other.getControlObjectValue()) &&
                     (m_midiOption == other.getMidiOption()));
@@ -42,14 +42,8 @@
         float m_thresholdMaximum; 
 };
 
-inline bool operator<(const MixxxControl &first, const MixxxControl &second)
-{
-     //int firstval = (first.getMidiChannel() * 128) + (int)first.getMidiType() * (128*16) + first.getMidiNo();
-     //int secondval = (second.getMidiChannel() * 128) + (int)second.getMidiType() * (128*16) + second.getMidiNo();
-     //return firstval < secondval;
-     return ((first.getControlObjectGroup() + first.getControlObjectValue()) < 
-              (second.getControlObjectGroup() + second.getControlObjectValue()));
-}
+/** Hash function needed so we can use MixxxControl in a QHash table */
+uint qHash(const MixxxControl& key);
 
 /*
 QDebug operator<<(QDebug dbg, MixxxControl& control)

