 
 #include <SPI.h>
 #include <OPL2.h>
-
-// For better results with midi files created for Window exchange midi_instruments.h for midi_instruments_win31.h
-// #include <midi_instruments_win31.h>
 #include <midi_instruments.h>
 #include <midi_drums.h>
 

	for (byte i = 0; i < OPL2_NUM_CHANNELS; i ++) {
		if (channelMap[i].midiChannel == channel && channelMap[i].midiNote == note) {
			opl2.setKeyOn(i, false);
			break;
		}
	}

		for (byte i = 0; i < OPL2_NUM_CHANNELS; i ++) {
			if (channelMap[oldestChannel[i]].midiChannel == MIDI_DRUM_CHANNEL) {
				opl2Channel = oldestChannel[i];
				oldestIndex = i;
				break;
			}
		}
		opl2.setKeyOn(opl2Channel, false);
	}

	// Update the list of last used channels by moving the current channel to the bottom so the last updated channel
	// will move to the front of the list. If no more OPL2 channels are free then the last updated one will be recycled.
	for (byte i = oldestIndex; i < OPL2_NUM_CHANNELS - 1; i ++) {
		oldestChannel[i] = oldestChannel[i + 1];
	}
	oldestChannel[OPL2_NUM_CHANNELS - 1] = opl2Channel;

	return opl2Channel;
}
