コード例 #1
0
        public static Bitmap SpectrumPaint(int stream, int width, int height)
        {
            Bitmap  Spectrum        = new Bitmap(1, 1);
            Visuals SpectrumCreater = new Visuals();

            switch (SpectrumType)
            {
            case 0:
                Spectrum = SpectrumCreater.CreateSpectrum(stream, width, height,
                                                          SpectrumColor1, SpectrumColor2, Color.Transparent,
                                                          false, false, true);
                break;

            case 1:
                Spectrum = SpectrumCreater.CreateSpectrumDot(stream, width, height,
                                                             SpectrumColor1, SpectrumColor2, Color.Transparent, 2, 2,
                                                             false, false, true);
                break;

            case 2:
                Spectrum = SpectrumCreater.CreateSpectrumBean(stream, width, height,
                                                              SpectrumColor1, SpectrumColor2, Color.Transparent, 1,
                                                              false, false, true);
                break;

            case 3:
                Spectrum = SpectrumCreater.CreateSpectrumEllipse(stream, width, height,
                                                                 SpectrumColor1, SpectrumColor2, Color.Transparent, 1, 1,
                                                                 false, false, true);
                break;

            case 4:
                Spectrum = SpectrumCreater.CreateSpectrumLine(stream, width, height,
                                                              SpectrumColor1, SpectrumColor2, Color.Transparent, 2, 2,
                                                              false, false, true);
                break;

            case 5:
                Spectrum = SpectrumCreater.CreateSpectrumLinePeak(stream, width, height,
                                                                  SpectrumColor1, SpectrumColor2, SpectrumColor3, Color.Transparent, 3, 3, 2, 3,
                                                                  false, false, true);
                break;

            case 6:
                Spectrum = SpectrumCreater.CreateSpectrumWave(stream, width, height,
                                                              SpectrumColor1, SpectrumColor2, Color.Transparent, 2,
                                                              false, false, true);
                break;
            }
            return(Spectrum);
        }
コード例 #2
0
 public Bitmap DrawSpectrumEllipse(int width, int height, bool highQuality, bool fullSpectrum)
 {
     return(_visuals.CreateSpectrumEllipse(_stream, width, height, _visColor1, _visColor2, _visBackColor, 1, 2, false, fullSpectrum, highQuality));
 }
