예제 #1
0
        /// <summary>
        /// sets graph data
        /// </summary>
        public void SetAudioData(float[] audioData)
        {
            this.audioData = audioData;
            bmp            = AudioAnalyzer.DrawWaveform(audioData,
                                                        new Size(this.Width, this.Height),
                                                        waveDisplayResolution,
                                                        waveDisplayAmplitude,
                                                        waveDisplayStartPosition,
                                                        sampleRate);

            // force redraw
            this.Invalidate();
        }
예제 #2
0
        private void WaveDisplayUserControl_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            int height = Height;
            int width  = Width;

            // if selected, highlight
            if (this.Selected)
            {
                drawingProperties.FillColor = Color.Gray;
            }
            else
            {
                drawingProperties.FillColor = Color.White;
            }

            float[] waveData;
            if (this.parentForm.DoShowRAWWaves)
            {
                waveData = this.waveData;
            }
            else
            {
                waveData = this.morphedData;
            }

            // get the waveform
            Bitmap _offlineBitmap = AudioAnalyzer.DrawWaveform(waveData,
                                                               new Size(this.Width, this.Height),
                                                               1,
                                                               -1, -1,
                                                               -1, -1,
                                                               -1,
                                                               44100,
                                                               1,
                                                               drawingProperties);

            if (_offlineBitmap != null)
            {
                // draw the offline bitmap
                g.DrawImage(_offlineBitmap, 0, 0);
            }

            var    drawFileNameFont     = new Font("Arial", 9);
            string fileName             = Path.GetFileNameWithoutExtension(this.FileName);
            SizeF  drawFileNameTextSize = g.MeasureString(fileName, drawFileNameFont);

            g.DrawString(fileName, drawFileNameFont, Brushes.Black, Width - drawFileNameTextSize.Width - 2, 1);
        }
        private void UpdateWaveform()
        {
            if (soundPlayer == null || soundPlayer.WaveformData == null)
            {
                return;
            }

            if (soundPlayer.WaveformData != null && soundPlayer.WaveformData.Length > 1)
            {
                this.offlineBitmap = AudioAnalyzer.DrawWaveform(soundPlayer.WaveformData, new Size(this.Width, this.Height), amplitude, startZoomSamplePosition, endZoomSamplePosition, soundPlayer.SampleRate, true);

                // force redraw
                this.Invalidate();
            }
        }
예제 #4
0
        void PictureBox1Paint(object sender, PaintEventArgs e)
        {
            int width  = pictureBox1.Size.Width;
            int height = pictureBox1.Size.Height;

            Graphics g = e.Graphics;

            // get the waveform
            Bitmap _offlineBitmap = AudioAnalyzer.DrawWaveform(waveData,
                                                               new Size(width, height),
                                                               1,
                                                               -1, -1,
                                                               -1, -1,
                                                               -1,
                                                               44100,
                                                               1,
                                                               drawingProperties);

            if (_offlineBitmap != null)
            {
                // draw the offline bitmap
                g.DrawImage(_offlineBitmap, 0, 0);
            }
        }