Include stripped down libsmf code internally.
[ardour.git] / libs / midi++2 / midiparser.cc
index a1f6ce39b43ad73c9033bf67683c3e8922120c9d..4cbcd2769464ca4a4027143cf8370d581ad324dc 100644 (file)
     $Id$
 */
 
+#include <cstring>
 #include <cstdlib>
 #include <unistd.h>
-#include <string>
+#include <cstring>
 #include <iostream>
 #include <iterator>
 
@@ -215,7 +216,7 @@ Parser::trace_event (Parser &p, byte *msg, size_t len)
                   << "Channel "
                   << (msg[0]&0xF)+1
                   << " Pitch Bend "
-                  << ((msg[1]<<7)|msg[2])
+                  << ((msg[2]<<7)|msg[1])
                   << endmsg;
                break;
            
@@ -313,6 +314,7 @@ Parser::trace (bool onoff, ostream *o, const string &prefix)
        trace_connection.disconnect ();
 
        if (onoff) {
+               cerr << "enabling tracing for port " << _port.name() << endl;
                trace_stream = o;
                trace_prefix = prefix;
                trace_connection = any.connect (mem_fun (*this, &Parser::trace_event));
@@ -536,16 +538,16 @@ Parser::realtime_msg(unsigned char inbyte)
 
        switch (inbyte) {
        case 0xf8:
-               timing (*this);
+               timing (*this, _midi_clock_timestamp);
                break;
        case 0xfa:
-               start (*this);
+               start (*this, _midi_clock_timestamp);
                break;
        case 0xfb:
-               contineu (*this);
+               contineu (*this, _midi_clock_timestamp);
                break;
        case 0xfc:
-               stop (*this);
+               stop (*this, _midi_clock_timestamp);
                break;
        case 0xfe:
                /* !!! active sense message in realtime_msg: should not reach here
@@ -718,8 +720,8 @@ Parser::signal (byte *msg, size_t len)
                
        case MIDI::pitchbend:
                channel_active_preparse[chan_i] (*this);
-               pitchbend (*this, (msg[1]<<7)|msg[2]);
-               channel_pitchbend[chan_i] (*this, (msg[1]<<7)|msg[2]);
+               pitchbend (*this, (msg[2]<<7)|msg[1]);
+               channel_pitchbend[chan_i] (*this, (msg[2]<<7)|msg[1]);
                channel_active_postparse[chan_i] (*this);
                break;