Okay, I replaced SD.h in the location "Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/SD/src/SD.h" I'm still getting the same error when I try to compile. Tried restarting Teensyduino after changing out the file, but it didn't appear to make a difference. Anything else I should check?
For reference here is the complete code I'm using to test this. Just modifying the MidiFileLoop example from the Midi File library to use the built-in SD lib in place of SD fat:
Code:
// Play a file from the SD card in looping mode, from the SD card.
// Example program to demonstrate the use of the MIDFile library
//
// Hardware required:
// SD card interface - change SD_SELECT for SPI comms
#include <SD.h>
#include <MD_MIDIFile.h>
#define USE_MIDI 1 // set to 1 for MIDI output, 0 for debug output
#if USE_MIDI // set up for direct MIDI serial output
#define DEBUGS(s)
#define DEBUG(s, x)
#define DEBUGX(s, x)
#define SERIAL_RATE 31250
#else // don't use MIDI to allow printing debug statements
#define DEBUGS(s) Serial.print(s)
#define DEBUG(s, x) { Serial.print(F(s)); Serial.print(x); }
#define DEBUGX(s, x) { Serial.print(F(s)); Serial.print(x, HEX); }
#define SERIAL_RATE 57600
#endif // USE_MIDI
// SD chip select pin for SPI comms.
// Arduino Ethernet shield, pin 4.
// Default SD chip select is the SPI SS pin (10).
// Other hardware will be different as documented for that hardware.
const uint8_t SD_SELECT = 10;
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
// The files in the tune list should be located on the SD card
// or an error will occur opening the file and the next in the
// list will be opened (skips errors).
const char *loopfile = "LOOPDEMO.MID"; // simple and short file
MD_MIDIFile SMF;
void midiCallback(midi_event *pev)
// Called by the MIDIFile library when a file event needs to be processed
// thru the midi communications interface.
// This callback is set up in the setup() function.
{
#if USE_MIDI
if ((pev->data[0] >= 0x80) && (pev->data[0] <= 0xe0))
{
Serial.write(pev->data[0] | pev->channel);
Serial.write(&pev->data[1], pev->size-1);
}
else
Serial.write(pev->data, pev->size);
#endif
DEBUG("\nM T", pev->track);
DEBUG(": Ch ", pev->channel+1);
DEBUGS(" Data");
for (uint8_t i=0; i<pev->size; i++)
{
DEBUGX(" ", pev->data[i]);
}
}
void setup(void)
{
int err;
Serial.begin(SERIAL_RATE);
DEBUGS("\n[MidiFile Looper]");
// Initialize SD
if (!SD.begin(BUILTIN_SDCARD))
{
DEBUGS("\nSD init fail!");
while (true) ;
}
// Initialize MIDIFile
SMF.begin(&SD);
SMF.setMidiHandler(midiCallback);
SMF.looping(true);
// use the next file name and play it
DEBUG("\nFile: ", loopfile);
err = SMF.load(loopfile);
if (err != MD_MIDIFile::E_OK)
{
DEBUG("\nSMF load Error ", err);
while (true);
}
}
void loop(void)
{
// play the file
if (!SMF.isEOF())
{
SMF.getNextEvent();
}
}