public override void NoteOn(byte note, byte velocity)
{
TownsMidiOutputChannel oc = _driver.AllocateOutputChannel(_priority);
if (oc == null)
{
return;
}
oc.Connect(this);
oc._adjustModTl = (byte)(_instrument[10] & 1);
oc._note = note;
oc._sustainNoteOff = 0;
oc._duration = (short)(_instrument[29] * 63);
oc._operator1Tl = (byte)((_instrument[1] & 0x3f) + _driver._operatorLevelTable[((velocity >> 1) << 5) + (_instrument[4] >> 2)]);
if (oc._operator1Tl > 63)
{
oc._operator1Tl = 63;
}
oc._operator2Tl = (byte)((_instrument[6] & 0x3f) + _driver._operatorLevelTable[((velocity >> 1) << 5) + (_instrument[9] >> 2)]);
if (oc._operator2Tl > 63)
{
oc._operator2Tl = 63;
}
oc.SetupProgram(_instrument, oc._adjustModTl == 1 ? _programAdjustLevel[_driver._operatorLevelTable[(_tl >> 2) + (oc._operator1Tl << 5)]] : oc._operator1Tl, _programAdjustLevel[_driver._operatorLevelTable[(_tl >> 2) + (oc._operator2Tl << 5)]]);
oc.NoteOn((byte)(note + _transpose), _freqLSB);
if ((_instrument[11] & 0x80) != 0)
{
oc.SetupEffects(0, _instrument[11], _instrument, 12);
}
else
{
oc._effectEnvelopes[0].state = EnvelopeState.Ready;
}
if ((_instrument[20] & 0x80) != 0)
{
oc.SetupEffects(1, _instrument[20], _instrument, 21);
}
else
{
oc._effectEnvelopes[1].state = EnvelopeState.Ready;
}
}