コード例 #3
0
        private void drawSpectrum()
        {
            switch (spectId)
            {
            case 0:
                pictureBoxSpectrum.Image = vis.CreateSpectrum(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.Lime, Color.Red, Color.Black, false, false, false);
                break;

            case 1:
                pictureBoxSpectrum.Image = vis.CreateSpectrum(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.SteelBlue, Color.Pink, Color.Black, false, true, true);
                break;

            case 2:
                pictureBoxSpectrum.Image = vis.CreateSpectrumLine(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.Lime, Color.Red, Color.Black, 2, 2, false, false, false);
                break;

            case 3:
                pictureBoxSpectrum.Image = vis.CreateSpectrumLine(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.SteelBlue, Color.Pink, Color.Black, 16, 4, false, true, true);
                break;

            case 4:
                pictureBoxSpectrum.Image = vis.CreateSpectrumEllipse(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.Lime, Color.Red, Color.Black, 1, 2, false, false, false);
                break;

            case 5:
                pictureBoxSpectrum.Image = vis.CreateSpectrumEllipse(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.SteelBlue, Color.Pink, Color.Black, 2, 4, false, true, true);
                break;

            case 6:
                pictureBoxSpectrum.Image = vis.CreateSpectrumDot(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.Lime, Color.Red, Color.Black, 1, 0, false, false, false);
                break;

            case 7:
                pictureBoxSpectrum.Image = vis.CreateSpectrumDot(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.SteelBlue, Color.Pink, Color.Black, 2, 1, false, false, true);
                break;

            case 8:
                pictureBoxSpectrum.Image = vis.CreateSpectrumLinePeak(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.SeaGreen, Color.LightGreen, Color.Orange, Color.Black, 2, 1, 2, 10, false, false, false);
                break;

            case 9:
                pictureBoxSpectrum.Image = vis.CreateSpectrumLinePeak(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.GreenYellow, Color.RoyalBlue, Color.DarkOrange, Color.Black, 23, 5, 3, 5, false, true, true);
                break;

            case 10:
                pictureBoxSpectrum.Image = vis.CreateSpectrumWave(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.Yellow, Color.Orange, Color.Black, 1, false, false, false);
                break;

            case 11:
                pictureBoxSpectrum.Image = vis.CreateSpectrumBean(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.Chocolate, Color.DarkGoldenrod, Color.Black, 4, false, false, true);
                break;

            case 12:
                pictureBoxSpectrum.Image = vis.CreateSpectrumText(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.White, Color.Tomato, Color.Black, "BASS .NET IS GREAT PIECE! UN4SEEN ROCKS...", false, false, true);
                break;

            case 13:
                float amp = vis.DetectFrequency(stream, 10, 500, true);
                if (amp > 0.3)
                {
                    this.pictureBoxSpectrum.BackColor = Color.Red;
                }
                else
                {
                    this.pictureBoxSpectrum.BackColor = Color.Black;
                }
                break;

            case 14:
                Graphics g = Graphics.FromHwnd(this.pictureBoxSpectrum.Handle);
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                vis.CreateSpectrum3DVoicePrint(stream, g, new Rectangle(0, 0, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height), Color.Black, Color.White, voicePrintId, false, false);
                g.Dispose();

                voicePrintId++;
                if (voicePrintId > this.pictureBoxSpectrum.Width - 1)
                {
                    voicePrintId = 0;
                }
                break;

            case 15:
                pictureBoxSpectrum.Image = vis.CreateWaveForm(stream, this.pictureBoxSpectrum.Width, this.pictureBoxSpectrum.Height, Color.Green, Color.Red, Color.Gray, Color.Black, 1, true, false, true);
                break;
            }
        }
