void AdlibSetupChannel(int chan, AdLibInstrument instr, byte vol1, byte vol2)
{
Debug.Assert(chan >= 0 && chan < 9);
byte channel = operator1Offsets[chan];
AdlibWrite((byte)(channel + 0x20), instr.ModCharacteristic);
AdlibWrite((byte)(channel + 0x40), (byte)((instr.ModScalingOutputLevel | 0x3F) - vol1));
AdlibWrite((byte)(channel + 0x60), (byte)(0xff & (~instr.ModAttackDecay)));
AdlibWrite((byte)(channel + 0x80), (byte)(0xff & (~instr.ModSustainRelease)));
AdlibWrite((byte)(channel + 0xE0), instr.ModWaveformSelect);
channel = operator2Offsets[chan];
AdlibWrite((byte)(channel + 0x20), instr.CarCharacteristic);
AdlibWrite((byte)(channel + 0x40), (byte)((instr.CarScalingOutputLevel | 0x3F) - vol2));
AdlibWrite((byte)(channel + 0x60), (byte)(0xff & (~instr.CarAttackDecay)));
AdlibWrite((byte)(channel + 0x80), (byte)(0xff & (~instr.CarSustainRelease)));
AdlibWrite((byte)(channel + 0xE0), instr.CarWaveformSelect);
AdlibWrite((byte)(chan + 0xC0), instr.Feedback
#if ENABLE_OPL3
| (_opl3Mode ? 0x30 : 0)
#endif
);
}