Пример #1
0
        void SendEffectLevel(byte value)
        {
            if (MidiChannel == null)
            {
                return;
            }

            // As described in bug report #1088045 "MI2: Minor problems in native MT-32 mode"
            // for the MT-32 one has to use a sysEx event to change the effect level (rather
            // the reverb setting).
            if (Player._se.IsNativeMT32)
            {
                if (value != 127 && value != 0)
                {
//                    Console.Error.WriteLine("Trying to use unsupported effect level value {0} in native MT-32 mode.", value);

                    if (value >= 64)
                    {
                        value = 127;
                    }
                    else
                    {
                        value = 0;
                    }
                }

                var message = new byte[] { 0x41, 0x00, 0x16, 0x12, 0x00, 0x00, 0x06, 0x00, 0x00 };
                message[1] = MidiChannel.Number;
                message[7] = (byte)((value == 127) ? 1 : 0);
                message[8] = (byte)(128 - (6 + message[7]));
                Player.MidiDriver.SysEx(message, 9);
            }
            else
            {
                MidiChannel.EffectLevel(value);
            }
        }