 
 // Different note F-numbers stored in program memory.
 const short noteFrequencies[12] PROGMEM = {
-  0x16B, 0x181, 0x198, 0x1B0, 0x1CA, 0x1E5,
-  0x202, 0x220, 0x241, 0x263, 0x287, 0x2AE
+	0x16B, 0x181, 0x198, 0x1B0, 0x1CA, 0x1E5,
+	0x202, 0x220, 0x241, 0x263, 0x287, 0x2AE
 };
 
 

 * Slide the pitch of a channel by a given F-number amount and return the new block + F-number.
 */
unsigned int pitchAdjust(byte channel, short amount) {
  byte block = opl2.getBlock(channel);
  short fNumber = opl2.getFNumber(channel);
  fNumber = max(0x000, min(fNumber + amount, 0x3FF));

  // Drop one octave (if possible) when the F-number drops below octave minimum.
  if (fNumber < FNUMBER_MIN) {
    if (block > 0) {
      block --;
      fNumber = FNUMBER_MAX - (FNUMBER_MIN - fNumber);
    }

  // Increase one octave (if possible) when the F-number reaches above octave maximum.
  } else if (fNumber > FNUMBER_MAX) {
    if (block < 7) {
      block ++;
      fNumber = FNUMBER_MIN + (fNumber - FNUMBER_MAX);
    }
  }

  // Set new octave and frequency and return combind octave + F-number value.
  opl2.setBlock(channel, block);
  opl2.setFNumber(channel, fNumber);
  return (block << 12) + fNumber;
}



 * 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);
}