コード例 #4
0
        private void DrawSpectrum()
        {
            switch (_specIdx)
            {
            // normal spectrum (width = resolution)
            case 0:
                pictureBoxSpectrum.Image = _vis.CreateSpectrum(_stream, pictureBoxSpectrum.Width, pictureBoxSpectrum.Height,
                                                               Color.Lime, Color.Red, Color.Black, false, false, false);
                break;

            // normal spectrum (full resolution)
            case 1:
                pictureBoxSpectrum.Image = _vis.CreateSpectrum(_stream, pictureBoxSpectrum.Width, pictureBoxSpectrum.Height,
                                                               Color.SteelBlue, Color.Pink, Color.Black, false, true, true);
                break;

            // line spectrum (width = resolution)
            case 2:
                pictureBoxSpectrum.Image = _vis.CreateSpectrumLine(_stream, pictureBoxSpectrum.Width,
                                                                   pictureBoxSpectrum.Height, Color.Lime, Color.Red,
                                                                   Color.Black, 2, 2, false, false, false);
                break;

            // line spectrum (full resolution)
            case 3:
                pictureBoxSpectrum.Image = _vis.CreateSpectrumLine(_stream, pictureBoxSpectrum.Width,
                                                                   pictureBoxSpectrum.Height, Color.SteelBlue, Color.Pink,
                                                                   Color.Black, 16, 4, false, true, true);
                break;

            // ellipse spectrum (width = resolution)
            case 4:
                pictureBoxSpectrum.Image = _vis.CreateSpectrumEllipse(_stream, pictureBoxSpectrum.Width,
                                                                      pictureBoxSpectrum.Height, Color.Lime, Color.Red,
                                                                      Color.Black, 1, 2, false, false, false);
                break;

            // ellipse spectrum (full resolution)
            case 5:
                pictureBoxSpectrum.Image = _vis.CreateSpectrumEllipse(_stream, pictureBoxSpectrum.Width,
                                                                      pictureBoxSpectrum.Height, Color.SteelBlue, Color.Pink,
                                                                      Color.Black, 2, 4, false, true, true);
                break;

            // dot spectrum (width = resolution)
            case 6:
                pictureBoxSpectrum.Image = _vis.CreateSpectrumDot(_stream, pictureBoxSpectrum.Width, pictureBoxSpectrum.Height,
                                                                  Color.Lime, Color.Red, Color.Black, 1, 0, false, false,
                                                                  false);
                break;

            // dot spectrum (full resolution)
            case 7:
                pictureBoxSpectrum.Image = _vis.CreateSpectrumDot(_stream, pictureBoxSpectrum.Width, pictureBoxSpectrum.Height,
                                                                  Color.SteelBlue, Color.Pink, Color.Black, 2, 1, false, false,
                                                                  true);
                break;

            // peak spectrum (width = resolution)
            case 8:
                pictureBoxSpectrum.Image = _vis.CreateSpectrumLinePeak(_stream, pictureBoxSpectrum.Width,
                                                                       pictureBoxSpectrum.Height, Color.SeaGreen,
                                                                       Color.LightGreen, Color.Orange, Color.Black, 2, 1, 2,
                                                                       10, false, false, false);
                break;

            // peak spectrum (full resolution)
            case 9:
                pictureBoxSpectrum.Image = _vis.CreateSpectrumLinePeak(_stream, pictureBoxSpectrum.Width,
                                                                       pictureBoxSpectrum.Height, Color.GreenYellow,
                                                                       Color.RoyalBlue, Color.DarkOrange, Color.Black, 23, 5,
                                                                       3, 5, false, true, true);
                break;

            // wave spectrum (width = resolution)
            case 10:
                pictureBoxSpectrum.Image = _vis.CreateSpectrumWave(_stream, pictureBoxSpectrum.Width,
                                                                   pictureBoxSpectrum.Height, Color.Yellow, Color.Orange,
                                                                   Color.Black, 1, false, false, false);
                break;

            // dancing beans spectrum (width = resolution)
            case 11:
                pictureBoxSpectrum.Image = _vis.CreateSpectrumBean(_stream, pictureBoxSpectrum.Width,
                                                                   pictureBoxSpectrum.Height, Color.Chocolate,
                                                                   Color.DarkGoldenrod, Color.Black, 4, false, false, true);
                break;

            // dancing text spectrum (width = resolution)
            case 12:
                pictureBoxSpectrum.Image = _vis.CreateSpectrumText(_stream, pictureBoxSpectrum.Width,
                                                                   pictureBoxSpectrum.Height, Color.White, Color.Tomato,
                                                                   Color.Black, "MPTagThat is Great", false, false, true);
                break;

            // frequency detection
            case 13:
                float amp = _vis.DetectFrequency(_stream, 10, 500, true);
                if (amp > 0.3)
                {
                    pictureBoxSpectrum.BackColor = Color.Red;
                }
                else
                {
                    pictureBoxSpectrum.BackColor = Color.Black;
                }
                break;

            // 3D voice print
            case 14:
                // we need to draw directly directly on the picture box...
                // normally you would encapsulate this in your own custom control
                Graphics g = Graphics.FromHwnd(pictureBoxSpectrum.Handle);
                g.SmoothingMode = SmoothingMode.AntiAlias;
                _vis.CreateSpectrum3DVoicePrint(_stream, g,
                                                new Rectangle(0, 0, pictureBoxSpectrum.Width, pictureBoxSpectrum.Height),
                                                Color.Black, Color.White, _voicePrintIdx, false, false);
                g.Dispose();
                // next call will be at the next pos
                _voicePrintIdx++;
                if (_voicePrintIdx > pictureBoxSpectrum.Width - 1)
                {
                    _voicePrintIdx = 0;
                }
                break;

            // WaveForm
            case 15:
                pictureBoxSpectrum.Image = _vis.CreateWaveForm(_stream, pictureBoxSpectrum.Width, pictureBoxSpectrum.Height,
                                                               Color.Green, Color.Red, Color.Gray, Color.Black, 1, true, false,
                                                               true);
                break;
            }
        }
