USB-MIDI to Legacy Serial MIDI converter trouble

Dear people at the arduino forum,

I'm having some problems trying to run the sketch below. I'm using IDE 1.6.5 and can't seem to get rid of these errors...The sketch need to be uploaded to an arduino uno.

/*
*******************************************************************************
* USB-MIDI to Legacy Serial MIDI converter
*
* Idea from LPK25 USB-MIDI to Serial MIDI converter
*   by Collin Cunningham - makezine.com
*******************************************************************************
*/

#include <Usb.h>
#include <usbhub.h>
#include <usbh_midi.h>

USB  Usb;
USBHub  Hub1(&Usb);
MIDI  Midi1(&Usb);
MIDI  Midi2(&Usb);

void MIDI_poll();
void doDelay(unsigned long t1, unsigned long t2, unsigned long delayTime);

void setup()
{
  Serial.begin(31250);

  if (Usb.Init() == -1) {
    while(1); //halt
  }
  delay(200);
}

void loop()
{
  unsigned long t1;

  Usb.Task();
  t1 = micros();
  if( Usb.getUsbTaskState() == USB_STATE_RUNNING )
  {
    MIDI_poll();
  }
  doDelay(t1, micros(), 10);
}

// Poll USB MIDI Controler and send to serial MIDI
void MIDI_poll()
{
    byte outBuf[ 3 ];
    uint8_t size;

    if( (size=Midi1.RcvData(outBuf)) > 0 ){
      //MIDI Output
      Serial.write(outBuf, size);
    }
    if( (size=Midi2.RcvData(outBuf)) > 0 ){
      //MIDI Output
      Serial.write(outBuf, size);
    }    
}

// Delay time (max 16383 us)
void doDelay(unsigned long t1, unsigned long t2, unsigned long delayTime)
{
    unsigned long t3;

    if( t1 > t2 ){
      t3 = (4294967295 - t1 + t2);
    }else{
      t3 = t2 - t1;
    }

    if( t3 < delayTime ){
      delayMicroseconds(delayTime - t3);
    }
}

The error I receive:

In file included from /Users/Ondes/Documents/Arduino/libraries/USB_Host_Shield_2.0-master/Usb.h:27:0,

  • from test.ino:10:*
    /Users/Ondes/Documents/Arduino/libraries/USB_Host_Shield_2.0-master/settings.h:139:176: fatal error: SPI.h: No such file or directory
    #include <SPI.h> // Use the Arduino SPI library for the Arduino Due, RedBearLab nRF51822, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available
  • ^*
    compilation terminated.

so logically I add #include <SPI.h>

/*
*******************************************************************************
* USB-MIDI to Legacy Serial MIDI converter
*
* Idea from LPK25 USB-MIDI to Serial MIDI converter
*   by Collin Cunningham - makezine.com
*******************************************************************************
*/

#include <Usb.h>
#include <usbhub.h>
#include <usbh_midi.h>
#include <SPI.h>

USB  Usb;
USBHub  Hub1(&Usb);
MIDI  Midi1(&Usb);
MIDI  Midi2(&Usb);

void MIDI_poll();
void doDelay(unsigned long t1, unsigned long t2, unsigned long delayTime);

void setup()
{
  Serial.begin(31250);

  if (Usb.Init() == -1) {
    while(1); //halt
  }
  delay(200);
}

void loop()
{
  unsigned long t1;

  Usb.Task();
  t1 = micros();
  if( Usb.getUsbTaskState() == USB_STATE_RUNNING )
  {
    MIDI_poll();
  }
  doDelay(t1, micros(), 10);
}

// Poll USB MIDI Controler and send to serial MIDI
void MIDI_poll()
{
    byte outBuf[ 3 ];
    uint8_t size;

    if( (size=Midi1.RcvData(outBuf)) > 0 ){
      //MIDI Output
      Serial.write(outBuf, size);
    }
    if( (size=Midi2.RcvData(outBuf)) > 0 ){
      //MIDI Output
      Serial.write(outBuf, size);
    }    
}

// Delay time (max 16383 us)
void doDelay(unsigned long t1, unsigned long t2, unsigned long delayTime)
{
    unsigned long t3;

    if( t1 > t2 ){
      t3 = (4294967295 - t1 + t2);
    }else{
      t3 = t2 - t1;
    }

    if( t3 < delayTime ){
      delayMicroseconds(delayTime - t3);
    }
}

but then this happens:

test:17: error: 'MIDI' does not name a type
test:18: error: 'MIDI' does not name a type
test.ino: In function 'void MIDI_poll()':
test:52: error: 'Midi1' was not declared in this scope
test:56: error: 'Midi2' was not declared in this scope
'MIDI' does not name a type

If someone has the slightest clue of what to do please help! In my library folder are included both:
-USB_Host_Shield_2.0-master
-USBH_Midi-master

First thing I would try is to put "#include <SPI.h>" before "#include <Usb.h>".

Thank you for your reply but that didn't work.
The solution is to use USBH_MIDI Midi1(&Usb);