Beispiel #1
0
        void DrawFrame(FFTFrame frame)
        {
            var len = _bitmap.Height;
            var dat = frame.Data;

            float factor = 1 / (DbMax - DbMin) * 255;

            for (int y = 0; y < len; y++)
            {
                var db = 10 * Math.Log(Math.Sqrt(dat[y]));
                var v  = (int)((db - DbMin) * factor);
                if (v < 0)
                {
                    v = 0;
                }
                else if (v > 255)
                {
                    v = 255;
                }

                colorBuffer[len - y - 1] = _palette[v].ToArgb();
            }

            _bitmap.AddFrame(colorBuffer);
        }
Beispiel #2
0
 void CreateFrameBuffer()
 {
     _frames = new Queue <FFTFrame>(FFTCapacity);
     for (int i = 0; i < FFTCapacity; i++)
     {
         var frame = new FFTFrame(FFTSize, samplerate);
         _frames.Enqueue(frame);
     }
 }
Beispiel #3
0
 void BitmapAddFrame(FFTFrame frame)
 {
     DrawFrame(frame);
 }