Exemplo n.º 1
0
        public void TriggerNotes(byte color, byte type, byte flag, byte[] velocities, int velocityArrayOffset)
        {
            int isRed    = color & ((byte)PadColor.Red);
            int isYellow = color & ((byte)PadColor.Yellow);
            int isBlue   = color & ((byte)PadColor.Blue);
            int isGreen  = color & ((byte)PadColor.Green);

            int isTom    = type & ((byte)PadType.Tom);
            int isCymbal = type & ((byte)PadType.Cymbal);

            bool OneColor = ((isRed != 0 ? 1 : 0) + (isYellow != 0 ? 1 : 0) + (isBlue != 0 ? 1 : 0) + (isGreen != 0 ? 1 : 0)) == 1;

            if (isCymbal != 0)
            {
                if (flag == 0)
                {
                    m_HitFilter.TriggerNote((byte)DrumPad.YellowCymbal, calcVelocity(velocities[velocityArrayOffset + (OneColor ? 0 : 1)]));
                    if (OneColor == false)
                    {
                        isYellow = 0;
                    }
                }
                if ((flag & (byte)CymbalType.Blue) != 0)
                {
                    m_HitFilter.TriggerNote((byte)DrumPad.BlueCymbal, calcVelocity(velocities[velocityArrayOffset + (OneColor ? 3 : 1)]));
                    if (OneColor == false)
                    {
                        isBlue = 0;
                    }
                }
                if ((flag & (byte)CymbalType.Green) != 0)
                {
                    m_HitFilter.TriggerNote((byte)DrumPad.GreenCymbal, calcVelocity(velocities[velocityArrayOffset + (OneColor ? 2 : 1)]));
                    if (OneColor == false)
                    {
                        isGreen = 0;
                    }
                }
            }
            if (isTom != 0)
            {
                if (isRed != 0)
                {
                    m_HitFilter.TriggerNote((byte)DrumPad.RedTom, calcVelocity(velocities[velocityArrayOffset + 1]));
                }
                if (isYellow != 0)
                {
                    m_HitFilter.TriggerNote((byte)DrumPad.YellowTom, calcVelocity(velocities[velocityArrayOffset + 0]));
                }
                if (isBlue != 0)
                {
                    m_HitFilter.TriggerNote((byte)DrumPad.BlueTom, calcVelocity(velocities[velocityArrayOffset + 3]));
                }
                if (isGreen != 0)
                {
                    m_HitFilter.TriggerNote((byte)DrumPad.GreenTom, calcVelocity(velocities[velocityArrayOffset + 2]));
                }
            }
        }
Exemplo n.º 2
0
 private void HandleDrumPads(byte[] data)
 {
     if ((data[11] & (byte)PadValue.Red) != 0)
     {
         m_HitFilter.TriggerNote((byte)DrumPad.RedTom, (byte)((127 - data[4]) * 2));
     }
     if ((data[11] & (byte)PadValue.Blue) != 0)
     {
         m_HitFilter.TriggerNote((byte)DrumPad.BlueTom, (byte)((127 - (255 - data[6])) * 2));
     }
     if ((data[11] & (byte)PadValue.Green) != 0)
     {
         m_HitFilter.TriggerNote((byte)DrumPad.GreenTom, (byte)((255 - data[3]) * 2));
     }
     if ((data[11] & (byte)PadValue.Yellow) != 0)
     {
         m_HitFilter.TriggerNote((byte)DrumPad.YellowCymbal, (byte)((data[5]) * 2));
     }
     if ((data[11] & (byte)PadValue.Orange) != 0)
     {
         m_HitFilter.TriggerNote((byte)DrumPad.OrangeCymbal, (byte)((255 - data[7]) * 2));
     }
     if ((data[11] & (byte)PadValue.Pedal) != 0)
     {
         m_HitFilter.TriggerNote((byte)DrumPad.Pedal1, (byte)((127 - data[8]) * 2));
     }
 }