  * Load the given RAD file from SD card.
  */
 void loadRadFile(char* fileName) {
-  radFile.open(fileName);
-
-  radFile.seekSet(0x11);
-  byte songProps = radFile.read();
-  hasSlowTimer = (songProps & 0x40) != 0x00;
-  initialSpeed = songProps & 0x1F;
-
-  // Skip song description block if available.
-  if ((songProps & 0x80) != 0x00) {
-    while (radFile.read() != 0x00);
-  }
-
-  // Read instruments.
-  byte instrumentNum = 0;
-  while ((instrumentNum = radFile.read()) != 0x00) {
-    instrumentNum --;
-    for (byte i = 0; i < 9; i ++) {
-      instruments[instrumentNum][i] = radFile.read();
-    }
-    instruments[instrumentNum][9]  =  radFile.read() & 0x07;
-    instruments[instrumentNum][9] += (radFile.read() & 0x07) << 4;
-  }
-
-  // Read song length, order list offset and skip order list.
-  songLength = radFile.read();
-  orderListOffset = radFile.curPosition();
-  radFile.seekSet(orderListOffset + songLength);
-
-  // Read pattern offsets.
-  for (byte i = 0; i < 32; i++) {
-    patternOffsets[i] = radFile.read() + (radFile.read() << 8);
-  }
-}
+	radFile.open(fileName);
+
+	radFile.seekSet(0x11);
+	byte songProps = radFile.read();
+	hasSlowTimer = (songProps & 0x40) != 0x00;
+	initialSpeed = songProps & 0x1F;
+
+	// Skip song description block if available.
+	if ((songProps & 0x80) != 0x00) {
+		while (radFile.read() != 0x00);
+	}
+
+	// Read instruments.
+	byte instrumentNum = 0;
+	while ((instrumentNum = radFile.read()) != 0x00) {
+		instrumentNum --;
+		for (byte i = 0; i < 9; i ++) {
+			instruments[instrumentNum][i] = radFile.read();
+		}
+		instruments[instrumentNum][9]  =  radFile.read() & 0x07;
+		instruments[instrumentNum][9] += (radFile.read() & 0x07) << 4;
+	}
+
+	// Read song length, order list offset and skip order list.
+	songLength = radFile.read();
+	orderListOffset = radFile.curPosition();
+	radFile.seekSet(orderListOffset + songLength);
+
+	// Read pattern offsets.
+	for (byte i = 0; i < 32; i++) {
+		patternOffsets[i] = radFile.read() + (radFile.read() << 8);
+	}
+}
 * Read the next line in the pattern from the current file position.
 */
void readLine() {
  // Reset note data on each channel.
  for (byte i = 0; i < 9; i ++) {
    channelNote[i] = 0x0000;
  }

  // If the previous line was the last line of the pattern then we're done.
  if (endOfPattern) {
    return;
  }

  // If the next line number does not match our current line then it's empty
  // so there's nothing to do for us here.
  byte lineNumber = radFile.read();
  if ((lineNumber & 0x3F) != line) {
    radFile.seekSet(radFile.curPosition() - 1);
    return;
  }

  // Set end of pattern marker if this is the last line in the pattern.
  endOfPattern = lineNumber & 0x80;

  // Read note and effect data for each channel.
  bool isLastChannel = false;
  do {
    byte channelNumber = radFile.read();
    isLastChannel = channelNumber & 0x80;
    channelNumber = channelNumber & 0x0F;

    channelNote[channelNumber]  = radFile.read() << 8;
    channelNote[channelNumber] += radFile.read();
    if (channelNote[channelNumber] & 0x000F) {
      efftectParameter[channelNumber] = radFile.read();
    } else {
      efftectParameter[channelNumber] = 0x00;
    }
  } while(!isLastChannel);
}



 * Play a note on the given channel.
 */
void playNote(byte channel, byte octave, byte note) {
	opl2.setKeyOn(channel, false);
	opl2.setBlock(channel, octave + (note / 12));
	opl2.setFNumber(channel, pgm_read_word_near(noteFrequencies + (note % 12)));
	opl2.setKeyOn(channel, true);
}