コード例 #5
0
        private void UpdateSpectrum()
        {
            Bitmap imgSpectrum = null;
            switch (specIdx)
            {
                // normal spectrum (width = resolution)
                case 0:
                    imgSpectrum = _vis.CreateSpectrum(_stream, this.spectrumWidth, this.spectrumHeight, Color.Lime, Color.Red, Color.Black, false, false, false);
                    break;
                // normal spectrum (full resolution)
                case 1:
                    imgSpectrum = _vis.CreateSpectrum(_stream, this.spectrumWidth, this.spectrumHeight, Color.SteelBlue, Color.Pink, Color.Black, false, true, true);
                    break;
                // line spectrum (width = resolution)
                case 2:
                    imgSpectrum = _vis.CreateSpectrumLine(_stream, this.spectrumWidth, this.spectrumHeight, Color.Lime, Color.Red, Color.Black, 5, 2, false, false, false);
                    break;
                // line spectrum (full resolution)
                case 3:
                    imgSpectrum = _vis.CreateSpectrumLine(_stream, this.spectrumWidth, this.spectrumHeight, Color.SteelBlue, Color.Pink, Color.Black, 16, 4, false, true, true);
                    break;
                // ellipse spectrum (width = resolution)
                case 4:
                    imgSpectrum = _vis.CreateSpectrumEllipse(_stream, this.spectrumWidth, this.spectrumHeight, Color.Lime, Color.Red, Color.Black, 1, 2, false, false, false);
                    break;
                // ellipse spectrum (full resolution)
                case 5:
                    imgSpectrum = _vis.CreateSpectrumEllipse(_stream, this.spectrumWidth, this.spectrumHeight, Color.SteelBlue, Color.Pink, Color.Black, 2, 4, false, true, true);
                    break;
                // dot spectrum (width = resolution)
                case 6:
                    imgSpectrum = _vis.CreateSpectrumDot(_stream, this.spectrumWidth, this.spectrumHeight, Color.Lime, Color.Red, Color.Black, 1, 0, false, false, false);
                    break;
                // dot spectrum (full resolution)
                case 7:
                    imgSpectrum = _vis.CreateSpectrumDot(_stream, this.spectrumWidth, this.spectrumHeight, Color.SteelBlue, Color.Pink, Color.Black, 2, 1, false, false, true);
                    break;
                // peak spectrum (width = resolution)
                case 8:
                    imgSpectrum = _vis.CreateSpectrumLinePeak(_stream, this.spectrumWidth, this.spectrumHeight, Color.SeaGreen, Color.LightGreen, Color.Orange, Color.Black, 2, 1, 2, 10, false, false, false);
                    break;
                // peak spectrum (full resolution)
                case 9:
                    imgSpectrum = _vis.CreateSpectrumLinePeak(_stream, this.spectrumWidth, this.spectrumHeight, Color.GreenYellow, Color.RoyalBlue, Color.DarkOrange, Color.Black, 23, 5, 3, 5, false, true, true);
                    break;
                // wave spectrum (width = resolution)
                case 10:
                    imgSpectrum = _vis.CreateSpectrumWave(_stream, this.spectrumWidth, this.spectrumHeight, Color.Yellow, Color.Orange, Color.Black, 1, false, false, false);
                    break;
                // dancing beans spectrum (width = resolution)
                case 11:
                    imgSpectrum = _vis.CreateSpectrumBean(_stream, this.spectrumWidth, this.spectrumHeight, Color.Chocolate, Color.DarkGoldenrod, Color.Black, 4, false, false, true);
                    break;
                // dancing text spectrum (width = resolution)
                case 12:
                    imgSpectrum = _vis.CreateSpectrumText(_stream, this.spectrumWidth, this.spectrumHeight, Color.White, Color.Tomato, Color.Black, "BASS .NET IS GREAT PIECE! UN4SEEN ROCKS...", false, false, true);
                    break;
            }

            SpectrumUpdate?.Invoke(imgSpectrum);
        }