private void openFile(String fn) { try { sf = new SoundFile(fn); drawWaveform(pictureBox1, sf, 1); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
private void drawWaveform(PictureBox pb, SoundFile sf, int channel) { Point[] points = sf.getWaveformPoints(pb.Width, pb.Height, 1); waveformBMP = new Bitmap(pb.Size.Width, pb.Size.Height); pb.Image = waveformBMP; g = Graphics.FromImage(waveformBMP); Pen p = new Pen(Color.Black); for (int i = 0; i < points.Length - 1; i++) { g.DrawLine(p, points[i], points[i + 1]); } pb.Image = waveformBMP; g.Dispose(); }