Exemple #1
0
        private float autoDivisions = 2;                        //< Auto attenuation fit to X divisions

        /// <summary>Initialize oscilloscope channel</summary>
        /// <param name="oscProbe">Default input connected to this channel</param>
        /// <param name="bufferSize">Buffer capacity</param>
        public void Initialize(Oscilloscope osc, OscProbe oscProbe, int bufferSize)
        {
            oscilloscope       = osc;
            oscSettings        = osc.oscSettings;
            oscRenderer        = osc.oscRenderer;
            chanLabelPosX      = oscSettings.rectangle.xMin;
            valsLabelPosX      = oscSettings.rectangle.xMax;
            label.color        = color;
            statusText.color   = color;
            ledPlugged.colorOn = color;
            ledPlugged.message = label.text = channelName.ToString();
            buffer             = new Vector3[bufferSize];
            Plug(oscProbe);
            RenderGUI();
        }
Exemple #2
0
        // =============================================================================================================
        // The renderer
        // =============================================================================================================

        /// <summary>Render this channel</summary>
        /// <param name="renderer"></param>
        /// <param name="smpBeg">Start sample</param>
        /// <param name="smpEnd">End sample</param>
        /// <param name="smpCenter">Samples quantity</param>
        /// <param name="pixPerSample">Scale samples to pixels</param>
        public void Render(OscRenderer renderer, int smpBeg, int smpEnd, float pixStart, float pixPerSample)
        {
            // Do not render external channelor if "Off" probe used
            if (isPlugged)
            {
                if (CalculateMinMax(smpBeg, smpEnd))
                {
                    isDirtyStatusText = true;
                }

                switch (style)
                {
                case OscProbe.Style.Default:
                    switch (format)
                    {
                    case OscProbe.Format.Float:
                        renderer.PlotFloat(this, smpBeg, smpEnd, pixStart, pixPerSample, color);
                        break;

                    case OscProbe.Format.Vector2:
                        renderer.PlotVector2(this, smpBeg, smpEnd, pixStart, pixPerSample, color);
                        break;

                    case OscProbe.Format.Vector3:
                        renderer.PlotVector3(this, smpBeg, smpEnd, pixStart, pixPerSample, color);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                    break;

                case OscProbe.Style.Logic:
                    renderer.PlotFloatLogic(this, smpBeg, smpEnd, pixStart, pixPerSample, color);
                    break;
                }
            }
        }