FYI There is a problem with "src/midiobject.cpp:44: error: 'ScriptEngine'
was not declared in this scope" during the midiobject constructor.
#ifdef __SCRIPT__
ConfigObject<ConfigValue> *m_pConfig = new
ConfigObject<ConfigValue>(QDir::homePath().append("/").append(SETTINGS_FILE));
44 >>> ScriptEngine = new
MidiScriptEngine(m_pConfig->getConfigPath().append("/midi/midi-mappings-scripts.js"));
#endif
__
--- == __/ t.O ==--
http://stacktrace.org/
On Wed, Dec 17, 2008 at 1:00 AM, Garth Dahlstrom <[email protected]> wrote:
> committed
>
> * adds a function to midiobjectalsaseq that allows sending of system
> exclusive messages of arbitrary length (and a corresponding virtual function
> in midiobject)
> * Corrects a depreciated #include in midiobjectalsa.h
> * Added a few #ifdef __SCRIPT__ for good measure
> * TODO: implement equiv sendSysexMsg on Windows / OSX
>
> __
> --- == __/ t.O ==--
> http://stacktrace.org/
>
>
> On Tue, Dec 16, 2008 at 6:52 PM, Sean M. Pappalardo <
> [email protected]> wrote:
>
>> Hello.
>>
>> Attached is a patch that:
>>
>> - adds a function to midiobjectalsaseq that allows sending of system
>> exclusive messages of arbitrary length (and a corresponding virtual
>> function in midiobject)
>> - Corrects a depreciated #include in midiobjectalsa.h
>>
>> Sincerely,
>> Sean M. Pappalardo
>>
>>
>> <<--------------------------------------------------------------------------------->>
>> This E-Mail message has been scanned for viruses
>> and cleared by >>SmartMail<< from Smarter Technology, Inc.
>>
>> <<--------------------------------------------------------------------------------->>
>>
>> Index: src/midiobjectalsaseq.cpp
>> ===================================================================
>> --- src/midiobjectalsaseq.cpp (revision 2430)
>> +++ src/midiobjectalsaseq.cpp (working copy)
>> @@ -343,13 +343,29 @@
>>
>> // Decide which event type to choose
>> switch ((byte1 & 0xf0)) {
>> - case 0x90:
>> + case 0x90: // Note on/off
>> snd_seq_ev_set_noteon(&ev, byte1&0xf, byte2, byte3);
>> - snd_seq_event_output_direct(m_handle, &ev);
>> - break;
>> - case 0xb0:
>> - snd_seq_ev_set_controller(&ev, byte1&0xf, byte2, byte3);
>> - snd_seq_event_output_direct(m_handle, &ev);
>> - break;
>> + snd_seq_event_output_direct(m_handle, &ev);
>> + break;
>> + case 0xb0: // Control Change
>> + snd_seq_ev_set_controller(&ev, byte1&0xf, byte2, byte3);
>> + snd_seq_event_output_direct(m_handle, &ev);
>> + break;
>> }
>> }
>> +
>> +// The sysex data must already contain the start byte 0xf0 and the end
>> byte 0xf7.
>> +void MidiObjectALSASeq::sendSysexMsg(unsigned char data[], unsigned int
>> length) {
>> + snd_seq_event_t ev;
>> +
>> + // Initialize the event structure
>> + snd_seq_ev_set_direct(&ev);
>> + snd_seq_ev_set_source(&ev, m_input);
>> +
>> + // Send to all subscribers
>> + snd_seq_ev_set_dest(&ev, SND_SEQ_ADDRESS_SUBSCRIBERS, 0);
>> +
>> + // Do it
>> + snd_seq_ev_set_sysex(&ev,length,data);
>> + snd_seq_event_output_direct(m_handle, &ev);
>> +}
>> \ No newline at end of file
>> Index: src/midiobjectalsa.h
>> ===================================================================
>> --- src/midiobjectalsa.h (revision 2430)
>> +++ src/midiobjectalsa.h (working copy)
>> @@ -19,7 +19,7 @@
>> #define MIDIOBJECTALSA_H
>>
>> #include <midiobject.h>
>> -#include <sys/asoundlib.h>
>> +#include <alsa/asoundlib.h>
>>
>> /**
>> *...@author Tue & Ken Haste Andersen
>> Index: src/midiobjectalsaseq.h
>> ===================================================================
>> --- src/midiobjectalsaseq.h (revision 2430)
>> +++ src/midiobjectalsaseq.h (working copy)
>> @@ -33,6 +33,7 @@
>> void devOpen(QString device);
>> void devClose(QString device);
>> void sendShortMsg(unsigned int word);
>> + void sendSysexMsg(unsigned char data[], unsigned int length);
>> protected:
>> void run();
>>
>> Index: src/midiobject.cpp
>> ===================================================================
>> --- src/midiobject.cpp (revision 2430)
>> +++ src/midiobject.cpp (working copy)
>> @@ -22,8 +22,8 @@
>> #include <signal.h>
>> #include "dlgprefmididevice.h"
>> #include "dlgprefmidibindings.h"
>> +#include "script/midiscriptengine.h"
>>
>> -
>> /* -------- ------------------------------------------------------
>> Purpose: Initialize midi, and start parsing loop
>> Input: None. Automatically selects default midi input sound
>> @@ -262,59 +281,66 @@
>> }
>>
>> void MidiObject::sendShortMsg(unsigned char status, unsigned char byte1,
>> unsigned char byte2, QString device) {
>> - if (!TxEnabled[device]) return;
>> + if (!TxEnabled[device]) return;
>> unsigned int word = (((unsigned int)byte2) << 16) |
>> (((unsigned int)byte1) << 8) | status;
>> sendShortMsg(word);
>> }
>>
>> void MidiObject::sendShortMsg(unsigned int /* word */) {
>> - // This warning comes out rather frequently now we're using LEDs
>> with VuMeters
>> + // This warning comes out rather frequently now we're using LEDs with
>> VuMeters
>> //qDebug() << "MIDI message sending not implemented yet on this
>> platform";
>> }
>>
>> +void MidiObject::sendSysexMsg(unsigned char data[], unsigned int length)
>> {
>> + qDebug() << "MIDI system exclusive message sending not yet
>> implemented on this platform";
>> +}
>> +
>> bool MidiObject::getRxStatus(QString device) {
>> - return RxEnabled[device];
>> + return RxEnabled[device];
>> }
>>
>> bool MidiObject::getTxStatus(QString device) {
>> - return TxEnabled[device];
>> + return TxEnabled[device];
>> }
>>
>> void MidiObject::setRxStatus(QString device, bool status) {
>> - RxEnabled[device] = status;
>> + RxEnabled[device] = status;
>> }
>>
>> void MidiObject::setTxStatus(QString device, bool status) {
>> - TxEnabled[device] = status;
>> + TxEnabled[device] = status;
>> }
>>
>> bool MidiObject::getDebugStatus() {
>> - return debug;
>> + return debug;
>> }
>>
>> void MidiObject::enableDebug(DlgPrefMidiDevice *dlgDevice) {
>> - debug = true;
>> - this->dlgDevice = dlgDevice;
>> - connect(this, SIGNAL(debugInfo(ConfigValueMidi *, QString)),
>> dlgDevice, SLOT(slotDebug(ConfigValueMidi *, QString)));
>> + debug = true;
>> + this->dlgDevice = dlgDevice;
>> + connect(this, SIGNAL(debugInfo(ConfigValueMidi *, QString)),
>> dlgDevice, SLOT(slotDebug(ConfigValueMidi *, QString)));
>> }
>>
>> void MidiObject::disableDebug() {
>> - debug = false;
>> + debug = false;
>> }
>>
>> bool MidiObject::getMidiLearnStatus() {
>> - return midiLearn;
>> + return midiLearn;
>> }
>>
>> void MidiObject::enableMidiLearn(DlgPrefMidiBindings *dlgBindings) {
>> - midiLearn = true;
>> - this->dlgBindings = dlgBindings;
>> - connect(this, SIGNAL(midiEvent(ConfigValueMidi *, QString)),
>> dlgBindings, SLOT(singleLearn(ConfigValueMidi *, QString)));
>> - connect(this, SIGNAL(midiEvent(ConfigValueMidi *, QString)),
>> dlgBindings, SLOT(groupLearn(ConfigValueMidi *, QString)));
>> + midiLearn = true;
>> + this->dlgBindings = dlgBindings;
>> + connect(this, SIGNAL(midiEvent(ConfigValueMidi *, QString)),
>> dlgBindings, SLOT(singleLearn(ConfigValueMidi *, QString)));
>> + connect(this, SIGNAL(midiEvent(ConfigValueMidi *, QString)),
>> dlgBindings, SLOT(groupLearn(ConfigValueMidi *, QString)));
>> }
>>
>> void MidiObject::disableMidiLearn() {
>> - midiLearn = false;
>> + midiLearn = false;
>> }
>>
>> +MidiScriptEngine * MidiObject::getMidiScriptEngine() {
>> + return m_pScriptEngine;
>> +}
>> \ No newline at end of file
>> Index: src/midiobject.h
>> ===================================================================
>> --- src/midiobject.h (revision 2430)
>> +++ src/midiobject.h (working copy)
>> @@ -23,7 +23,7 @@
>> #include "configobject.h"
>>
>> #ifdef __SCRIPT__
>> -#include "script/midiscriptengine.h"
>> +class MidiScriptEngine; // Forward declaration
>> #endif
>>
>> class ControlObject;
>> @@ -45,7 +45,7 @@
>>
>> class MidiObject : public QThread
>> {
>> - Q_OBJECT
>> + Q_OBJECT
>>
>> public:
>> MidiObject();
>> @@ -53,7 +53,7 @@
>> void setMidiConfig(ConfigObject<ConfigValueMidi> *pMidiConfig);
>> void reopen(QString device);
>> virtual void devOpen(QString) = 0;
>> - virtual void updateDeviceList() {};
>> + virtual void updateDeviceList() {};
>> virtual void devClose(QString) = 0;
>> void add(ControlObject* c);
>> void remove(ControlObject* c);
>> @@ -65,27 +65,26 @@
>> * containing the configuration files */
>> QStringList *getConfigList(QString path);
>>
>> -#ifdef __SCRIPT__
>> - MidiScriptEngine *ScriptEngine;
>> -#endif
>> + // Stuff for sending messages to control leds etc
>> + void sendShortMsg(unsigned char status, unsigned char byte1, unsigned
>> char byte2, QString device);
>> + virtual void sendShortMsg(unsigned int word);
>> + virtual void sendSysexMsg(unsigned char data[], unsigned int length);
>>
>> - // Stuff for sending messages to control leds etc
>> - void sendShortMsg(unsigned char status, unsigned char byte1,
>> unsigned char byte2, QString device);
>> - virtual void sendShortMsg(unsigned int word);
>> + // Rx/Tx Toggle Functions
>> + bool getRxStatus(QString device);
>> + bool getTxStatus(QString device);
>> + void setRxStatus(QString device, bool status);
>> + void setTxStatus(QString device, bool status);
>> + bool getDebugStatus();
>> + void enableDebug(DlgPrefMidiDevice *dlgDevice);
>> + void disableDebug();
>>
>> - // Rx/Tx Toggle Functions
>> - bool getRxStatus(QString device);
>> - bool getTxStatus(QString device);
>> - void setRxStatus(QString device, bool status);
>> - void setTxStatus(QString device, bool status);
>> - bool getDebugStatus();
>> - void enableDebug(DlgPrefMidiDevice *dlgDevice);
>> - void disableDebug();
>> + bool getMidiLearnStatus();
>> + void enableMidiLearn(DlgPrefMidiBindings *dlgBindings);
>> + void disableMidiLearn();
>> +
>> + MidiScriptEngine *getMidiScriptEngine();
>>
>> - bool getMidiLearnStatus();
>> - void enableMidiLearn(DlgPrefMidiBindings *dlgBindings);
>> - void disableMidiLearn();
>> -
>> signals:
>> void midiEvent(ConfigValueMidi *value, QString device);
>> void debugInfo(ConfigValueMidi *event, QString device);
>> @@ -114,6 +113,10 @@
>> DlgPrefMidiDevice *dlgDevice;
>> // Pointer to bindings dialog (for MIDI learn)
>> DlgPrefMidiBindings *dlgBindings;
>> +
>> +#ifdef __SCRIPT__
>> + MidiScriptEngine *m_pScriptEngine;
>> +#endif
>> };
>>
>> void abortRead(int);
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>>
>>
>
------------------------------------------------------------------------------
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