Exemplo n.º 1
0
        private void DoSendMidiMessage(ref WacomMTFingerCollection fingercollection)
        {
            //if we decided to skip early frames
            if (skipEarlyFrames && fingercollection.FrameNumber >= framesToSkip)
            {
                if (!TouchHelper.AllFingersUp(ref fingercollection) && fingercollection.FingerCount <= 5)
                {
                    //X value for messages
                    MidiFingerMessage fmX = mtouchMessages[fingercollection.FingerCount - 1].MessageX;
                    int val = (int)(((fingercollection.GetFingerByIndex(0).X * 10000) * fmX.MaxValue) / 10000) + fmX.MinValue;
                    SendMidiMessage(fmX.MidiCtrlr, val, fmX.MidiChannel);

                    //Y value for messages
                    MidiFingerMessage fmY = mtouchMessages[fingercollection.FingerCount - 1].MessageY;
                    val = (int)(fmY.MaxValue - (((fingercollection.GetFingerByIndex(0).Y * 10000) * fmY.MaxValue) / 10000) + fmY.MinValue);
                    SendMidiMessage(fmY.MidiCtrlr, val, fmY.MidiChannel);
                }
            }
        }
Exemplo n.º 2
0
        /*what to do when repainting the control*/
        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            //if there is at least 1 and less than 5 fingers on tablet
            if (!TouchHelper.AllFingersUp(ref _fingerCollection) && _fingerCollection.FingerCount <= 5)
            {
                for (uint i = 0; i < _fingerCollection.FingerCount; i++)
                {
                    WacomMTFinger finger = _fingerCollection.GetFingerByIndex(i);
                    int           xpos   = (int)(((finger.X * 10000 + 1) * panel1.Width) / 10000);
                    int           ypos   = (int)(((finger.Y * 10000 + 1) * panel1.Height) / 10000);

                    _gp.DrawRectangle(_pen, xpos, ypos, TraceSize, TraceSize);
                    _gp.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                }

                //display the actual frame number on control
                lblFrames.Text = _fingerCollection.FrameNumber.ToString();
            }
            else
            {
                lblFrames.Text = "";
            }
        }