Hello.
Attached is a patch to allow an arbitrary third byte to be sent to MIDI
controllers which is needed to light LEDs on other than Hercules
controllers. The XML spec has been changed as well and I already
modified the wiki to reflect this. Existing XML files will work as
before, since if <on> and <off> tags aren't specified, the previous
fixed values of 0x7F and 0x00 are used by default.
I tested this on 1.6.1 and it works correctly. I can't yet test on trunk
since MidiLedHandler is not called for some reason since the merge of
Tom's branch. (See the previous message I sent to the list for more on
this.)
Thanks for your time.
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: src/midiledhandler.h
===================================================================
--- src/midiledhandler.h (revision 2405)
+++ src/midiledhandler.h (working copy)
@@ -14,7 +14,7 @@
Q_OBJECT
public:
MidiLedHandler(QString group, QString name, MidiObject* midi, double min, double max,
- unsigned char status, unsigned char byte1, QString device);
+ unsigned char status, unsigned char byte1, QString device, unsigned char on, unsigned char off);
~MidiLedHandler();
static void createHandlers(QDomNode node, MidiObject* midi, QString device);
@@ -32,6 +32,8 @@
unsigned char m_status;
unsigned char m_byte1;
QString m_device;
+ unsigned char m_on;
+ unsigned char m_off;
};
#endif
Index: src/midiledhandler.cpp
===================================================================
--- src/midiledhandler.cpp (revision 2405)
+++ src/midiledhandler.cpp (working copy)
@@ -7,8 +7,8 @@
Q3PtrList<MidiLedHandler> MidiLedHandler::allhandlers = Q3PtrList<MidiLedHandler>();
MidiLedHandler::MidiLedHandler(QString group, QString name, MidiObject * midi, double min,
- double max, unsigned char status, unsigned char byte1, QString device)
- : m_min(min), m_max(max), m_midi(midi), m_status(status), m_byte1(byte1), m_device(device) {
+ double max, unsigned char status, unsigned char byte1, QString device, unsigned char on, unsigned char off)
+ : m_min(min), m_max(max), m_midi(midi), m_status(status), m_byte1(byte1), m_device(device), m_on(on), m_off(off) {
//OMGWTFBBQ: Massive hack to temporarily fix LP #254564 for the 1.6.0 release.
// Something's funky with our <lights> blocks handling? -- Albert 08/05/2008
@@ -28,10 +28,12 @@
}
void MidiLedHandler::controlChanged(double value) {
- unsigned char m_byte2 = 0x00;
- if (value >= m_min && value <= m_max) { m_byte2 = 0x7f; }
+ unsigned char m_byte2 = m_off;
+ if (value >= m_min && value <= m_max) { m_byte2 = m_on; }
- m_midi->sendShortMsg(m_status, m_byte1, m_byte2, m_device);
+ if (m_byte2 != 0xff) {
+ //qDebug() << "MIDI bytes:" << m_status << ", " << m_byte1 << ", " << m_byte2;
+ m_midi->sendShortMsg(m_status, m_byte1, m_byte2, m_device); }
}
void MidiLedHandler::createHandlers(QDomNode node, MidiObject * midi, QString device) {
@@ -46,20 +48,28 @@
unsigned char status = (unsigned char)WWidget::selectNodeInt(light, "status");
unsigned char midino = (unsigned char)WWidget::selectNodeInt(light, "midino");
- float min = 0.0f;
- float max = 1.0f;
- if (!light.firstChildElement("threshold").isNull()) {
- min = WWidget::selectNodeFloat(light, "threshold");
- }
- if (!light.firstChildElement("minimum").isNull()) {
- min = WWidget::selectNodeFloat(light, "minimum");
- }
- if (!light.firstChildElement("maximum").isNull()) {
- max = WWidget::selectNodeFloat(light, "maximum");
- }
+ unsigned char on = 0x7f; // Compatible with Hercules and others
+ unsigned char off = 0x00;
+ float min = 0.0f;
+ float max = 1.0f;
+ if (!light.firstChildElement("on").isNull()) {
+ on = (unsigned char)WWidget::selectNodeInt(light, "on");
+ }
+ if (!light.firstChildElement("off").isNull()) {
+ off = (unsigned char)WWidget::selectNodeInt(light, "off");
+ }
+ if (!light.firstChildElement("threshold").isNull()) {
+ min = WWidget::selectNodeFloat(light, "threshold");
+ }
+ if (!light.firstChildElement("minimum").isNull()) {
+ min = WWidget::selectNodeFloat(light, "minimum");
+ }
+ if (!light.firstChildElement("maximum").isNull()) {
+ max = WWidget::selectNodeFloat(light, "maximum");
+ }
- allhandlers.append(new MidiLedHandler(group, key, midi, min, max, status, midino, device));
- }
+ allhandlers.append(new MidiLedHandler(group, key, midi, min, max, status, midino, device, on, off));
+ }
light = light.nextSibling();
}
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel