NScumm.Core.Audio.SoftSynth.TownsMidiOutputChannel.GetEffectStartLevel C# (CSharp) Method

GetEffectStartLevel() private method

private GetEffectStartLevel ( byte type ) : short
type byte
return short
        short GetEffectStartLevel(byte type)
        {
            byte chan = (type < 13) ? _chanMap2[_chan] : ((type < 26) ? _chanMap[_chan] : _chan);

            if (type == 28)
                return 15;
            else if (type == 29)
                return 383;
            else if (type > 29)
                return 0;
            else if (type > 12)
                type -= 13;

            var defOff = type << 2;
            byte res = (byte)((_driver._chanState[chan].get(_effectDefaults[defOff + 0] >> 5) & _effectDefaults[defOff + 2]) >> _effectDefaults[defOff + 1]);
            if (_effectDefaults[defOff + 3] != 0)
                res = (byte)(_effectDefaults[defOff + 3] - res);

            return res;
        }