示例#1
0
        public void Render(float rmsValue)
        {
            using (LevelBmp.GetBitmapContext())
            {
                var level = (int)(rmsValue * Scale * Height);
                var y     = Height - 1 - level;
                y = y.Clip(0, Height - 1);

                var x = NextLine;

                if (x > 0)
                {
                    LevelBmp.DrawLine(x - 1, lastY, x, y, Colors.CornflowerBlue);
                }

                lastY = y;

                NextLine++;
                if (NextLine >= Width)
                {
                    NextLine = 0;
                }

                RenderBlank(NextLine, BlankWidth);
            }
        }
示例#2
0
        public void Render(IList <float> fftValues)
        {
            if (fftValues.IsEmpty())
            {
                return;
            }

            using (LevelBmp.GetBitmapContext())
            {
                var x = NextLine;

                for (var y = 0; y < fftValues.Count; y++)
                {
                    var color = palette.GetColor(fftValues[y]);
                    LevelBmp.SetPixel(x, Height - y - 1, color);
                }

                NextLine++;
                if (NextLine >= Width)
                {
                    NextLine = 0;
                }

                RenderBlank(NextLine, BlankWidth);
            }
        }