【发布时间】:2015-10-14 21:07:40
【问题描述】:
我正在使用 Superpowered SDK 来播放声音。 它有一个返回 unsigned char** 的函数,称为 peakWaveForm。 我写了一个自定义 uiview 并尝试绘制这个值,我的视图看起来不太好。我的问题是,绘制波形的值应该如何? 以及什么样的变量。数组?。波形的正常大小应该是多少? SDK 返回一个 unsigned char** 我该如何继续?
- (void)drawRect:(CGRect)updateRect
{
unsigned i, maxIndex;
maxIndex = floor(CGRectGetMaxX(updateRect));
i = floor(CGRectGetMinX(updateRect));
float firstPoint = (float)mPeakWaveForm[0][i];
UIBezierPath *path = [UIBezierPath bezierPath];
path.lineWidth = 2;
[[UIColor blackColor] setFill];
[path moveToPoint:CGPointMake(i,firstPoint)];
for(i; i <= maxIndex; i++)
{
float nextPoint = (float)mPeakWaveForm[0][i];
[path addLineToPoint:CGPointMake(i, nextPoint)];
}
[path fill];
}
【问题讨论】:
标签: ios objective-c audio waveform