开发者

List Line2D.Double

These two code statements are part of program (I'm currently trying to develop) whose main purpose is to display a waveform during playback of an audio file (.wav).

The list lines , it contains line coordinates (values of samples in a diagram) ..is that correct?**

How would you repre开发者_高级运维sent the values stored in lines? And audioBytes ?

List<Byte> audioBytes;
List<Line2D.Double> lines;


Line2D.Double is actually a nested subclass of Line2D, so yes it will work fine. May I ask why don't you just try it, seems simple enough to test?

As for AudioBytes, I'm not sure what API you're using, or what you're doing with them, so I can't really tell, it's a list of bytes. Some more code and detail as to what you're doing would be helpful.

Well, the list stores lines, and lines store points (coordinates) that are the line segment's beginning and the end. In general, to draw a waveform, you don't need to store lines, you can simply store points, and then draw lines between them . However, you might not need this, depending on what you're doing. Assuming you have a constant step between the samples you draw, you can just store their amplitude (value of the sample), and translate and scale it accordingly. Since the step between the samples you draw is constant, it's fairly easy to calculate (distanceFromFirstSampleYoureDrawing*step).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