void AdlibNoteOnEx(int chan, byte note, int mod)
{
Debug.Assert(chan >= 0 && chan < 9);
#if ENABLE_OPL3
if (_opl3Mode) {
const int noteAdjusted = note + (mod >> 8) - 7;
const int pitchAdjust = (mod >> 5) & 7;
adlibWrite(0xA0 + chan, g_noteFrequencies[(noteAdjusted % 12) * 8 + pitchAdjust + 6 * 8]);
adlibWriteSecondary(0xA0 + chan, g_noteFrequencies[(noteAdjusted % 12) * 8 + pitchAdjust + 6 * 8]);
adlibWrite(0xB0 + chan, (CLIP(noteAdjusted / 12, 0, 7) << 2) | 0x20);
adlibWriteSecondary(0xB0 + chan, (CLIP(noteAdjusted / 12, 0, 7) << 2) | 0x20);
} else {
#endif
int code = (note << 7) + mod;
_curNotTable[chan] = (ushort)code;
_channelTable2[chan] = 0;
AdlibPlayNote(chan, code);
#if ENABLE_OPL3
}
#endif
}