Hello.

Attached is a patch that detects the <Script-Binding/> tag in the XML
and makes a spot to call the QtScript function given in the <key> tag. I
don't know how to actually do that, so it's just a qDebug and a
pseudocode comment for now, so if someone who knows how to handle
QtScript could fill that in, that'd be great.

Sincerely,
Sean M. Pappalardo
"D.J. Pegasus"

<<--------------------------------------------------------------------------------->>
This E-Mail message has been scanned for viruses
and cleared by >>SmartMail<< from Smarter Technology, Inc.
<<--------------------------------------------------------------------------------->>
Index: midiobject.cpp
===================================================================
--- midiobject.cpp	(revision 2416)
+++ midiobject.cpp	(working copy)
@@ -182,9 +182,18 @@
     if (!pConfigKey) return; // No configuration was retrieved for this input event, eject.
     // qDebug() << "MidiObject::receive ok" << pConfigKey->group << pConfigKey->item;
 
+    ConfigOption<ConfigValueMidi> *c = m_pMidiConfig->get(*pConfigKey);
+
+    // Custom MixxxScript (QtScript) handler
+    if (((ConfigValueMidi *)c->val)->midioption==MIDI_OPT_SCRIPT) {
+        qDebug() << "MidiObject::Calling script" << pConfigKey->item;
+//      call {pConfigKey->item}(category, channel, control, value, device);
+        return;
+    }
+
     ControlObject * p = ControlObject::getControl(*pConfigKey);
-    ConfigOption<ConfigValueMidi> *c = m_pMidiConfig->get(*pConfigKey);
     // qDebug() << "MidiObject::receive value:" << QString::number(value, 16).toUpper() << " c:" << c << "c->midioption:" << ((ConfigValueMidi *)c->val)->midioption << "p:" << p;
+
     // BJW: Apply any mapped (7-bit integer) translations
     if (c && p) {
         value = ((ConfigValueMidi *)c->val)->translateValue(value);
Index: configobject.cpp
===================================================================
--- configobject.cpp	(revision 2416)
+++ configobject.cpp	(working copy)
@@ -180,6 +180,9 @@
             midioption = MIDI_OPT_SPREAD64;
         else if (optname == "selectknob")
         	midioption = MIDI_OPT_SELECTKNOB;
+        
+        else if (optname == "script-binding")
+        	midioption = MIDI_OPT_SCRIPT;
         else {
             qWarning() << "Unknown option:" << optname;
             midioption = MIDI_OPT_NORMAL;
@@ -243,6 +246,9 @@
         midioption = MIDI_OPT_SPREAD64;
     else if (option.contains("SelectKnob", false))
         midioption = MIDI_OPT_SELECTKNOB;
+        
+    else if (option.contains("Script-Binding", false))
+        midioption = MIDI_OPT_SCRIPT;
     else
         midioption = MIDI_OPT_NORMAL;
     // Store string with corrected config value
Index: configobject.h
===================================================================
--- configobject.h	(revision 2416)
+++ configobject.h	(working copy)
@@ -47,6 +47,8 @@
     MIDI_OPT_HERC_JOG         = 8, // Generic hercules wierd range correction
     MIDI_OPT_SPREAD64         = 9, // Accelerated difference from 64
     MIDI_OPT_SELECTKNOB       = 10,// Relative knob which can be turned forever and outputs a signed value.
+    
+    MIDI_OPT_SCRIPT           = 50,// Maps a MIDI control to a custom MixxxScript function
 } MidiOption;
 
 typedef QMap<char,char> MidiValueMap;
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to